cupy.array#
- cupy.array(obj, dtype=None, copy=True, order='K', subok=False, ndmin=0, *, blocking=False)[source]#
Creates an array on the current device.
This function currently does not support the
subokoption.- Parameters:
obj –
cupy.ndarrayobject or any other object that can be passed tonumpy.array().dtype – Data type specifier.
copy (bool, optional) – If
True(default),objis always copied. IfFalse, prohibits copy and raises ValueError on failure. IfNone,objis copied only when necessary.order ({'C', 'F', 'A', 'K'}) – Row-major (C-style) or column-major (Fortran-style) order. When
orderis'A', it uses'F'ifais column-major and uses'C'otherwise. And whenorderis'K', it keeps strides as closely as possible. Ifobjisnumpy.ndarray, the function returns'C'or'F'order array.subok (bool) – If
True, then sub-classes will be passed-through, otherwise the returned array will be forced to be a base-class array (default).ndmin (int) – Minimum number of dimensions. Ones are inserted to the head of the shape if needed.
blocking (bool) – Default is
False, meaning if a H2D copy is needed it would run asynchronously on the current stream, and users are responsible for ensuring the stream order. For example, writing to the sourceobjwithout proper ordering while copying would result in a race condition. If set toTrue, the copy is synchronous (with respect to the host).
- Returns:
An array on the current device.
- Return type:
Note
This method currently does not support
subokargument.Note
If
objis an numpy.ndarray instance that contains big-endian data, this function automatically swaps its byte order to little-endian, which is the NVIDIA and AMD GPU architecture’s native use.See also