Copies the elements of tensor
into the self
tensor by selecting the indices in the order given in index
. For example, if dim == 0
and index[i] == j
, then the i
th row of tensor
is copied to the j
th row of self
.
The dim
th dimension of tensor
must have the same size as the length of index
(which must be a vector), and all other dimensions must match self
, or an error will be raised.
>>> x = torch.zeros(5, 3) >>> t = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=torch.float) >>> index = torch.tensor([0, 4, 2]) >>> x.index_copy_(0, index, t) tensor([[ 1., 2., 3.], [ 0., 0., 0.], [ 7., 8., 9.], [ 0., 0., 0.], [ 4., 5., 6.]])
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4