Skip to main content

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//!
20pub mod ad;
21pub mod axis;
22pub mod broadcast;
23pub mod dim_expr;
24pub mod ext_op;
25pub mod input_key;
26pub mod reduction;
27pub mod shape_extent;
28pub mod std_tensor_op;
29pub mod sym_dim;
30
31pub use ad::context::{ShapeGuard, ShapeGuardContext, TensorMeta};
32#[cfg(not(feature = "autodiff"))]
33pub use ext_op::ExtensionOp;
34#[cfg(feature = "autodiff")]
35pub use ext_op::{
36    linearize_extension_rule, transpose_extension_rule, ExtensionAdRule, ExtensionOp,
37    ExtensionRegistryError, ExtensionRuleSet,
38};
39pub use shape_extent::ShapeExtent;
40pub use sym_dim::SymDim;
41pub use tenferro_extension_macros::ExtensionFamilyId;
42pub use tenferro_tensor::config;
43
44#[cfg(test)]
45mod tests;