Standard Library: Tensor

The tensor module provides the core tensor types and operations for numerical computation.

Key Exports

  • Tensor<T, Shape> — The primary tensor type with static shape.
  • zeros, ones, full — Tensor constructors.
  • add, mul, matmul — Element-wise and matrix operations.
  • sum, mean, max — Reduction operations.

Example Usage

use tensor::{Tensor, zeros, ones};

fn main() {
    let a: Tensor<f32>[2, 3] = zeros();
    let b: Tensor<f32>[2, 3] = ones();
    let c = a + b;  // Broadcasting add
    print(c);
}