Skip to content

Commit

Permalink
fix torch import
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep committed Oct 22, 2024
1 parent 17cfd6b commit a0c7083
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@
# Generate the API documentation when building
autosummary_generate = True
autodoc_member_order = "bysource"
autodoc_mock_imports = ["torch"]
# autodoc_default_flags = ['members']
issues_github_path = "scverse/anndata"
rtd_links_prefix = PurePosixPath("src")
# autodoc_default_flags = ['members']
napoleon_google_docstring = False
napoleon_numpy_docstring = True
napoleon_include_init_with_doc = False
Expand Down
5 changes: 3 additions & 2 deletions src/anndata/experimental/pytorch/_annloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@

if TYPE_CHECKING:
from collections.abc import Callable, Generator, Sequence
from typing import TypeAlias
from typing import TypeAlias, Union

from scipy.sparse import spmatrix

Array: TypeAlias = torch.Tensor | np.ndarray | spmatrix
# need to use Union because of autodoc_mock_imports
Array: TypeAlias = Union[torch.Tensor, np.ndarray, spmatrix] # noqa: UP007


# Custom sampler to get proper batches instead of joined separate indices
Expand Down

0 comments on commit a0c7083

Please sign in to comment.