PyTorch tensor advanced indexing - Stack Overflow
https://stackoverflow.com › pytorc...You can specify the corresponding row index as: import torch x = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) y = torch.tensor([0, 2, ...
torch.index_select — PyTorch 1.10.1 documentation
pytorch.org › docs › stabletorch.index_select(input, dim, index, *, out=None) → Tensor. Returns a new tensor which indexes the input tensor along dimension dim using the entries in index which is a LongTensor. The returned tensor has the same number of dimensions as the original tensor ( input ). The dim th dimension has the same size as the length of index; other ...
torch.Tensor.index_fill_ — PyTorch 1.10.1 documentation
pytorch.org › torchTensor.index_fill_(dim, index, value) → Tensor. Fills the elements of the self tensor with value value by selecting the indices in the order given in index. Parameters. dim ( int) – dimension along which to index. index ( LongTensor) – indices of self tensor to fill in. value ( float) – the value to fill with. Example::