Tensor
Last updated
Last updated
A Tensor represents a multi-dimensional array of elements.
A Tensor
represents a multi-dimensional array of elements and is depicted as a struct containing both the tensor's shape and a flattened array of its data. The generic Tensor is defined as follows:
Orion supports currently these tensor types.
Data type | dtype |
---|---|
TensorTrait
defines the operations that can be performed on a Tensor.
function | description |
---|---|
Tensor
implements arithmetic traits. This allows you to perform basic arithmetic operations using the associated operators. (+
, -
, *
, /
). Tensors arithmetic operations supports broadcasting.
Two tensors are “broadcastable” if the following rules hold:
Each tensor has at least one dimension.
When iterating over the dimension sizes, starting at the trailing dimension, the dimension sizes must either be equal, one of them is 1, or one of them does not exist.
Element-wise add.
Add two tensors of different shapes but compatible in broadcasting.
32-bit integer (signed)
Tensor<i32>
8-bit integer (signed)
Tensor<i8>
32-bit integer (unsigned)
Tensor<u32>
Fixed point (signed)
Tensor<FP8x23 | FP16x16 | FP64x64 | FP32x32>
Returns a new tensor with the given shape and data.
Returns a new tensor with the specified target shape and the same data as the input tensor.
Flattens the input tensor into a 2D tensor.
Generate a tensor with given value and shape.
Returns a new tensor with the axes rearranged according to the given permutation.
Retrieves the value at the specified indices of a Tensor.
Converts a multi-dimensional index to a one-dimensional index.
Converts a one-dimensional index to a multi-dimensional index.
Check if two tensors are equal element-wise.
Check if each element of the first tensor is greater than the corresponding element of the second tensor.
Check if each element of the first tensor is greater than or equal to the corresponding element of the second tensor.
Check if each element of the first tensor is less than the corresponding element of the second tensor.
Check if each element of the first tensor is less than or equal to the corresponding element of the second tensor.
Computes the logical OR of two tensors element-wise.
Computes the logical XOR of two tensors element-wise.
Computes the stride of each dimension in the tensor.
Produces one-hot tensor based on input.
Returns the maximum value in the tensor.
Returns the minimum value in the tensor.
Returns the minimum value in the tensor.
Returns the maximum value in the tensor.
Reduces a tensor by summing its elements along a specified axis.
Reduces a tensor to its products along specified axis.
Returns the index of the maximum value along the specified axis.
Returns the index of the minimum value along the specified axis.
Performs cumulative sum of the input elements along the given axis.
Performs matrix product of two tensors.
Computes the exponential of all elements of the input tensor.
Computes the natural log of all elements of the input tensor.
Computes the absolute value of all elements in the input tensor.
Computes the negation of all elements in the input tensor.
Rounds up the value of each element in the input tensor.
Computes the square root of all elements of the input tensor.
Computes the sine of all elements of the input tensor.
Computes the cosine of all elements of the input tensor.
Computes the arctangent (inverse of tangent) of all elements of the input tensor.
Computes the arcsine (inverse of sine) of all elements of the input tensor.
Computes the arccosine (inverse of cosine) of all elements of the input tensor.
Computes the hyperbolic sine of all elements of the input tensor.
Computes the hyperbolic tangent of all elements of the input tensor.
Computes the hyperbolic cosine of all elements of the input tensor.
Computes the inverse hyperbolic sine of all elements of the input tensor.
Computes the inverse hyperbolic cosine of all elements of the input tensor.
Produces a slice of the input tensor along multiple axes.
Concatenate a list of tensors into a single tensor.
Quantizes a Tensor to i8 using linear quantization.
Dequantizes an i8 Tensor using linear dequantization.
Performs the sum of two quantized i8 Tensors.
Performs the element-wise multiplication of quantized Tensors.
Performs the product of two quantized i8 Tensors.
Concatenate a list of tensors after dequantizing them with their respective scales and zero_points and returns the quantized result.
Applies the Leaky Relu operator to a quantized Tensor
Performs convolution on quantized Tensors
Gather entries of the axis dimension of data.
Produces indices of the elements that are non-zero (in row-major order - by dimension).
Removes dimensions of size 1 from the shape of a tensor.
Inserts single-dimensional entries to the shape of an input tensor.
Calculates the sign of the given input tensor element-wise.
Clip operator limits the given input within an interval.
Computes the logical AND of two tensors element-wise.
Return a Tensor with the same shape and contents as input.
Return elements chosen from x or y depending on condition.
Computes the bitwise AND of two tensors element-wise.
Computes the bitwise XOR of two tensors element-wise.
Computes the bitwise OR of two tensors element-wise.