Page cover

tensor

The tensor dialect supports operations on multidimensional arrays, commonly used in machine learning and linear algebra computations. While the initial implementation is flat, future versions may include subgroups for specialized tensor operations (e.g., sparse tensors).

Examples

//Creates a 1-dimensional tensor of size 
%tensor = tensor.create %shape : (i32) -> tensor<[n]> 

// Performs element-wise addition on two 4x4 tensors.
%result = tensor.add %t1, %t2 : (tensor<[4]x[4]>, tensor<[4]x[4]>) -> tensor<[4]x[4]>

Last updated