Python Array API Support#
The Python array API standard aims to provide a coherent set of APIs for array and tensor libraries developed by the community to build upon. This solves the API fragmentation issue across the community by offering concrete function signatures, semantics and scopes of coverage, enabling writing backend-agnostic codes for better portability.
CuPy provides experimental support based on NumPy’s NEP-47,
which is in turn based on the v2021 standard. All of the functionalities can be accessed
NumPy’s Array API Standard Compatibility is an excellent starting
point to understand better the differences between the APIs under the main namespace and the
Keep in mind, however, that the key difference between NumPy and CuPy is that we are a GPU-only library, therefore CuPy users should be aware
of potential device management issues.
Same as in regular CuPy codes, the GPU-to-use can be specified via the
Device objects, see
Device management. GPU-related semantics (e.g. streams, asynchronicity, etc) are also respected.
Finally, remember there are already differences between NumPy and CuPy,
although some of which are rectified in the standard.