Array API Functions#
Note
cupy.array_api
will be removed in CuPy v14 because its NumPy counterpart numpy.array_api
has been removed.
The root module cupy.*
is now compatible with the Array API specification as it mirrors the NumPy v2 API.
Use the Array API compatibility library to develop applications compatible with various array libraries, including CuPy, NumPy, and PyTorch.
This section is a full list of implemented APIs. For the detailed documentation, see the array API specification.
- cupy.array_api.abs(x, /)[source]#
Array API compatible wrapper for
np.abs
.See its docstring for more information.
- Return type:
- cupy.array_api.acos(x, /)[source]#
Array API compatible wrapper for
np.arccos
.See its docstring for more information.
- Return type:
- cupy.array_api.acosh(x, /)[source]#
Array API compatible wrapper for
np.arccosh
.See its docstring for more information.
- Return type:
- cupy.array_api.add(x1, x2, /)[source]#
Array API compatible wrapper for
np.add
.See its docstring for more information.
- Return type:
- cupy.array_api.all(x, /, *, axis=None, keepdims=False)[source]#
Array API compatible wrapper for
np.all
.See its docstring for more information.
- Return type:
- cupy.array_api.any(x, /, *, axis=None, keepdims=False)[source]#
Array API compatible wrapper for
np.any
.See its docstring for more information.
- Return type:
- cupy.array_api.arange(start, /, stop=None, step=1, *, dtype=None, device=None)[source]#
Array API compatible wrapper for
np.arange
.See its docstring for more information.
- Return type:
- cupy.array_api.argmax(x, /, *, axis=None, keepdims=False)[source]#
Array API compatible wrapper for
np.argmax
.See its docstring for more information.
- Return type:
- cupy.array_api.argmin(x, /, *, axis=None, keepdims=False)[source]#
Array API compatible wrapper for
np.argmin
.See its docstring for more information.
- Return type:
- cupy.array_api.argsort(x, /, *, axis=-1, descending=False, stable=True)[source]#
Array API compatible wrapper for
np.argsort
.See its docstring for more information.
- Return type:
- cupy.array_api.asarray(obj, /, *, dtype=None, device=None, copy=None)[source]#
Array API compatible wrapper for
np.asarray
.See its docstring for more information.
- Return type:
- cupy.array_api.asin(x, /)[source]#
Array API compatible wrapper for
np.arcsin
.See its docstring for more information.
- Return type:
- cupy.array_api.asinh(x, /)[source]#
Array API compatible wrapper for
np.arcsinh
.See its docstring for more information.
- Return type:
- cupy.array_api.atan(x, /)[source]#
Array API compatible wrapper for
np.arctan
.See its docstring for more information.
- Return type:
- cupy.array_api.atan2(x1, x2, /)[source]#
Array API compatible wrapper for
np.arctan2
.See its docstring for more information.
- Return type:
- cupy.array_api.atanh(x, /)[source]#
Array API compatible wrapper for
np.arctanh
.See its docstring for more information.
- Return type:
- cupy.array_api.bitwise_and(x1, x2, /)[source]#
Array API compatible wrapper for
np.bitwise_and
.See its docstring for more information.
- Return type:
- cupy.array_api.bitwise_invert(x, /)[source]#
Array API compatible wrapper for
np.invert
.See its docstring for more information.
- Return type:
- cupy.array_api.bitwise_left_shift(x1, x2, /)[source]#
Array API compatible wrapper for
np.left_shift
.See its docstring for more information.
- Return type:
- cupy.array_api.bitwise_or(x1, x2, /)[source]#
Array API compatible wrapper for
np.bitwise_or
.See its docstring for more information.
- Return type:
- cupy.array_api.bitwise_right_shift(x1, x2, /)[source]#
Array API compatible wrapper for
np.right_shift
.See its docstring for more information.
- Return type:
- cupy.array_api.bitwise_xor(x1, x2, /)[source]#
Array API compatible wrapper for
np.bitwise_xor
.See its docstring for more information.
- Return type:
- cupy.array_api.broadcast_arrays(*arrays)[source]#
Array API compatible wrapper for
np.broadcast_arrays
.See its docstring for more information.
- cupy.array_api.broadcast_to(x, /, shape)[source]#
Array API compatible wrapper for
np.broadcast_to
.See its docstring for more information.
- Return type:
- cupy.array_api.can_cast(from_, to, /)[source]#
Array API compatible wrapper for
np.can_cast
.See its docstring for more information.
- Return type:
- cupy.array_api.ceil(x, /)[source]#
Array API compatible wrapper for
np.ceil
.See its docstring for more information.
- Return type:
- cupy.array_api.concat(arrays, /, *, axis=0)[source]#
Array API compatible wrapper for
np.concatenate
.See its docstring for more information.
- Return type:
- cupy.array_api.cos(x, /)[source]#
Array API compatible wrapper for
np.cos
.See its docstring for more information.
- Return type:
- cupy.array_api.cosh(x, /)[source]#
Array API compatible wrapper for
np.cosh
.See its docstring for more information.
- Return type:
- cupy.array_api.divide(x1, x2, /)[source]#
Array API compatible wrapper for
np.divide
.See its docstring for more information.
- Return type:
- cupy.array_api.empty(shape, *, dtype=None, device=None)[source]#
Array API compatible wrapper for
np.empty
.See its docstring for more information.
- Return type:
- cupy.array_api.empty_like(x, /, *, dtype=None, device=None)[source]#
Array API compatible wrapper for
np.empty_like
.See its docstring for more information.
- Return type:
- cupy.array_api.equal(x1, x2, /)[source]#
Array API compatible wrapper for
np.equal
.See its docstring for more information.
- Return type:
- cupy.array_api.exp(x, /)[source]#
Array API compatible wrapper for
np.exp
.See its docstring for more information.
- Return type:
- cupy.array_api.expand_dims(x, /, *, axis)[source]#
Array API compatible wrapper for
np.expand_dims
.See its docstring for more information.
- Return type:
- cupy.array_api.expm1(x, /)[source]#
Array API compatible wrapper for
np.expm1
.See its docstring for more information.
- Return type:
- cupy.array_api.eye(n_rows, n_cols=None, /, *, k=0, dtype=None, device=None)[source]#
Array API compatible wrapper for
np.eye
.See its docstring for more information.
- Return type:
- cupy.array_api.finfo(type, /)[source]#
Array API compatible wrapper for
np.finfo
.See its docstring for more information.
- Return type:
finfo_object
- cupy.array_api.flip(x, /, *, axis=None)[source]#
Array API compatible wrapper for
np.flip
.See its docstring for more information.
- Return type:
- cupy.array_api.floor(x, /)[source]#
Array API compatible wrapper for
np.floor
.See its docstring for more information.
- Return type:
- cupy.array_api.floor_divide(x1, x2, /)[source]#
Array API compatible wrapper for
np.floor_divide
.See its docstring for more information.
- Return type:
- cupy.array_api.from_dlpack(x, /)[source]#
Array API compatible wrapper for
np.from_dlpack
.See its docstring for more information.
- Return type:
- cupy.array_api.full(shape, fill_value, *, dtype=None, device=None)[source]#
Array API compatible wrapper for
np.full
.See its docstring for more information.
- Return type:
- cupy.array_api.full_like(x, /, fill_value, *, dtype=None, device=None)[source]#
Array API compatible wrapper for
np.full_like
.See its docstring for more information.
- Return type:
- cupy.array_api.greater(x1, x2, /)[source]#
Array API compatible wrapper for
np.greater
.See its docstring for more information.
- Return type:
- cupy.array_api.greater_equal(x1, x2, /)[source]#
Array API compatible wrapper for
np.greater_equal
.See its docstring for more information.
- Return type:
- cupy.array_api.iinfo(type, /)[source]#
Array API compatible wrapper for
np.iinfo
.See its docstring for more information.
- Return type:
iinfo_object
- cupy.array_api.isfinite(x, /)[source]#
Array API compatible wrapper for
np.isfinite
.See its docstring for more information.
- Return type:
- cupy.array_api.isinf(x, /)[source]#
Array API compatible wrapper for
np.isinf
.See its docstring for more information.
- Return type:
- cupy.array_api.isnan(x, /)[source]#
Array API compatible wrapper for
np.isnan
.See its docstring for more information.
- Return type:
- cupy.array_api.less(x1, x2, /)[source]#
Array API compatible wrapper for
np.less
.See its docstring for more information.
- Return type:
- cupy.array_api.less_equal(x1, x2, /)[source]#
Array API compatible wrapper for
np.less_equal
.See its docstring for more information.
- Return type:
- cupy.array_api.linspace(start, stop, /, num, *, dtype=None, device=None, endpoint=True)[source]#
Array API compatible wrapper for
np.linspace
.See its docstring for more information.
- Return type:
- cupy.array_api.log(x, /)[source]#
Array API compatible wrapper for
np.log
.See its docstring for more information.
- Return type:
- cupy.array_api.log10(x, /)[source]#
Array API compatible wrapper for
np.log10
.See its docstring for more information.
- Return type:
- cupy.array_api.log1p(x, /)[source]#
Array API compatible wrapper for
np.log1p
.See its docstring for more information.
- Return type:
- cupy.array_api.log2(x, /)[source]#
Array API compatible wrapper for
np.log2
.See its docstring for more information.
- Return type:
- cupy.array_api.logaddexp(x1, x2)[source]#
Array API compatible wrapper for
np.logaddexp
.See its docstring for more information.
- Return type:
- cupy.array_api.logical_and(x1, x2, /)[source]#
Array API compatible wrapper for
np.logical_and
.See its docstring for more information.
- Return type:
- cupy.array_api.logical_not(x, /)[source]#
Array API compatible wrapper for
np.logical_not
.See its docstring for more information.
- Return type:
- cupy.array_api.logical_or(x1, x2, /)[source]#
Array API compatible wrapper for
np.logical_or
.See its docstring for more information.
- Return type:
- cupy.array_api.logical_xor(x1, x2, /)[source]#
Array API compatible wrapper for
np.logical_xor
.See its docstring for more information.
- Return type:
- cupy.array_api.matmul(x1, x2, /)[source]#
Array API compatible wrapper for
np.matmul
.See its docstring for more information.
- Return type:
- cupy.array_api.meshgrid(*arrays, indexing='xy')[source]#
Array API compatible wrapper for
np.meshgrid
.See its docstring for more information.
- Return type:
List[Array]
- cupy.array_api.multiply(x1, x2, /)[source]#
Array API compatible wrapper for
np.multiply
.See its docstring for more information.
- Return type:
- cupy.array_api.negative(x, /)[source]#
Array API compatible wrapper for
np.negative
.See its docstring for more information.
- Return type:
- cupy.array_api.nonzero(x, /)[source]#
Array API compatible wrapper for
np.nonzero
.See its docstring for more information.
- cupy.array_api.not_equal(x1, x2, /)[source]#
Array API compatible wrapper for
np.not_equal
.See its docstring for more information.
- Return type:
- cupy.array_api.ones(shape, *, dtype=None, device=None)[source]#
Array API compatible wrapper for
np.ones
.See its docstring for more information.
- Return type:
- cupy.array_api.ones_like(x, /, *, dtype=None, device=None)[source]#
Array API compatible wrapper for
np.ones_like
.See its docstring for more information.
- Return type:
- cupy.array_api.permute_dims(x, /, axes)[source]#
Array API compatible wrapper for
np.transpose
.See its docstring for more information.
- Return type:
- cupy.array_api.positive(x, /)[source]#
Array API compatible wrapper for
np.positive
.See its docstring for more information.
- Return type:
- cupy.array_api.pow(x1, x2, /)[source]#
Array API compatible wrapper for
np.power
.See its docstring for more information.
- Return type:
- cupy.array_api.remainder(x1, x2, /)[source]#
Array API compatible wrapper for
np.remainder
.See its docstring for more information.
- Return type:
- cupy.array_api.reshape(x, /, shape)[source]#
Array API compatible wrapper for
np.reshape
.See its docstring for more information.
- Return type:
- cupy.array_api.result_type(*arrays_and_dtypes)[source]#
Array API compatible wrapper for
np.result_type
.See its docstring for more information.
- Return type:
Dtype
- cupy.array_api.roll(x, /, shift, *, axis=None)[source]#
Array API compatible wrapper for
np.roll
.See its docstring for more information.
- Return type:
- cupy.array_api.round(x, /)[source]#
Array API compatible wrapper for
np.round
.See its docstring for more information.
- Return type:
- cupy.array_api.sign(x, /)[source]#
Array API compatible wrapper for
np.sign
.See its docstring for more information.
- Return type:
- cupy.array_api.sin(x, /)[source]#
Array API compatible wrapper for
np.sin
.See its docstring for more information.
- Return type:
- cupy.array_api.sinh(x, /)[source]#
Array API compatible wrapper for
np.sinh
.See its docstring for more information.
- Return type:
- cupy.array_api.sort(x, /, *, axis=-1, descending=False, stable=True)[source]#
Array API compatible wrapper for
np.sort
.See its docstring for more information.
- Return type:
- cupy.array_api.sqrt(x, /)[source]#
Array API compatible wrapper for
np.sqrt
.See its docstring for more information.
- Return type:
- cupy.array_api.square(x, /)[source]#
Array API compatible wrapper for
np.square
.See its docstring for more information.
- Return type:
- cupy.array_api.squeeze(x, /, axis)[source]#
Array API compatible wrapper for
np.squeeze
.See its docstring for more information.
- Return type:
- cupy.array_api.stack(arrays, /, *, axis=0)[source]#
Array API compatible wrapper for
np.stack
.See its docstring for more information.
- Return type:
- cupy.array_api.subtract(x1, x2, /)[source]#
Array API compatible wrapper for
np.subtract
.See its docstring for more information.
- Return type:
- cupy.array_api.take(x, indices, /, *, axis)[source]#
Array API compatible wrapper for
np.take
. See its docstring for more information.- Return type:
- cupy.array_api.tan(x, /)[source]#
Array API compatible wrapper for
np.tan
.See its docstring for more information.
- Return type:
- cupy.array_api.tanh(x, /)[source]#
Array API compatible wrapper for
np.tanh
.See its docstring for more information.
- Return type:
- cupy.array_api.tril(x, /, *, k=0)[source]#
Array API compatible wrapper for
np.tril
.See its docstring for more information.
- Return type:
- cupy.array_api.triu(x, /, *, k=0)[source]#
Array API compatible wrapper for
np.triu
.See its docstring for more information.
- Return type:
- cupy.array_api.trunc(x, /)[source]#
Array API compatible wrapper for
np.trunc
.See its docstring for more information.
- Return type:
- cupy.array_api.unique_all(x, /)[source]#
Array API compatible wrapper for
np.unique
.See its docstring for more information.
- Return type:
UniqueAllResult
- cupy.array_api.unique_inverse(x, /)[source]#
Array API compatible wrapper for
np.unique
.See its docstring for more information.
- Return type:
UniqueInverseResult
- cupy.array_api.unique_values(x, /)[source]#
Array API compatible wrapper for
np.unique
.See its docstring for more information.
- Return type:
- cupy.array_api.where(condition, x1, x2, /)[source]#
Array API compatible wrapper for
np.where
.See its docstring for more information.
- Return type:
- cupy.array_api.zeros(shape, *, dtype=None, device=None)[source]#
Array API compatible wrapper for
np.zeros
.See its docstring for more information.
- Return type:
- cupy.array_api.zeros_like(x, /, *, dtype=None, device=None)[source]#
Array API compatible wrapper for
np.zeros_like
.See its docstring for more information.
- Return type: