Skip to content

Commit

Permalink
[Doc] Add Tensor.Shape (pytorch#104750)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#104750

Add `Tensor.Shape` doc.

Ref:

- pytorch#5544
- pytorch#1980

Differential Revision: D47278630

fbshipit-source-id: aa2466cba60b21860338e1ea6b8850f4395b6255
  • Loading branch information
isdanni authored and facebook-github-bot committed Jul 25, 2023
1 parent a4cffaa commit 990864e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/source/tensors.rst
Expand Up @@ -622,6 +622,7 @@ Tensor class reference
Tensor.asinh_
Tensor.arcsinh
Tensor.arcsinh_
Tensor.shape
Tensor.size
Tensor.slogdet
Tensor.slice_scatter
Expand Down
20 changes: 20 additions & 0 deletions torch/_tensor_docs.py
Expand Up @@ -4727,6 +4727,26 @@ def callable(a, b) -> number
""",
)

add_docstr_all(
"shape",
r"""
shape() -> torch.Size
Returns the size of the :attr:`self` tensor. Alias for :attr:`size`.
See also :meth:`Tensor.size`.
Example::
>>> t = torch.empty(3, 4, 5)
>>> t.size()
torch.Size([3, 4, 5])
>>> t.shape
torch.Size([3, 4, 5])
""",
)

add_docstr_all(
"sort",
r"""
Expand Down

0 comments on commit 990864e

Please sign in to comment.