Hi,
I’m redirected from Tensor Nan Error · Issue #65 · scverse/scvi-tutorials · GitHub
I’m following DestVI_tutorial.ipynb to run the training in order to get the cell type composition matrix
My input singlecell data:
AnnData object with n_obs × n_vars = 1691 × 19972
obs: ‘cell_types’
print(np.max(sc_adata.X))
print(np.min(sc_adata.X))
print(np.all(np.isfinite(sc_adata.X)))
print(np.min(sc_adata.X.sum(1)))
10738.0
0.0
True
2508.0
sc_adata.obs.cell_types:
0 Inhibitory
1 Inhibitory
2 Inhibitory
3 Inhibitory
4 Inhibitory
...
1686 Endothelial
1687 Endothelial
1688 Endothelial
1689 Endothelial
1690 Endothelial
Name: cell_types, Length: 1691, dtype: category
Categories (6, object): ['Astrocyte', 'Endothelial', 'Excitatory', 'Inhibitory', 'Microglia', 'OD']
My input ST data:
AnnData object with n_obs × n_vars = 3067 × 135
obsm: ‘location’
print(np.max(st_adata.X))
print(np.min(st_adata.X))
print(np.all(np.isfinite(st_adata.X)))
print(np.min(st_adata.X.sum(1)))
529.64
0.0
True
7.1822705
print(np.max(st_adata.obsm[‘spatial’]))
print(np.min(st_adata.obsm[‘spatial’]))
print(np.all(np.isfinite(st_adata.obsm[‘spatial’])))
print(np.min(st_adata.obsm[‘spatial’].sum(1)))
4405.402956
-4349.457843
True
-6999.981796
However, when training the sc model, the following error occurred:
ValueError: Expected parameter loc (Tensor of shape (128, 5)) of distribution Normal(loc: torch.Size([128, 5]), scale: torch.Size([128, 5])) to satisfy the constraint Real(), but found invalid values:
tensor([[nan, nan, nan, nan, nan],
nan, nan, nan, nan, nan],
[nan, nan, nan, nan, nan]], device='cuda:0', grad_fn=<AddmmBackward0>)
Have you faced with similar error before? Hoping that you can help me, thank you so much!