docsapi referencedarkforest-core-tensor-shape
API Referencecrate: darkforest-coresince v0.1.0-alpha

Shape

Stack-allocated small vector holding up to 6 tensor dimensions inline without heap traversal.

Shape

darkforest-core module: tensor since v0.1.0-alpha

Signature

rust
pub struct Shape { dims: SmallVec<[usize; 6]> }

Overview

Stack-allocated small vector holding up to 6 tensor dimensions inline without heap traversal.

Invariants & Design Principles

  • Invariant: Tensors with up to 6 dimensions incur zero heap allocation for shape metadata.

Usage Example

rust
let shape = Shape::from_slice(&[32, 3, 224, 224]);

Related Components