How to use the tensor index in CPP?
In pytorch, we can in this way.
import torch

data = torch.tensor([1, 2, 3, 4, 5, 6])

index = torch.tensor([0, 2, 4])

result = data[index] 

We can get result’s value
>>> tensor([1, 3, 5])

But how to use in cpp?
torch::Tensor data;  // just a demo  

torch::Tensor index;  // just a demo

torch::Tensor result = data[index];  // IndexError: Can only index with tensors that are scalars(zero-dim)

please help me, thanks a lot.