mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
DOC: Convert to markdown: torch.overrides.rst, type_info.rst, utils.rst, xpu.rst (#155088)
Fixes #155041 Pull Request resolved: https://github.com/pytorch/pytorch/pull/155088 Approved by: https://github.com/svekars Co-authored-by: Svetlana Karslioglu <svekars@meta.com>
This commit is contained in:
committed by
PyTorch MergeBot
parent
067fd0b3ab
commit
4f5b34427b
@ -1,30 +1,49 @@
|
||||
```{eval-rst}
|
||||
.. currentmodule:: torch.overrides
|
||||
```
|
||||
|
||||
torch.overrides
|
||||
---------------
|
||||
# torch.overrides
|
||||
```{eval-rst}
|
||||
.. py:module:: torch.overrides
|
||||
```
|
||||
|
||||
This module exposes various helper functions for the ``__torch_function__``
|
||||
protocol. See :ref:`extending-torch-python` for more details on the
|
||||
protocol. See {ref}`extending-torch-python` for more details on the
|
||||
``__torch_function__`` protocol.
|
||||
|
||||
Functions
|
||||
~~~~~~~~~
|
||||
|
||||
## Functions
|
||||
```{eval-rst}
|
||||
.. autofunction:: get_ignored_functions
|
||||
```
|
||||
|
||||
```{eval-rst}
|
||||
.. autofunction:: get_overridable_functions
|
||||
```
|
||||
|
||||
```{eval-rst}
|
||||
.. autofunction:: resolve_name
|
||||
```
|
||||
|
||||
```{eval-rst}
|
||||
.. autofunction:: get_testing_overrides
|
||||
```
|
||||
|
||||
```{eval-rst}
|
||||
.. autofunction:: handle_torch_function
|
||||
```
|
||||
|
||||
```{eval-rst}
|
||||
.. autofunction:: has_torch_function
|
||||
```
|
||||
|
||||
```{eval-rst}
|
||||
.. autofunction:: is_tensor_like
|
||||
```
|
||||
|
||||
```{eval-rst}
|
||||
.. autofunction:: is_tensor_method_or_property
|
||||
```
|
||||
|
||||
```{eval-rst}
|
||||
.. autofunction:: wrap_torch_function
|
||||
```
|
61
docs/source/type_info.md
Normal file
61
docs/source/type_info.md
Normal file
@ -0,0 +1,61 @@
|
||||
```{eval-rst}
|
||||
.. currentmodule:: torch
|
||||
```
|
||||
|
||||
(type-info-doc)=
|
||||
# Type Info
|
||||
|
||||
The numerical properties of a {class}`torch.dtype` can be accessed through either the {class}`torch.finfo` or the {class}`torch.iinfo`.
|
||||
|
||||
(finfo-doc)=
|
||||
## torch.finfo
|
||||
|
||||
```{eval-rst}
|
||||
.. class:: torch.finfo
|
||||
```
|
||||
|
||||
A {class}`torch.finfo` is an object that represents the numerical properties of a floating point
|
||||
{class}`torch.dtype`, (i.e. ``torch.float32``, ``torch.float64``, ``torch.float16``, and ``torch.bfloat16``).
|
||||
This is similar to [numpy.finfo](https://numpy.org/doc/stable/reference/generated/numpy.finfo.html).
|
||||
|
||||
A {class}`torch.finfo` provides the following attributes:
|
||||
|
||||
| Name | Type | Description |
|
||||
| :-------------- | :---- | :------------------------------------------------------------------------- |
|
||||
| bits | int | The number of bits occupied by the type. |
|
||||
| eps | float | The smallest representable number such that ``1.0 + eps != 1.0``. |
|
||||
| max | float | The largest representable number. |
|
||||
| min | float | The smallest representable number (typically ``-max``). |
|
||||
| tiny | float | The smallest positive normal number. Equivalent to ``smallest_normal``. |
|
||||
| smallest_normal | float | The smallest positive normal number. See notes. |
|
||||
| resolution | float | The approximate decimal resolution of this type, i.e., ``10**-precision``. |
|
||||
|
||||
```{note}
|
||||
The constructor of {class}`torch.finfo` can be called without argument,
|
||||
in which case the class is created for the pytorch default dtype (as returned by {func}`torch.get_default_dtype`).
|
||||
```
|
||||
|
||||
```{note}
|
||||
`smallest_normal` returns the smallest *normal* number, but there are smaller
|
||||
subnormal numbers. See https://en.wikipedia.org/wiki/Denormal_number
|
||||
for more information.
|
||||
```
|
||||
|
||||
(iinfo-doc)=
|
||||
## torch.iinfo
|
||||
|
||||
```{eval-rst}
|
||||
.. class:: torch.iinfo
|
||||
```
|
||||
|
||||
A {class}`torch.iinfo` is an object that represents the numerical properties of a integer
|
||||
{class}`torch.dtype` (i.e. ``torch.uint8``, ``torch.int8``, ``torch.int16``, ``torch.int32``, and ``torch.int64``).
|
||||
This is similar to [numpy.iinfo](https://numpy.org/doc/stable/reference/generated/numpy.iinfo.html).
|
||||
|
||||
A {class}`torch.iinfo` provides the following attributes:
|
||||
|
||||
| Name | Type | Description |
|
||||
| :--- | :--- | :--------------------------------------- |
|
||||
| bits | int | The number of bits occupied by the type. |
|
||||
| max | int | The largest representable number. |
|
||||
| min | int | The smallest representable number. |
|
@ -1,62 +0,0 @@
|
||||
.. currentmodule:: torch
|
||||
|
||||
.. _type-info-doc:
|
||||
|
||||
Type Info
|
||||
=========
|
||||
|
||||
The numerical properties of a :class:`torch.dtype` can be accessed through either the :class:`torch.finfo` or the :class:`torch.iinfo`.
|
||||
|
||||
.. _finfo-doc:
|
||||
|
||||
torch.finfo
|
||||
-----------
|
||||
|
||||
.. class:: torch.finfo
|
||||
|
||||
A :class:`torch.finfo` is an object that represents the numerical properties of a floating point
|
||||
:class:`torch.dtype`, (i.e. ``torch.float32``, ``torch.float64``, ``torch.float16``, and ``torch.bfloat16``). This is similar to `numpy.finfo <https://numpy.org/doc/stable/reference/generated/numpy.finfo.html>`_.
|
||||
|
||||
A :class:`torch.finfo` provides the following attributes:
|
||||
|
||||
=============== ===== ==========================================================================
|
||||
Name Type Description
|
||||
=============== ===== ==========================================================================
|
||||
bits int The number of bits occupied by the type.
|
||||
eps float The smallest representable number such that ``1.0 + eps != 1.0``.
|
||||
max float The largest representable number.
|
||||
min float The smallest representable number (typically ``-max``).
|
||||
tiny float The smallest positive normal number. Equivalent to ``smallest_normal``.
|
||||
smallest_normal float The smallest positive normal number. See notes.
|
||||
resolution float The approximate decimal resolution of this type, i.e., ``10**-precision``.
|
||||
=============== ===== ==========================================================================
|
||||
|
||||
.. note::
|
||||
The constructor of :class:`torch.finfo` can be called without argument, in which case the class is created for the pytorch default dtype (as returned by :func:`torch.get_default_dtype`).
|
||||
|
||||
.. note::
|
||||
`smallest_normal` returns the smallest *normal* number, but there are smaller
|
||||
subnormal numbers. See https://en.wikipedia.org/wiki/Denormal_number
|
||||
for more information.
|
||||
|
||||
|
||||
.. _iinfo-doc:
|
||||
|
||||
torch.iinfo
|
||||
------------
|
||||
|
||||
.. class:: torch.iinfo
|
||||
|
||||
|
||||
A :class:`torch.iinfo` is an object that represents the numerical properties of a integer
|
||||
:class:`torch.dtype` (i.e. ``torch.uint8``, ``torch.int8``, ``torch.int16``, ``torch.int32``, and ``torch.int64``). This is similar to `numpy.iinfo <https://numpy.org/doc/stable/reference/generated/numpy.iinfo.html>`_.
|
||||
|
||||
A :class:`torch.iinfo` provides the following attributes:
|
||||
|
||||
========= ===== ========================================
|
||||
Name Type Description
|
||||
========= ===== ========================================
|
||||
bits int The number of bits occupied by the type.
|
||||
max int The largest representable number.
|
||||
min int The smallest representable number.
|
||||
========= ===== ========================================
|
@ -1,8 +1,13 @@
|
||||
torch.utils
|
||||
===================================
|
||||
# torch.utils
|
||||
```{eval-rst}
|
||||
.. automodule:: torch.utils
|
||||
.. currentmodule:: torch.utils
|
||||
```
|
||||
|
||||
```{eval-rst}
|
||||
.. currentmodule:: torch.utils
|
||||
```
|
||||
|
||||
```{eval-rst}
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
@ -12,9 +17,11 @@ torch.utils
|
||||
get_cpp_backtrace
|
||||
set_module
|
||||
swap_tensors
|
||||
```
|
||||
|
||||
.. This module needs to be documented. Adding here in the meantime
|
||||
.. for tracking purposes
|
||||
<!-- This module needs to be documented. Adding here in the meantime
|
||||
for tracking purposes -->
|
||||
```{eval-rst}
|
||||
.. py:module:: torch.utils.backend_registration
|
||||
.. py:module:: torch.utils.benchmark.examples.compare
|
||||
.. py:module:: torch.utils.benchmark.examples.fuzzer
|
||||
@ -87,3 +94,4 @@ torch.utils
|
||||
.. py:module:: torch.utils.tensorboard.writer
|
||||
.. py:module:: torch.utils.throughput_benchmark
|
||||
.. py:module:: torch.utils.weak
|
||||
```
|
@ -1,8 +1,12 @@
|
||||
torch.xpu
|
||||
===================================
|
||||
# torch.xpu
|
||||
```{eval-rst}
|
||||
.. automodule:: torch.xpu
|
||||
```
|
||||
```{eval-rst}
|
||||
.. currentmodule:: torch.xpu
|
||||
```
|
||||
|
||||
```{eval-rst}
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
@ -26,9 +30,10 @@ torch.xpu
|
||||
set_stream
|
||||
stream
|
||||
synchronize
|
||||
```
|
||||
|
||||
Random Number Generator
|
||||
-------------------------
|
||||
## Random Number Generator
|
||||
```{eval-rst}
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
@ -42,21 +47,27 @@ Random Number Generator
|
||||
seed_all
|
||||
set_rng_state
|
||||
set_rng_state_all
|
||||
```
|
||||
|
||||
Streams and events
|
||||
------------------
|
||||
## Streams and events
|
||||
```{eval-rst}
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
|
||||
Event
|
||||
Stream
|
||||
```
|
||||
|
||||
```{eval-rst}
|
||||
.. automodule:: torch.xpu.memory
|
||||
```
|
||||
```{eval-rst}
|
||||
.. currentmodule:: torch.xpu.memory
|
||||
```
|
||||
|
||||
Memory management
|
||||
-----------------
|
||||
## Memory management
|
||||
```{eval-rst}
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
:nosignatures:
|
||||
@ -71,9 +82,11 @@ Memory management
|
||||
memory_stats_as_nested_dict
|
||||
reset_accumulated_memory_stats
|
||||
reset_peak_memory_stats
|
||||
```
|
||||
|
||||
|
||||
.. This module needs to be documented. Adding here in the meantime
|
||||
.. for tracking purposes
|
||||
<!-- This module needs to be documented. Adding here in the meantime
|
||||
for tracking purposes -->
|
||||
```{eval-rst}
|
||||
.. py:module:: torch.xpu.random
|
||||
.. py:module:: torch.xpu.streams
|
||||
```
|
Reference in New Issue
Block a user