dpctl.tensor.from_numpy¶
- dpctl.tensor.from_numpy(arg, device=None, usm_type='device', sycl_queue=None)[source]¶
Creates
dpctl.tensor.usm_ndarrayfrom instance ofnumpy.ndarray.- Parameters:
arg – Input convertible to
numpy.ndarraydevice (object) – array API specification of device where the output array is created. Device can be specified by a filter selector string, an instance of
dpctl.SyclDevice, an instance ofdpctl.SyclQueue, or an instance ofdpctl.tensor.Device. If the value isNone, returned array is created on the default-selected device. Default:Noneusm_type (str) – The requested USM allocation type for the output array. Recognized values are
"device","shared", or"host"sycl_queue (
dpctl.SyclQueue, optional) – A SYCL queue that determines output array allocation device as well as execution placement of data movement operations. Thedeviceandsycl_queuearguments are equivalent. Only one of them should be specified. If both are provided, they must be consistent and result in using the same execution queue. Default:None
The returned array has the same shape, and the same data type kind. If the device does not support the data type of input array, a closest support data type of the same kind may be returned, e.g. input array of type
float16may be upcast tofloat32if the target device does not support 16-bit floating point type.