Skip to main content

Module tensor

Module tensor 

Source
Expand description

Tensor utility functions for converting between vectors and tensors.

This module provides functions to convert between Rust vectors and multi-dimensional tensors (1D, 2D, 3D, and 4D). It also includes utility functions for tensor operations like slicing and stacking.

Functionsยง

stack_tensor2d
Stacks a slice of 2D tensors into a single 3D tensor.
stack_tensor3d
Stacks a slice of 3D tensors into a single 4D tensor.
tensor1d_to_vec
Converts a 1D tensor into a 1D vector of f32 values.
tensor2d_to_vec
Converts a 2D tensor into a 2D vector of f32 values.
tensor3d_slice
Extracts a 2D slice from a 3D tensor at the specified index.
tensor3d_to_vec
Converts a 3D tensor into a 3D vector of f32 values.
tensor4d_slice
Extracts a 3D slice from a 4D tensor at the specified index.
tensor4d_to_vec
Converts a 4D tensor into a 4D vector of f32 values.
vec_to_tensor1d
Converts a 1D vector of f32 values into a 1D tensor with the specified shape.
vec_to_tensor2d
Converts a 2D vector of f32 values into a 2D tensor.
vec_to_tensor3d
Converts a 3D vector of f32 values into a 3D tensor.
vec_to_tensor4d
Converts a 4D vector of f32 values into a 4D tensor.