cyto_dl.datamodules.array module#

cyto_dl.datamodules.array.make_array_dataloader(data: ndarray | List[ndarray] | List[Dict[str, ndarray]], transforms: Sequence[Callable] | Callable, source_key: str = 'input', **dataloader_kwargs)[source]#

Create a dataloader from a an array dataset.

Parameters:
  • data (Union[np.ndarray, List[np.ndarray], List[Dict[str, np.ndarray]],) – If a numpy array (prediction only), the dataloader will be created with a single source_key. If a list each element must be a numpy array (for prediction) or a dictionary containing numpy array values (for training).

  • transforms (Union[Sequence[Callable], Callable],) – Transforms to apply to each sample

  • dataloader_kwargs – Additional keyword arguments are passed to the torch.utils.data.DataLoader class when instantiating it (aside from shuffle which is only used for the train dataloader). Among these args are num_workers, batch_size, shuffle, etc. See the PyTorch docs for more info on these args: https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader