MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / pad_list_data_collate

Function pad_list_data_collate

monai/data/utils.py:644–667  ·  view source on GitHub ↗

Function version of :py:class:`monai.transforms.croppad.batch.PadListDataCollate`. Same as MONAI's ``list_data_collate``, except any tensors are centrally padded to match the shape of the biggest tensor in each dimension. This transform is useful if some of the applied transforms gener

(batch: Sequence, method: str = Method.SYMMETRIC, mode: str = NumpyPadMode.CONSTANT, **kwargs)

Source from the content-addressed store, hash-verified

642
643
644def pad_list_data_collate(batch: Sequence, method: str = Method.SYMMETRIC, mode: str = NumpyPadMode.CONSTANT, **kwargs):
645 """
646 Function version of :py:class:`monai.transforms.croppad.batch.PadListDataCollate`.
647
648 Same as MONAI's ``list_data_collate``, except any tensors are centrally padded to match the shape of the biggest
649 tensor in each dimension. This transform is useful if some of the applied transforms generate batch data of
650 different sizes.
651
652 This can be used on both list and dictionary data.
653 Note that in the case of the dictionary data, this decollate function may add the transform information of
654 `PadListDataCollate` to the list of invertible transforms if input batch have different spatial shape, so need to
655 call static method: `monai.transforms.croppad.batch.PadListDataCollate.inverse` before inverting other transforms.
656
657 Args:
658 batch: batch of data to pad-collate
659 method: padding method (see :py:class:`monai.transforms.SpatialPad`)
660 mode: padding mode (see :py:class:`monai.transforms.SpatialPad`)
661 kwargs: other arguments for the `np.pad` or `torch.pad` function.
662 note that `np.pad` treats channel dimension as the first dimension.
663
664 """
665 from monai.transforms.croppad.batch import PadListDataCollate # needs to be here to avoid circular import
666
667 return PadListDataCollate(method=method, mode=mode, **kwargs)(batch)
668
669
670def no_collation(x):

Callers 1

_testing_collateFunction · 0.90

Calls 1

PadListDataCollateClass · 0.90

Tested by 1

_testing_collateFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…