Say I have a tensor A and a container of values vals. Is there a clean way of returning a Boolean tensor of the same shape as A with each element being whether that element of A is contained within vals? e.g:
A = torch.tensor([[1,2,3],
[4,5,6]])
vals = [1,5]
# Desired output
torch.tensor([[True,False,False],
[False,True,False]])