[][src]Module melange::tensor

tensor is a collection of tools to interact with multidimensional arrays that are at the core of ML pipelines. It defines various ways to store data and optimized mathematical operations. Contrary to other ndarray modules such as numpy in Python or ndarray in Rust, this module allows full size checking at compile time thanks to type level integers from the typenum crate.

Modules

allocation_policy

allocation_policy defines the traits StaticAllocationPolicy and DynamicAllocationPolicy that both contain an associated Layout type that should be used by operations when allocating. When an operation involves more than one tensor, the policy of self should be applied and passed to the new tensor. Policies are simply zero-sized structs that implement both traits.

core_ops

core_ops contains basic mathematical operations at the tensor level that rely on the implementation of the underlying data type T of the tensor. There are two families of operations: functionnal operations and in-place operations.

heap_layout
layout
linear_algebra

linear_algebra contains algebra-specific operations. It is currently limited to vector/vector, matrix/vector, and matrix/matrix dot products. It is entirely backed by openblas through C bindings.

prelude
reduction

reductions contains mathematical operations that aply to one tensor and output a tensor with the same shape except for one dimension that is reduced to 1. This covers sum, product, max and min over a certain axis.

shape

shape contains all the tools to complement typenum crate and efficiently use it for shape "arithmetics".

slice_layout
stack_layout
static_heap_layout
tensor
transpose_policy

transpose_policy defines the trait BLASPolicy that dictates the behavior of BLAS operations by passing BLAS_TRANSPOSE associated constant. The trait TransposePolicy defines the relationship between transpose policies: the associated type Transposed corresponds to the policy of the transposed tensor.