dpnp.tensor.empty_like

dpnp.tensor.empty_like(x, /, *, dtype=None, order='K', device=None, usm_type=None, sycl_queue=None)[source]

Returns an uninitialized dpnp.tensor.usm_ndarray with the same shape as the input array x.

Parameters:
  • x (usm_ndarray) -- Input array from which to derive the output array shape.

  • dtype ({None, dtype}, optional) --

    data type of the array. Can be a typestring, a numpy.dtype object, NumPy char string, or a NumPy scalar type.

    Default: None.

  • order ({"C", "F", "A", "K"}, optional) --

    memory layout for the array.

    Default: "K".

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

    array API concept of device where the output array is created. device can be None, a oneAPI filter selector string, an instance of dpctl.SyclDevice corresponding to a non-partitioned SYCL device, an instance of dpctl.SyclQueue, or a dpnp.tensor.Device object returned by dpnp.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_queue and device are complementary arguments, i.e. use one or another. If both are specified, a TypeError is raised unless both imply the same underlying SYCL queue to be used. If both are None, a cached queue targeting default-selected device is used for allocation.

    Default: None.

Returns:

out -- Created empty array with uninitialized memory.

Return type:

usm_ndarray