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.

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.

flip()

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

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.

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

__array_namespace_info__()

Returns a namespace with Array API namespace inspection utilities.

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.

argsort()

Returns the indices that sort an array x along a specified axis.

can_cast()

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

clip()

Clips to the range [min_i, max_i] for each element x_i in x.

extract()

Returns the elements of an array that satisfies the condition.

finfo()

Returns machine limits for floating-point data types.

get_print_options()

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

iinfo()

Returns machine limits for integer data types.

isdtype()

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

logsumexp()

Calculates the logarithm of the sum of exponentials of elements in the input array x.

matmul()

Computes the matrix product. Implements the same semantics as the built-in operator @.

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.

mean()

Calculates the arithmetic mean of elements in 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.

reduce_hypot()

Calculates the square root of the sum of squares of elements in the input array x.

result_type()

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

set_print_options()

Set options for printing dpctl.tensor.usm_ndarray class.

sort()

Returns a sorted copy of an input array x.

std()

Calculates the standard deviation of elements in the input array x.

sum()

Calculates the sum of elements in the input array x.

take()

Takes elements from array along a given axis.

tensordot()

Returns a tensor contraction of x1 and x2 over specific axes.

unique_all()

Returns the unique elements of an input array x, the first occurring indices for each unique element in x, the indices from the set of unique elements that reconstruct x, and the corresponding counts for each unique element in x.

unique_counts()

Returns the unique elements of an input array x and the corresponding counts for each unique element in x.

unique_inverse()

unique_inverse Returns the unique elements of an input array x and the indices from the set of unique elements that reconstruct x.

unique_values()

Returns the unique elements of an input array x.

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.

var()

Calculates the variance of elements in the input array x.

vecdot()

Computes the (vector) dot product of two arrays.

where()

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