[primTorch] Improve narrow and narrow_copy: refs, tests, docs (#87045)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/87045
Approved by: https://github.com/mruberry
This commit is contained in:
Nikita Karetnikov
2022-11-12 00:41:57 +01:00
committed by PyTorch MergeBot
parent 6e5f736d86
commit 4270bb37da
6 changed files with 188 additions and 67 deletions

View File

@ -3436,18 +3436,7 @@ add_docstr_all(
r"""
narrow(dimension, start, length) -> Tensor
See :func:`torch.narrow`
Example::
>>> x = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
>>> x.narrow(0, 0, 2)
tensor([[ 1, 2, 3],
[ 4, 5, 6]])
>>> x.narrow(1, 1, 2)
tensor([[ 2, 3],
[ 5, 6],
[ 8, 9]])
See :func:`torch.narrow`.
""",
)