[Doc] Add Tensor.Shape (#104750)

Summary:
Add `Tensor.Shape` doc.

Fix: #104038

Ref:

- https://github.com/pytorch/pytorch/issues/5544
- https://github.com/pytorch/pytorch/issues/1980

Differential Revision: D47278630

CC: @svekars @carljparker

Pull Request resolved: https://github.com/pytorch/pytorch/pull/104750
Approved by: https://github.com/mikaylagawarecki
This commit is contained in:
Danni Li
2023-07-26 16:30:15 +00:00
committed by PyTorch MergeBot
parent 28a4fc8d8a
commit c0c208516b
2 changed files with 21 additions and 0 deletions

View File

@ -4727,6 +4727,26 @@ Example::
""",
)
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"""