Skip to content

Commit 9a497f8

Browse files
gchanansoumith
authored andcommitted
Add size/dimensionality documentation for torch.gather. (pytorch#1645)
1 parent e1d257b commit 9a497f8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

torch/_torch_docs.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,6 +1401,12 @@
14011401
out[i][j][k] = input[i][index[i][j][k]][k] # dim=1
14021402
out[i][j][k] = input[i][j][index[i][j][k]] # dim=2
14031403
1404+
If :attr:`input` is an n-dimensional tensor with size
1405+
:math:`(x_0, x_1..., x_{i-1}, x_i, x_{i+1}, ..., x_{n-1})`
1406+
and :attr:`dim` = i, then :attr:`index` must be an n-dimensional tensor with size
1407+
:math:`(x_0, x_1, ..., x_{i-1}, y, x_{i+1}, ..., x_{n-1})` where y >= 1 and
1408+
:attr:`out` will have the same size as :attr:`index`.
1409+
14041410
Args:
14051411
input (Tensor): The source tensor
14061412
dim (int): The axis along which to index

0 commit comments

Comments
 (0)