mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Options to address the "undocumented python objects":
1. Reference the functions in the .rst via the `torch.functional` namespace. Note that this changes the generated doc filenames / locations for most of these functions!
2. Document these functions by referencing them from the `torch.` namespace instead, in line with common usage. This would also require setting the `__module__` for these functions and moving entries from `torch.functional`'s `__all__` -> `torch`'s `__all__`, which is BC-breaking.
3. Update the .rst files to also document the `torch.functional` forms of these functions, duplicating docs.
This PR takes option (3) above and:
* Removes all 20 `torch.functional` entries from the doc ignore list
* Removes `torch.functional.align_tensors()` entirely, since we don't want to document it.
* This is technically BC-breaking, although the previous impl simply errored out. This change could be moved to a separate isolated PR for safety.
* Introduces `torch.aliases.md` as a hidden page for the `torch.functional` aliases to the `torch` analogue functions
Pull Request resolved: https://github.com/pytorch/pytorch/pull/158581
Approved by: https://github.com/janeyx99
732 B
732 B
Aliases in torch
The following are aliases in torch to their counterparts in the nested namespaces
in which they are defined. Feel free to use either the top-level version in torch
(e.g. torch.broadcast_tensors()) or the nested version torch.functional.broadcast_tensors().
.. automodule:: torch.functional
.. currentmodule:: torch.functional
.. autosummary::
:toctree: generated
:nosignatures:
align_tensors
atleast_1d
atleast_2d
atleast_3d
block_diag
broadcast_shapes
broadcast_tensors
cartesian_prod
cdist
chain_matmul
einsum
lu
meshgrid
norm
split
stft
tensordot
unique
unique_consecutive
unravel_index