I have a simple example that is not working. I want to extract a tensor from tr_input using the indices from tr_ind.
    print(np.shape(tr_ind))
    print(np.shape(tr_input))
    
    tr_input1 = tr_input[tr_ind]


torch.Size([150])
torch.Size([1515, 200, 28])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-28-5b55de0850db> in <module>()
      6     print(np.shape(tr_input))
      7 
----> 8     tr_input1 = tr_input[tr_ind,:,:]
      9     #tr_target1 = tr_target[tr_ind]
     10     #val_input = tr_input[val_ind]

~\Anaconda3\envs\dl\lib\site-packages\torch\autograd\variable.py in __getitem__(self, key)
     76                 return IndexSelect.apply(self, 0, key)
     77             # else fall through and raise an error in Index
---> 78         return Index.apply(self, key)
     79 
     80     def __setitem__(self, key, value):

~\Anaconda3\envs\dl\lib\site-packages\torch\autograd\_functions\tensor.py in forward(ctx, i, index)
     87             result = i.index(ctx.index)
     88         else:
---> 89             result = i.index(ctx.index)
     90             ctx.mark_shared_storage((i, result))
     91         return result

TypeError: Performing basic indexing on a tensor and encountered an error indexing dim 0 with an object of type torch.IntTensor. The only supported types are integers, slices, numpy scalars, or if indexing with a torch.LongTensor or torch.ByteTensor only a single Tensor may be passed.