If I use numpy then I won’t be able to run my code on GPU. That’s what I meant. Also intersect1d is not exactly what I want. In case of multiple matches of an element, I want all of them to be returned and not just one of them.