[docs]classCollateFn(JsonReaderWriter,ABC):""" Abstract class to define how sequences of :py:class:`~clinicadl.data.structures.Sample` are collated into batches. See :torch:`PyTorch's documentation <data.html#loading-batched-and-non-batched-data>`. The only function to override is :py:meth:`__call__`, which defines how the samples are collated, and thus what will be the output of the :py:class:`~clinicadl.data.dataloader.DataLoader`. """
[docs]@abstractmethoddef__call__(self,samples:Sequence[SampleLike])->BatchType:""" Defines how the samples are collated. Parameters ---------- samples : Sequence[SampleLike] A sequence of :py:class:`Samples <clinicadl.data.structures.Sample>`, sequences of ``Samples``, or dictionaries of ``Samples``. Returns ------- BatchType A :py:class:`~clinicadl.data.dataloader.Batch`, a sequence of ``Batches``, or a dictionary of ``Batches``. """