Is it possible to combine basic and advanced indexing in PyTorch? I have a 3x128x128x128 array which basically stores a 3D vector at each voxel in a 128x128x128 array of voxels. I want to get the vectors stored at a selected few of those voxels.

I use the following code to get those vectors:

*offset_vectors = my_array[:,voxel_indices]*

Here, “voxel_indices” is a tuple of 3 tensors representing the indices of the voxels of interest along the three dimensions (The tuple of tensors is in the same format as returned by PyTorch’s *nonzero* method call with as_tuple=True).

But, the above call gives me the following error message:

*ValueError: only one element tensors can be converted to Python scalars*

Am I doing something wrong or Pytorch doesn’t allow combining basic and advanced indexing as done above? Numpy does allow such combination (https://numpy.org/doc/stable/reference/arrays.indexing.html).

Thanks!