Is there any method that can easily used to index a one dimensional tensor with a tensor.

For example:

x=torch.range(0,24)

y = torch.Tensor([[1,2],[3,4])

I want to get something like x[y] = [[1,2],[3,4]]

But pytorch tensor do not accept different index matrix shape.