Array creation functionsΒΆ

The following functions in dpnp.tensor can be used to create new arrays:

arange

Returns evenly spaced values within the half-open interval [start, stop) as a one-dimensional array.

asarray

Converts input object to dpnp.tensor.usm_ndarray.

empty

Creates dpnp.tensor.usm_ndarray from uninitialized USM allocation.

empty_like

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

eye

Creates dpnp.tensor.usm_ndarray with ones on the k-th diagonal.

from_dlpack

Constructs dpnp.tensor.usm_ndarray or numpy.ndarray instance from a Python object x that implements __dlpack__ protocol.

full

Returns a new dpnp.tensor.usm_ndarray having a specified shape and filled with fill_value.

full_like

Returns a new dpnp.tensor.usm_ndarray filled with fill_value and having the same shape as the input array x.

linspace

Returns dpnp.tensor.usm_ndarray array populated with evenly spaced numbers of specified interval.

meshgrid

Creates tuple of dpnp.tensor.usm_ndarray coordinate matrices from vectors.

ones

Returns a new dpnp.tensor.usm_ndarray having a specified shape and filled with ones.

ones_like

Returns a new dpnp.tensor.usm_ndarray filled with ones and having the same shape as the input array x.

tril

Returns the lower triangular part of a matrix (or a stack of matrices) x.

triu

Returns the upper triangular part of a matrix (or a stack of matrices) x.

zeros

Returns a new dpnp.tensor.usm_ndarray having a specified shape and filled with zeros.

zeros_like

Creates dpnp.tensor.usm_ndarray from USM allocation initialized with zeros.

from_numpy

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

copy

Creates a copy of given instance of dpnp.tensor.usm_ndarray.