How to select index over two dimension? - PyTorch Forums
discuss.pytorch.org › t › how-to-select-index-overNov 18, 2017 · Given a = torch.randn(3, 2, 4, 5), how I can select sub tensor like (2, :, 0, :), (1, :, 1, :), (2, :, 2, :), (0, :, 3, :) (a resulting tensor of size (2, 4, 5) or (4 ...
Pytorch - Index-based Operation - GeeksforGeeks
https://www.geeksforgeeks.org › p...te = torch.tensor([[ 1 , 3 , 5 , 7 , 9 ],[ 1 , 3 , 5 , 7 , 9 ],[ 1 ... It is of 'int' format. index: indices of the tensor to select from.
torch.Tensor.select — PyTorch 1.10.1 documentation
pytorch.org › generated › torchtorch.Tensor.select. Slices the self tensor along the selected dimension at the given index. This function returns a view of the original tensor with the given dimension removed. select () is equivalent to slicing. For example, tensor.select (0, index) is equivalent to tensor [index] and tensor.select (2, index) is equivalent to tensor [:,:,index].