Solved by iacob in post #3 
              
              
                You can achieve this with a for loop: 
>>> sum(a==i for i in vals).bool()
tensor([[ True,  True, False],
        [ True,  True, False]])