Tensor
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:
Data types
Orion supports currently these tensor types.
TensorTrait
TensorTrait
defines the operations that can be performed on a Tensor.
Arithmetic Operations
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.
Examples
Element-wise add.
Add two tensors of different shapes but compatible in broadcasting.
Last updated