Skip to content

Commit

Permalink
adding option for adata.X to NOT be numpy array and still check value…
Browse files Browse the repository at this point in the history
…s for NaNS
  • Loading branch information
ivichadriana committed Aug 12, 2024
1 parent 375c79b commit 118b426
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/single_translator_VAE/vae/vae_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,12 @@ def setup_anndata(
-------
AnnData Manager Object, AnnData
"""
assert not torch.isinf(torch.tensor(adata.X.toarray())).any(), "Input data contains infinite values"
assert (torch.tensor(adata.X.toarray()) < 1e10).all(), "Input data contains extremely high values"
if type(adata.X) != np.ndarray:
assert not torch.isinf(torch.tensor(adata.X.toarray())).any(), "Input data contains infinite values"
assert (torch.tensor(adata.X.toarray()) < 1e10).all(), "Input data contains extremely high values"
else:
assert not torch.isinf(torch.tensor(adata.X)).any(), "Input data contains infinite values"
assert (torch.tensor(adata.X) < 1e10).all(), "Input data contains extremely high values"
setup_method_args = cls._get_setup_method_args(**locals())
anndata_fields = [
LayerField(REGISTRY_KEYS.X_KEY, layer, is_count_data=True),
Expand Down

0 comments on commit 118b426

Please sign in to comment.