constensor-core 0.1.1

Experimental ML framework featuring a graph-based JIT compiler.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pub mod concretetensor;
pub mod graphtensor;

pub use concretetensor::Tensor;
pub use graphtensor::GraphTensor;

/// Compute default (contiguous) strides for a tensor of given shape.
pub(crate) fn contiguous_strides(shape: &[usize]) -> Vec<usize> {
    let mut strides = Vec::with_capacity(shape.len());
    let mut acc = 1;
    // Iterate dims in reverse to accumulate products
    for dim in shape.iter().rev() {
        strides.push(acc);
        acc *= *dim;
    }
    strides.reverse();
    strides
}