Expand description
Static shape inference for tensor operation graphs.
Provides TensorShapeInference which computes output shapes for common
tensor operations (broadcast, matmul, reshape, transpose, concat, slice)
following NumPy-compatible broadcasting rules.
§Examples
use ipfrs_tensorlogic::shape_inference::{TensorShapeInference, TensorShape, ShapeOp, InferenceRule};
use std::collections::HashMap;
let mut engine = TensorShapeInference::new();
// Matrix multiply (3,4) x (4,5) -> (3,5)
let rule = InferenceRule {
op: ShapeOp::MatMul,
input_shapes: vec![
TensorShape { dims: vec![3, 4] },
TensorShape { dims: vec![4, 5] },
],
params: HashMap::new(),
};
let result = engine.infer(&rule).expect("example: should succeed in docs");
assert_eq!(result.dims, vec![3, 5]);Structs§
- Inference
Rule - An inference rule: an operation together with its input shapes and optional parameters.
- Shape
Inference Stats - Statistics collected by
TensorShapeInference. - Tensor
Shape - Shape descriptor for a tensor.
- Tensor
Shape Inference - Static shape inference engine for tensor operation graphs.
Enums§
- ShapeOp
- Supported tensor operations for shape inference.