Skip to content

Commit 1344568

Browse files
committed
Use intersphinx instead of links to other docs' URLs
1 parent 3585a8a commit 1344568

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

Diff for: array_api_compat/common/_helpers.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -448,13 +448,11 @@ def to_device(x: Array, device: Device, /, *, stream: Optional[Union[int, Any]]
448448
-----
449449
450450
For NumPy, this function effectively does nothing since the only supported
451-
device is the CPU. For CuPy, this method supports CuPy CUDA `Device
452-
<https://docs.cupy.dev/en/stable/reference/generated/cupy.cuda.Device.html>`_
453-
and `Stream
454-
<https://docs.cupy.dev/en/stable/reference/generated/cupy.cuda.Stream.html>`_
455-
objects. For PyTorch, this is the same as `x.to(device)
456-
<https://pytorch.org/docs/stable/generated/torch.Tensor.to.html>`_ (the
457-
``stream`` argument is not supported in PyTorch).
451+
device is the CPU. For CuPy, this method supports CuPy CUDA
452+
:external+cupy:class:`Device <cupy.cuda.Device>` and
453+
:external+cupy:class:`Stream <cupy.cuda.Stream>` objects. For PyTorch,
454+
this is the same as :external+torch:meth:`x.to(device) <torch.Tensor.to>`
455+
(the ``stream`` argument is not supported in PyTorch).
458456
459457
See Also
460458
--------
@@ -492,8 +490,8 @@ def size(x):
492490
493491
This is equivalent to `x.size` according to the `standard
494492
<https://data-apis.org/array-api/latest/API_specification/generated/array_api.array.size.html>`__.
495-
This helper is included because PyTorch defines `size` in an `incompatible
496-
way <https://pytorch.org/docs/stable/generated/torch.Tensor.size.html>`__.
493+
This helper is included because PyTorch defines `size` in an
494+
:external+torch:meth:`incompatible way <torch.Tensor.size>`.
497495
498496
"""
499497
if None in x.shape:

Diff for: docs/conf.py

+8
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,17 @@
2424
'myst_parser',
2525
'sphinx.ext.autodoc',
2626
'sphinx.ext.napoleon',
27+
'sphinx.ext.intersphinx',
2728
'sphinx_copybutton',
2829
]
2930

31+
intersphinx_mapping = {
32+
'cupy': ('https://docs.cupy.dev/en/stable', None),
33+
'torch': ('https://pytorch.org/docs/stable/', None),
34+
}
35+
# Require :external: to reference intersphinx.
36+
intersphinx_disabled_reftypes = ['*']
37+
3038
templates_path = ['_templates']
3139
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
3240

0 commit comments

Comments
 (0)