Skip to content

Commit

Permalink
[Doc] Add Tensor.Shape
Browse files Browse the repository at this point in the history
Summary:
Add `Tensor.Shape` doc.

Ref:

- pytorch#5544
- pytorch#1980

Differential Revision: D47278630

fbshipit-source-id: 823ee4776a8ef1086c3b37c3d1af3b5bb9355a1c
  • Loading branch information
isdanni authored and facebook-github-bot committed Jul 6, 2023
1 parent d64bada commit 016bee2
Show file tree
Hide file tree
Showing 2 changed files with 20 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
19 changes: 19 additions & 0 deletions torch/_tensor_docs.py
Expand Up @@ -4720,6 +4720,25 @@ def callable(a, b) -> number
""",
)

add_docstr_all(
"shape",
r"""
shape() -> torch.Size
Returns the size of the :attr:`self` tensor. Tensor :attr:`shape` is the alias for :attr:`size`.
It was added for consistency with NumPy.
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 016bee2

Please sign in to comment.