numba_dpex.dpnp_iface.arrayobj module

numba_dpex.dpnp_iface.arrayobj.ol_dpnp_empty(shape, dtype=None, order='C', device=None, usm_type='device', sycl_queue=None)

Implementation of an overload to support dpnp.empty() inside a dpjit function.

Args:
shape (numba.core.types.containers.UniTuple or

numba.core.types.scalars.IntegerLiteral): Dimensions of the array to be created.

dtype (numba.core.types.functions.NumberClass, optional):

Data type of the array. Can be typestring, a numpy.dtype object, numpy char string, or a numpy scalar type. Default: None.

order (str, optional): memory layout for the array “C” or “F”.

Default: “C”.

device (numba.core.types.misc.StringLiteral, 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 Device object returnedby`dpctl.tensor.usm_array.device`. Default: None.

usm_type (numba.core.types.misc.StringLiteral or str, optional):

The type of SYCL USM allocation for the output array. Allowed values are “device”|”shared”|”host”. Default: “device”.

sycl_queue (numba_dpex.core.types.dpctl_types.DpctlSyclQueue,

optional): The SYCL queue to use for output array allocation and copying. sycl_queue and device are exclusive keywords, i.e. use one or another. If both are specified, a TypeError is raised. If both are None, a cached queue targeting default-selected device is used for allocation and copying. Default: None.

Raises:

errors.TypingError: If both device and sycl_queue are provided. errors.TypingError: If rank of the ndarray couldn’t be inferred. errors.TypingError: If couldn’t parse input types to dpnp.empty().

Returns:

function: Local function impl_dpnp_empty().

numba_dpex.dpnp_iface.arrayobj.ol_dpnp_empty_like(x1, dtype=None, order='C', subok=False, shape=None, device=None, usm_type=None, sycl_queue=None)

Creates usm_ndarray from uninitialized USM allocation.

This is an overloaded function implementation for dpnp.empty_like().

Args:
x1 (numba.core.types.npytypes.Array): Input array from which to

derive the output array shape.

dtype (numba.core.types.functions.NumberClass, optional):

Data type of the array. Can be typestring, a numpy.dtype object, numpy char string, or a numpy scalar type. Default: None.

order (str, optional): memory layout for the array “C” or “F”.

Default: “C”.

subok (‘numba.core.types.scalars.BooleanLiteral’, optional): A

boolean literal type for the subok parameter defined in NumPy. If True, then the newly created array will use the sub-class type of prototype, otherwise it will be a base-class array. Defaults to False.

shape (numba.core.types.containers.UniTuple, optional): The shape

to override the shape of the given array. Not supported. Default: None

device (numba.core.types.misc.StringLiteral, 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 Device object returnedby`dpctl.tensor.usm_array.device`. Default: None.

usm_type (numba.core.types.misc.StringLiteral or str, optional):

The type of SYCL USM allocation for the output array. Allowed values are “device”|”shared”|”host”. Default: “device”.

sycl_queue (numba_dpex.core.types.dpctl_types.DpctlSyclQueue,

optional): The SYCL queue to use for output array allocation and copying. sycl_queue and device are exclusive keywords, i.e. use one or another. If both are specified, a TypeError is raised. If both are None, a cached queue targeting default-selected device is used for allocation and copying. Default: None.

Raises:

errors.TypingError: If both device and sycl_queue are provided. errors.TypingError: If couldn’t parse input types to dpnp.empty_like(). errors.TypingError: If shape is provided.

Returns:

function: Local function impl_dpnp_empty_like().

numba_dpex.dpnp_iface.arrayobj.ol_dpnp_full(shape, fill_value, dtype=None, order='C', like=None, device=None, usm_type=None, sycl_queue=None)

Implementation of an overload to support dpnp.full() inside a dpjit function.

Args:
shape (numba.core.types.containers.UniTuple or

numba.core.types.scalars.IntegerLiteral): Dimensions of the array to be created.

fill_value (numba.core.types.scalars): One of the

numba.core.types.scalar types for the value to be filled.

dtype (numba.core.types.functions.NumberClass, optional):

Data type of the array. Can be typestring, a numpy.dtype object, numpy char string, or a numpy scalar type. Default: None.

order (str, optional): memory layout for the array “C” or “F”.

Default: “C”.

like (numba.core.types.npytypes.Array, optional): A type for

reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as like supports the __array_function__ protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.

device (numba.core.types.misc.StringLiteral, 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 Device object returnedby`dpctl.tensor.usm_array.device`. Default: None.

usm_type (numba.core.types.misc.StringLiteral or str, optional):

The type of SYCL USM allocation for the output array. Allowed values are “device”|”shared”|”host”. Default: “device”.

sycl_queue (numba_dpex.core.types.dpctl_types.DpctlSyclQueue,

optional): The SYCL queue to use for output array allocation and copying. sycl_queue and device are exclusive keywords, i.e. use one or another. If both are specified, a TypeError is raised. If both are None, a cached queue targeting default-selected device is used for allocation and copying. Default: None.

Raises:

errors.TypingError: If both device and sycl_queue are provided. errors.TypingError: If rank of the ndarray couldn’t be inferred. errors.TypingError: If couldn’t parse input types to dpnp.full().

Returns:

function: Local function impl_dpnp_full().

numba_dpex.dpnp_iface.arrayobj.ol_dpnp_full_like(x1, fill_value, dtype=None, order='C', subok=None, shape=None, device=None, usm_type=None, sycl_queue=None)

Creates usm_ndarray from USM allocation initialized with values specified by the fill_value.

This is an overloaded function implementation for dpnp.full_like().

Args:
x1 (numba.core.types.npytypes.Array): Input array from which to

derive the output array shape.

fill_value (numba.core.types.scalars): One of the

numba.core.types.scalar types for the value to be filled.

dtype (numba.core.types.functions.NumberClass, optional):

Data type of the array. Can be typestring, a numpy.dtype object, numpy char string, or a numpy scalar type. Default: None.

order (str, optional): memory layout for the array “C” or “F”.

Default: “C”.

subok (‘numba.core.types.scalars.BooleanLiteral’, optional): A

boolean literal type for the subok parameter defined in NumPy. If True, then the newly created array will use the sub-class type of prototype, otherwise it will be a base-class array. Defaults to False.

shape (numba.core.types.containers.UniTuple, optional): The shape

to override the shape of the given array. Not supported. Default: None

device (numba.core.types.misc.StringLiteral, 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 Device object returnedby`dpctl.tensor.usm_array.device`. Default: None.

usm_type (numba.core.types.misc.StringLiteral or str, optional):

The type of SYCL USM allocation for the output array. Allowed values are “device”|”shared”|”host”. Default: “device”.

sycl_queue (numba_dpex.core.types.dpctl_types.DpctlSyclQueue,

optional): The SYCL queue to use for output array allocation and copying. sycl_queue and device are exclusive keywords, i.e. use one or another. If both are specified, a TypeError is raised. If both are None, a cached queue targeting default-selected device is used for allocation and copying. Default: None.

Raises:

errors.TypingError: If both device and sycl_queue are provided. errors.TypingError: If couldn’t parse input types to dpnp.full_like(). errors.TypingError: If shape is provided.

Returns:

function: Local function impl_dpnp_full_like().

numba_dpex.dpnp_iface.arrayobj.ol_dpnp_ones(shape, dtype=None, order='C', device=None, usm_type='device', sycl_queue=None)

Implementation of an overload to support dpnp.ones() inside a dpjit function.

Args:
shape (numba.core.types.containers.UniTuple or

numba.core.types.scalars.IntegerLiteral): Dimensions of the array to be created.

dtype (numba.core.types.functions.NumberClass, optional):

Data type of the array. Can be typestring, a numpy.dtype object, numpy char string, or a numpy scalar type. Default: None.

order (str, optional): memory layout for the array “C” or “F”.

Default: “C”.

device (numba.core.types.misc.StringLiteral, 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 Device object returnedby`dpctl.tensor.usm_array.device`. Default: None.

usm_type (numba.core.types.misc.StringLiteral or str, optional):

The type of SYCL USM allocation for the output array. Allowed values are “device”|”shared”|”host”. Default: “device”.

sycl_queue (numba_dpex.core.types.dpctl_types.DpctlSyclQueue,

optional): The SYCL queue to use for output array allocation and copying. sycl_queue and device are exclusive keywords, i.e. use one or another. If both are specified, a TypeError is raised. If both are None, a cached queue targeting default-selected device is used for allocation and copying. Default: None.

Raises:

errors.TypingError: If both device and sycl_queue are provided. errors.TypingError: If rank of the ndarray couldn’t be inferred. errors.TypingError: If couldn’t parse input types to dpnp.ones().

Returns:

function: Local function impl_dpnp_ones().

numba_dpex.dpnp_iface.arrayobj.ol_dpnp_ones_like(x1, dtype=None, order='C', subok=None, shape=None, device=None, usm_type=None, sycl_queue=None)

Creates usm_ndarray from USM allocation initialized with ones.

This is an overloaded function implementation for dpnp.ones_like().

Args:
x1 (numba.core.types.npytypes.Array): Input array from which to

derive the output array shape.

dtype (numba.core.types.functions.NumberClass, optional):

Data type of the array. Can be typestring, a numpy.dtype object, numpy char string, or a numpy scalar type. Default: None.

order (str, optional): memory layout for the array “C” or “F”.

Default: “C”.

subok (‘numba.core.types.scalars.BooleanLiteral’, optional): A

boolean literal type for the subok parameter defined in NumPy. If True, then the newly created array will use the sub-class type of prototype, otherwise it will be a base-class array. Defaults to False.

shape (numba.core.types.containers.UniTuple, optional): The shape

to override the shape of the given array. Not supported. Default: None

device (numba.core.types.misc.StringLiteral, 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 Device object returnedby`dpctl.tensor.usm_array.device`. Default: None.

usm_type (numba.core.types.misc.StringLiteral or str, optional):

The type of SYCL USM allocation for the output array. Allowed values are “device”|”shared”|”host”. Default: “device”.

sycl_queue (numba_dpex.core.types.dpctl_types.DpctlSyclQueue,

optional): The SYCL queue to use for output array allocation and copying. sycl_queue and device are exclusive keywords, i.e. use one or another. If both are specified, a TypeError is raised. If both are None, a cached queue targeting default-selected device is used for allocation and copying. Default: None.

Raises:

errors.TypingError: If both device and sycl_queue are provided. errors.TypingError: If couldn’t parse input types to dpnp.ones_like(). errors.TypingError: If shape is provided.

Returns:

function: Local function impl_dpnp_ones_like().

numba_dpex.dpnp_iface.arrayobj.ol_dpnp_zeros(shape, dtype=None, order='C', device=None, usm_type='device', sycl_queue=None)

Implementation of an overload to support dpnp.zeros() inside a dpjit function.

Args:
shape (numba.core.types.containers.UniTuple or

numba.core.types.scalars.IntegerLiteral): Dimensions of the array to be created.

dtype (numba.core.types.functions.NumberClass, optional):

Data type of the array. Can be typestring, a numpy.dtype object, numpy char string, or a numpy scalar type. Default: None.

order (str, optional): memory layout for the array “C” or “F”.

Default: “C”.

device (numba.core.types.misc.StringLiteral, 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 Device object returnedby`dpctl.tensor.usm_array.device`. Default: None.

usm_type (numba.core.types.misc.StringLiteral or str, optional):

The type of SYCL USM allocation for the output array. Allowed values are “device”|”shared”|”host”. Default: “device”.

sycl_queue (numba_dpex.core.types.dpctl_types.DpctlSyclQueue,

optional): The SYCL queue to use for output array allocation and copying. sycl_queue and device are exclusive keywords, i.e. use one or another. If both are specified, a TypeError is raised. If both are None, a cached queue targeting default-selected device is used for allocation and copying. Default: None.

Raises:

errors.TypingError: If both device and sycl_queue are provided. errors.TypingError: If rank of the ndarray couldn’t be inferred. errors.TypingError: If couldn’t parse input types to dpnp.zeros().

Returns:

function: Local function impl_dpnp_zeros().

numba_dpex.dpnp_iface.arrayobj.ol_dpnp_zeros_like(x1, dtype=None, order='C', subok=None, shape=None, device=None, usm_type=None, sycl_queue=None)

Creates usm_ndarray from USM allocation initialized with zeros.

This is an overloaded function implementation for dpnp.zeros_like().

Args:
x1 (numba.core.types.npytypes.Array): Input array from which to

derive the output array shape.

dtype (numba.core.types.functions.NumberClass, optional):

Data type of the array. Can be typestring, a numpy.dtype object, numpy char string, or a numpy scalar type. Default: None.

order (str, optional): memory layout for the array “C” or “F”.

Default: “C”.

subok (‘numba.core.types.scalars.BooleanLiteral’, optional): A

boolean literal type for the subok parameter defined in NumPy. If True, then the newly created array will use the sub-class type of prototype, otherwise it will be a base-class array. Defaults to False.

shape (numba.core.types.containers.UniTuple, optional): The shape

to override the shape of the given array. Not supported. Default: None

device (numba.core.types.misc.StringLiteral, 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 Device object returnedby`dpctl.tensor.usm_array.device`. Default: None.

usm_type (numba.core.types.misc.StringLiteral or str, optional):

The type of SYCL USM allocation for the output array. Allowed values are “device”|”shared”|”host”. Default: “device”.

sycl_queue (numba_dpex.core.types.dpctl_types.DpctlSyclQueue,

optional): The SYCL queue to use for output array allocation and copying. sycl_queue and device are exclusive keywords, i.e. use one or another. If both are specified, a TypeError is raised. If both are None, a cached queue targeting default-selected device is used for allocation and copying. Default: None.

Raises:

errors.TypingError: If both device and sycl_queue are provided. errors.TypingError: If couldn’t parse input types to dpnp.zeros_like(). errors.TypingError: If shape is provided.

Returns:

function: Local function impl_dpnp_zeros_like().