Hi guys,
I have some problems finding the fastest way to obtain the following:
I have a Tensor of indices: like for example
tensor1 = [2,3,4,5,6,7,8]
And I also have a list of indices (or array, or tensor whatever is the easiest for later), like for example:
tensor2 = [3,4,5]
Now what I want to get is a tensor with the same shape as tensor1 with booleans such that each element is True when its in tensor2 and False otherwise. So with the above mentioned example, I would want a tensor like this:
result = [False, True, True, True, False, False, False]
Is there a one-liner in pytorch that can reproduce this functionality? Would be really glad if someone could help me.
Best regards
Marco