scvi.data.AnnTorchDataset#
- class scvi.data.AnnTorchDataset(adata_manager, getitem_tensors=None, load_sparse_tensor=False)[source]#
Extension of
Dataset
forAnnData
objects.- Parameters:
adata_manager (
AnnDataManager
) –AnnDataManager
object with a registered AnnData object.getitem_tensors (
list
|dict
[str
,type
] |None
(default:None
)) –Specifies the keys in the data registry (
adata_manager.data_registry
) to return in__getitem__
. One of the following:dict
: Keys correspond to keys in the data registry and values correspond to the
desired
dtype
of the returned data. *list
: Elements correspond to keys in the data registry. Continuous data will be returned asfloat32
and discrete data will be returned asint64
. *None
: All registered data will be returned. Continuous data will be returned asfloat32
and discrete data will be returned asint64
.load_sparse_tensor (
bool
(default:False
)) –EXPERIMENTAL
IfTrue
, loads data with sparse CSR or CSC layout as aTensor
with the same layout. Can lead to speedups in data transfers to GPUs, depending on the sparsity of the data.
Attributes table#
Dictionary of data tensors. |
|
Keys and corresponding |
|
Keys in the data registry. |
Methods table#
Attributes#
- AnnTorchDataset.data[source]#
Dictionary of data tensors.
First time this is accessed, data is fetched from the underlying
AnnData
object. Subsequent accesses will return the cached dictionary.