dpnp.tensor.from_numpy

dpnp.tensor.from_numpy(np_ary, /, *, device=None, usm_type='device', sycl_queue=None)[source]

Creates dpnp.tensor.usm_ndarray from instance of numpy.ndarray.

Parameters:
  • np_ary (array_like) -- Input convertible to numpy.ndarray

  • device ({None, object}, optional) --

    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 of dpctl.SyclQueue, or an instance of dpnp.tensor.Device. If the value is None, returned array is created on the default-selected device.

    Default: None.

  • usm_type (str, optional) --

    The requested USM allocation type for the output array. Recognized values are "device", "shared", or "host".

    Default: "device".

  • sycl_queue ({None, dpctl.SyclQueue}, optional) --

    A SYCL queue that determines output array allocation device as well as execution placement of data movement operations. The device and sycl_queue arguments 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.

Returns:

out -- 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 float16 may be upcast to float32 if the target device does not support 16-bit floating point type.

Return type:

usm_ndarray