scvi.dataloaders.AnnDataLoader#

class scvi.dataloaders.AnnDataLoader(adata_manager, shuffle=False, indices=None, batch_size=128, data_and_attributes=None, drop_last=False, iter_ndarray=False, **data_loader_kwargs)[source]#

DataLoader for loading tensors from AnnData objects.

Parameters:
adata_manager : AnnDataManager

AnnDataManager object with a registered AnnData object.

shuffle

Whether the data should be shuffled

indices

The indices of the observations in the adata to load

batch_size : Optional[int]

minibatch size to load each iteration

data_and_attributes : dict | NoneOptional[dict] (default: None)

Dictionary with keys representing keys in data registry (adata_manager.data_registry) and value equal to desired numpy loading type (later made into torch tensor). If None, defaults to all registered data.

data_loader_kwargs

Keyword arguments for DataLoader

iter_ndarray : bool (default: False)

Whether to iterate over numpy arrays instead of torch tensors

Attributes table#

Methods table#

Attributes#

multiprocessing_context#

AnnDataLoader.multiprocessing_context#

dataset#

AnnDataLoader.dataset: Dataset[T_co]#

batch_size#

AnnDataLoader.batch_size: Optional[int]#

num_workers#

AnnDataLoader.num_workers: int#

pin_memory#

AnnDataLoader.pin_memory: bool#

drop_last#

AnnDataLoader.drop_last: bool#

timeout#

AnnDataLoader.timeout: float#

sampler#

AnnDataLoader.sampler: Union[Sampler, Iterable]#

prefetch_factor#

AnnDataLoader.prefetch_factor: int#

Methods#

check_worker_number_rationality#

AnnDataLoader.check_worker_number_rationality()#