mirror of
https://github.com/pytorch/pytorch.git
synced 2025-11-06 00:54:56 +08:00
Add size/dimensionality documentation for torch.gather. (#1645)
This commit is contained in:
committed by
Soumith Chintala
parent
e1d257bc6d
commit
9a497f824b
@ -1401,6 +1401,12 @@ For a 3-D tensor the output is specified by::
|
||||
out[i][j][k] = input[i][index[i][j][k]][k] # dim=1
|
||||
out[i][j][k] = input[i][j][index[i][j][k]] # dim=2
|
||||
|
||||
If :attr:`input` is an n-dimensional tensor with size
|
||||
:math:`(x_0, x_1..., x_{i-1}, x_i, x_{i+1}, ..., x_{n-1})`
|
||||
and :attr:`dim` = i, then :attr:`index` must be an n-dimensional tensor with size
|
||||
:math:`(x_0, x_1, ..., x_{i-1}, y, x_{i+1}, ..., x_{n-1})` where y >= 1 and
|
||||
:attr:`out` will have the same size as :attr:`index`.
|
||||
|
||||
Args:
|
||||
input (Tensor): The source tensor
|
||||
dim (int): The axis along which to index
|
||||
|
||||
Reference in New Issue
Block a user