I have 2 Tensors named x and list and their definitions are below:
x = torch.tensor(3)
list = torch.tensor([1,2,3,4,5])
Now I want to get the index of element x from list . The expected output is an Integer:
2
How can I do in an easy way?
I have 2 Tensors named x and list and their definitions are below:
x = torch.tensor(3)
list = torch.tensor([1,2,3,4,5])
Now I want to get the index of element x from list . The expected output is an Integer:
2
How can I do in an easy way?
Thanks for your help, your answer works!