-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
the generic collate API is implemented in pytorch
def collate(batch, *, collate_fn_map: Optional[Dict[Union[Type, Tuple[Type, ...]], Callable]] = None):
r"""
General collate function that handles collection type of element within each batch
and opens function registry to deal with specific element types. `default_collate_fn_map`
provides default collate functions for tensors, numpy arrays, numbers and strings.
probably the monai helper functions could be simplified:
Lines 448 to 451 in 50c3f32
| def list_data_collate(batch: Sequence): | |
| """ | |
| Enhancement for PyTorch DataLoader default collate. | |
| If dataset already returns a list of batch data that generated in transforms, need to merge all data to 1 list. |
Lines 427 to 430 in 50c3f32
| def collate_meta_tensor(batch): | |
| """collate a sequence of meta tensor sequences/dictionaries into | |
| a single batched metatensor or a dictionary of batched metatensor""" | |
| if not isinstance(batch, Sequence): |
Nic-Ma