Is there an efficient way of removing occurences of items in a LongTensor
For example
#input
x = torch.LongTensor([0,2,3,1,4,2,7,1,8])
#output
x = torch.LongTensor([0,3,4,7,8])
In the example above I want to remove 2 and 1 from the tensor. Is there any method in pytorch for this? or any efficient way?