dpnp.tensor.asarray¶
- dpnp.tensor.asarray(obj, /, *, dtype=None, device=None, copy=None, usm_type=None, sycl_queue=None, order='K')[source]¶
Converts input object to
dpnp.tensor.usm_ndarray.- Parameters:
obj (array_like) -- Python object to convert. Can be an instance of
dpnp.tensor.usm_ndarray, an object representing SYCL USM allocation and implementing__sycl_usm_array_interface__protocol, an instance ofnumpy.ndarray, an object supporting Python buffer protocol, a Python scalar, or a (possibly nested) sequence of Python scalars.dtype ({None, dtype}, optional) --
output array data type. If
dtypeisNone, the output array data type is inferred from data types inobj.Default:
None.copy ({None, bool}, optional) --
boolean indicating whether or not to copy the input. If
True, always creates a copy. IfFalse, the need to copy raisesValueError. IfNone, tries to reuse existing memory allocations if possible, but allows to perform a copy otherwise.Default:
None.order ({"C", "F", "A", "K"}, optional) --
memory layout of the output array.
Default:
"K".device ({None, object}, optional) --
array API concept of device where the output array is created.
devicecan beNone, a oneAPI filter selector string, an instance ofdpctl.SyclDevicecorresponding to a non-partitioned SYCL device, an instance ofdpctl.SyclQueue, or adpnp.tensor.Deviceobject returned bydpnp.tensor.usm_ndarray.device.Default:
None.usm_type ({None, "device", "shared", "host"}, optional) --
The type of SYCL USM allocation for the output array.
Default:
"device".sycl_queue ({None, dpctl.SyclQueue}, optional) --
The SYCL queue to use for output array allocation and copying.
sycl_queueanddeviceare complementary arguments, i.e. use one or another. If both are specified, aTypeErroris raised unless both imply the same underlying SYCL queue to be used. If both areNone, a cached queue targeting default-selected device is used for allocation and population.Default:
None.
- Returns:
out -- Array created from input object.
- Return type: