anndata.experimental.AnnLoader
- class anndata.experimental.AnnLoader(adatas, batch_size=1, shuffle=False, use_default_converter=True, use_cuda=False, **kwargs)
PyTorch DataLoader for AnnData objects.
Builds DataLoader from a sequence of AnnData objects, from an
AnnCollection
object or from anAnnCollectionView
object. Takes care of the required conversions.- Parameters
- adatas :
Sequence
[AnnData
] | {str
:AnnData
}Union
[Sequence
[AnnData
],Dict
[str
,AnnData
]] AnnData
objects or anAnnCollection
object from which to load the data.- batch_size :
int
(default:1
) How many samples per batch to load.
- shuffle :
bool
(default:False
) Set to
True
to have the data reshuffled at every epoch.- use_default_converter :
bool
(default:True
) Use the default converter to convert arrays to pytorch tensors, transfer to the default cuda device (if
use_cuda=True
), do memory pinning (ifpin_memory=True
). If you pass an AnnCollection object with prespecified converters, the default converter won’t overwrite these converters but will be applied on top of them.- use_cuda :
bool
(default:False
) Transfer pytorch tensors to the default cuda device after conversion. Only works if
use_default_converter=True
- **kwargs
Arguments for PyTorch DataLoader. If
adatas
is not anAnnCollection
object, then also arguments forAnnCollection
initialization.
- adatas :
Methods