## Numpy intersect1d with array with matrix as elements

Question

I have two arrays, one of the shape `(200000, 28, 28)`

and the other of the shape `(10000, 28, 28)`

, so practically two arrays with matrices as elements.
Now I want to count and get all the elements (in the form `(N, 28, 28)`

), that overlap in both arrays. With normal for loops it is way to slow, so I tryied it with numpys intersect1d method, but I dont know how to apply it on this types of arrays.

Show source

## Answers to Numpy intersect1d with array with matrix as elements ( 1 )

Using the approach from this question about unique rows

Note that using

`void`

is unsafe with floats, as it will cause`-0`

to be unequal to`0`