dpctl.tensor

Data Parallel Tensor Collection is a collection of tensor implementations that implement Python data API (https://data-apis.github.io/array-api/latest/) standard.

Classes

Device

An object representing Data-API concept of device.

dtype

Create a data type object.

usm_ndarray

An array object represents a multidimensional tensor of numeric elements stored in a USM allocation on a SYCL device.

Array Construction

arange()

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

asarray()

Converts obj to dpctl.tensor.usm_ndarray.

asnumpy()

Copies content of dpctl.tensor.usm_ndarray instance usm_ary into numpy.ndarray instance of the same shape and same data type.

astype()

Returns a copy of the dpctl.tensor.usm_ndarray, cast to a specified type.

copy()

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

empty()

Creates dpctl.tensor.usm_ndarray from uninitialized USM allocation.

empty_like()

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

eye()

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

from_numpy()

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

full()

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

full_like()

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

linspace()

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

meshgrid()

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

ones()

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

ones_like()

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

to_numpy()

Copies content of dpctl.tensor.usm_ndarray instance usm_ary into numpy.ndarray instance of the same shape and same data type.

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 dpctl.tensor.usm_ndarray having a specified shape and filled with zeros.

zeros_like()

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

Array Manipulation

broadcast_arrays()

Broadcasts one or more dpctl.tensor.usm_ndarrays against one another.

broadcast_to()

Broadcast an array to a new shape; returns the broadcasted dpctl.tensor.usm_ndarray as a view.

can_cast()

Determines if one data type can be cast to another data type according to Type Promotion Rules.

concat()

Joins a sequence of arrays along an existing axis.

expand_dims()

Expands the shape of an array by inserting a new axis (dimension) of size one at the position specified by axis.

finfo()

Returns machine limits for floating-point data types.

flip()

Reverses the order of elements in an array x along the given axis.

iinfo()

Returns machine limits for integer data types.

moveaxis()

Moves axes of an array to new positions.

permute_dims()

Permute the axes (dimensions) of an array; returns the permuted array as a view.

repeat()

Repeat elements of an array.

reshape()

Reshapes array x into new shape.

result_type()

Returns the dtype that results from applying the Type Promotion Rules to the arguments.

roll()

Rolls array elements along a specified axis.

squeeze()

Removes singleton dimensions (axes) from array x.

stack()

Joins a sequence of arrays along a new axis.

swapaxes()

Interchanges two axes of an array.

tile()

Repeat an input array x along each axis a number of times given by repetitions.

unstack()

Splits an array in a sequence of arrays along the given axis.

Other Functions

all()

Tests whether all input array elements evaluate to True along a given axis.

allclose()

Returns True if two arrays are element-wise equal within tolerances.

any()

Tests whether any input array elements evaluate to True along a given axis.

argmax()

Returns the indices of the maximum values of the input array x along a specified axis.

argmin()

Returns the indices of the minimum values of the input array x along a specified axis.

extract()

Returns the elements of an array that satisfies the condition.

get_print_options()

Returns a copy of current options for printing dpctl.tensor.usm_ndarray class.

isdtype()

Returns a boolean indicating whether a provided dtype is of a specified data type kind.

matrix_transpose()

Transposes the innermost two dimensions of x, where x is a 2-dimensional matrix or a stack of 2-dimensional matrices.

max()

Calculates the maximum value of the input array x.

min()

Calculates the minimum value of the input array x.

nonzero()

Return the indices of non-zero elements.

place()

Change elements of an array based on conditional and input values.

print_options()

Context manager for print options.

prod()

Calculates the product of elements in the input array x.

put()

Puts values of an array into another array along a given axis.

set_print_options()

Set options for printing dpctl.tensor.usm_ndarray class.

sum()

Calculates the sum of elements in the input array x.

take()

Takes elements from array along a given axis.

usm_ndarray_repr()

Returns a formatted string representing the elements of a dpctl.tensor.usm_ndarray and its data type, if not a default type.

usm_ndarray_str()

Returns a string representing the elements of a dpctl.tensor.usm_ndarray.

where()

Returns dpctl.tensor.usm_ndarray with elements chosen from x1 or x2 depending on condition.