how to get the index of the subarray in pytorch?
a and b are torch tensor No repeating elements
a shape is [n,2] like:

[[1,2]
[2,3]
[4,6]
...]


b is[m,2] like:

[[1,2]
[4,6]
....
]


how to get the index of b in a, example:

a = [[1,2]
[2,4]
[6,7]
]
b = [[1,2]
[6,7]]


the index should be (0,3), we can use gpu， 

Here @jpp 's, numpy solution is almost your answer after this  

You just need to get indices using nonzero and flatten tensor using flatten to get expected shape.

a = torch.tensor([[1, 2], [2, 4], [6, 7]])
b = torch.tensor([[1, 2], [6, 7]])


(a[:, None] == b).all(-1).any(-1).nonzero().flatten()
tensor([0, 2])

