X can be a Tensor
or a Variable
. batch_indices
is a LongTensor
X = torch.randn(10)
batch_indices = torch.LongTensor([0, 1, 2])
X[batch_indices]
Variable(X)[batch_indices]
X can be a Tensor
or a Variable
. batch_indices
is a LongTensor
X = torch.randn(10)
batch_indices = torch.LongTensor([0, 1, 2])
X[batch_indices]
Variable(X)[batch_indices]