Skip to content

asmeurer/array-api-compat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Array API compatibility library

This is a small wrapper around NumPy that is compatible with the Array API standard. See also NEP 47.

Unlike numpy.array_api, this is not a strict minimal implementation of the Array API, but rather just an extension of the main NumPy namespace with changes needed to be compliant with the Array API. See https://numpy.org/doc/stable/reference/array_api.html for a full list of changes. In particular, unlike numpy.array_api, this package does not use a separate Array object, but rather just uses numpy.ndarray directly.

Note that some of the functionality in this library is backwards incompatible with NumPy.

This library also supports CuPy in addition to NumPy.

Library authors using the Array API may wish to test against numpy.array_api to ensure they are not using functionality outside of the standard, but prefer this implementation for end users who use NumPy arrays.

Usage

To use this library replace

import numpy as np

with

import array_api_compat.numpy as np

and replace

import cupy as cp

with

import array_api_compat.cupy as cp

About

Compatibility layer for NumPy to support the Array API

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 98.6%
  • Shell 1.4%