Writing custom array containers
Numpy’s dispatch mechanism, introduced in numpy version v1.16 is the recommended approach for writing custom N-dimensional array containers that are compatible with the numpy API and provide custom implementations of numpy functionality. Applications include dask arrays, an N-dimensional array distributed across multiple nodes, and cupy arrays, an N-dimensional array on a GPU.
For comprehensive documentation on writing custom array containers, please see:
Interoperability with NumPy - the main guide covering
__array_ufunc__and__array_function__protocolsSpecial attributes and methods - see
class.__array__()for documentation and example implementing the method