Expand description
Shape and Strides - Tensor Dimension Management
§File
crates/axonml-tensor/src/shape.rs
§Author
Andrew Jewell Sr - AutomataNexus
§Updated
March 8, 2026
§Disclaimer
Use at own risk. This software is provided “as is”, without warranty of any kind, express or implied. The author and AutomataNexus shall not be held liable for any damages arising from the use of this software.
Functions§
- broadcast_
shape - Computes the broadcast shape of two shapes.
- broadcast_
strides - Computes broadcast strides for a shape to match a target shape.
- can_
broadcast - Checks if two shapes are broadcastable.
- contiguous_
strides - Computes row-major (C-order) strides for a shape.
- is_
contiguous - Checks if strides represent a contiguous memory layout.
- linear_
index - Computes the linear index from multi-dimensional indices.
- normalize_
dim - Normalizes a dimension index, supporting negative indexing.
- numel
- Computes the total number of elements from a shape.
- reshape
- Reshapes a tensor shape, validating that total elements match.
- squeeze
- Computes the shape after squeezing (removing dimensions of size 1).
- transpose_
shape - Computes the shape after transposing dimensions.
- transpose_
strides - Swaps two stride values.
- unravel_
index - Converts a linear index to multi-dimensional indices.
- unsqueeze
- Computes the shape after unsqueezing (adding a dimension of size 1).
- validate_
indices - Validates that indices are within bounds for a shape.