torch.where — PyTorch 1.10.1 documentation
pytorch.org › docs › stabletorch.where. Return a tensor of elements selected from either x or y, depending on condition. The operation is defined as: The tensors condition, x, y must be broadcastable. Currently valid scalar and tensor combination are 1. Scalar of floating dtype and torch.double 2. Scalar of integral dtype and torch.long 3.
[feature request] add `torch.find` to find the indices of ...
github.com › pytorch › pytorchJul 12, 2018 · This operator outputs a long tensor of the same shape as the argument tensor, where the result [i,j,..] is the first index at vector from_ whose value is the same as tensor [i,j,..]. For example: a = torch. tensor ( [ 0, 10, 20, 30 ]) b = torch. tensor ( [ [ 0, 30, 5 ], [ 20, 1, 0 ]]) torch. find ( b, a) should give.
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 dimensions have the same size as in the original tensor.