Solved by russellizadi in post #2 
              
              
                The ~ operator negate the bool tensor: 
import torch
a = torch.tensor([1, 2])
b = torch.tensor([1, 0])
print(a.eq(b))
print(~a.eq(b))

tensor([ True, False])
tensor([False,  True])