tenferro_ops/lib.rs
1//! Internal tensor operation vocabulary shared by tenferro graph crates.
2//!
3//! This crate owns symbolic dimension expressions, extension-op traits, shape
4//! guards, and the standard tensor op enum used by traced execution and AD
5//! lowering. End users normally interact through `tenferro-runtime` and
6//! operation-family crates rather than importing this crate directly.
7//!
8//! # Examples
9//!
10//! ```
11//! use tenferro_ops::{ShapeExtent, SymDim};
12//! use tenferro_ops::std_tensor_op::StdTensorOp;
13//!
14//! let op = StdTensorOp::constant(2.0_f64);
15//! let extent = ShapeExtent::exact(SymDim::from(3usize));
16//! assert!(matches!(op, StdTensorOp::Constant { .. }));
17//! assert!(extent.is_exact());
18//! ```
19//!
20//! Collected shape constraints are inference-driver internals rather than a
21//! crate-root extension-author API:
22//!
23//! ```compile_fail
24//! use tenferro_ops::ExtensionShapeConstraint;
25//! ```
26//!
27pub mod ad;
28pub mod axis;
29pub mod broadcast;
30pub mod dim_expr;
31pub mod ext_op;
32pub mod input_key;
33pub mod reduction;
34#[doc(hidden)]
35pub mod shape_constraint;
36pub mod shape_extent;
37pub mod std_tensor_op;
38pub mod sym_dim;
39
40pub use ad::context::{
41 ShapeGuard, ShapeGuardContext, ShapeGuardError, ShapeGuardFailure, ShapeGuardResult, TensorMeta,
42};
43pub use ext_op::ExtensionOp;
44pub use shape_constraint::{ExtensionShapeContext, ExtensionShapeError, ShapeRelation};
45pub use shape_extent::ShapeExtent;
46pub use sym_dim::{SymDim, SymDimConversionError};
47pub use tenferro_extension_macros::ExtensionFamilyId;
48pub use tenferro_tensor::config;
49
50#[cfg(test)]
51mod tests;