I have a 4-dimensional tensor and I want to select all the elements from that tensor except for one row along a dimension. How can I do that?
Here is the code snippet I have
features = Variable(torch.rand(2, 128, 19, 128))
selected = features[:, :, ~2, :] # I want to select all rows except the 2nd row along 3rd dimension.