I am trying to write a custom array container following numpy's guide and I can't understand why the following code always returns NotImplemented.
import numpy as np
a = np.array([1])
shape = (2, 2)
a.__array_function__(func=np.broadcast_to, types=(np.ndarray, type(shape)), args=(a, shape), kwargs={})
Out[5]: NotImplemented
Even though the normal method obviously works
np.broadcast_to(a, shape)
Out[6]:
array([[1, 1],
[1, 1]])
The function np.broacast_to is just an example, np.reshape has the same issue.
Does anyone know what my mistake is?