Array creation functions

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

arange(start, /[, stop, step, dtype, ...])

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

asarray(obj, /, *[, dtype, device, copy, ...])

Converts input object to dpctl.tensor.usm_ndarray.

empty(shape, *[, dtype, order, device, ...])

Creates dpctl.tensor.usm_ndarray from uninitialized USM allocation.

empty_like(x, /, *[, dtype, order, device, ...])

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

eye(n_rows[, n_cols, k, dtype, device, ...])

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

from_dlpack(x, /, *[, device, copy])

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

full(shape, fill_value, *[, dtype, order, ...])

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

full_like(x, fill_value[, dtype, order, ...])

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

linspace(start, stop, num[, dtype, device, ...])

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

meshgrid(*arrays[, indexing])

Creates list of dpctl.tensor.usm_ndarray coordinate matrices from vectors.

ones(shape[, dtype, order, device, ...])

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

ones_like(x, /, *[, dtype, order, device, ...])

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

tril(x, /, *[, k])

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

triu(x, /, *[, k])

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

zeros(shape, *[, dtype, order, device, ...])

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

zeros_like(x, /, *[, dtype, order, device, ...])

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

from_numpy(arg[, device, usm_type, sycl_queue])

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

copy(ary[, order])

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