dpctl.tensor.asarray¶
- dpctl.tensor.asarray(obj, /, *, dtype=None, device=None, copy=None, usm_type=None, sycl_queue=None, order='K')[source]¶
Converts input object to
dpctl.tensor.usm_ndarray.- Parameters:
obj – Python object to convert. Can be an instance of
dpctl.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 (data type, optional) – output array data type. If
dtypeisNone, the output array data type is inferred from data types inobj. Default:Nonecopy (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:Noneorder (
"C","F","A","K", optional) – memory layout of the output array. Default:"K"device (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 adpctl.tensor.Deviceobject returned bydpctl.tensor.usm_ndarray.device. Default:Noneusm_type (
"device","shared","host", optional) – The type of SYCL USM allocation for the output array. Default:"device"sycl_queue (
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:
Array created from input object.
- Return type: