I currently am updating values in a Pytorch tensor using multiple OR conditions:
>>> import torch
>>> my_tensor = torch.tensor([0, 1, 2, 3, 4, 5])
>>> condition = ((my_tensor==1) | (my_tensor==4) | (my_tensor==5))
>>> my_tensor[condition] = 0
>>> my_tensor
[0, 0, 2, 3, 0, 0]
My list of conditions is much longer than the toy example above. Can the condition operator match a list? If not, what is the best solution?