Expand description
Automatic-differentiation transforms for primitive computation graphs.
tidu is for downstream crates that define primitive operations, local AD
rules, graph runtimes, or eager tensor frontends. It does not define tensor
operations itself. Instead, downstream primitive sets implement Primitive,
then call the graph transforms here to build new primitive computation
graphs.
The main transforms are:
linearize/try_linearize, which build a graph for a Jacobian-vector product (JVP) of selected outputs with respect to selected inputs.linear_transpose/try_linear_transpose, which transpose a linearized graph so cotangents can flow backward through the corresponding linear map.eager::try_backward, which supports downstream eager frontends that record graph invocations and want a reverse-modebackward()workflow.
Fallible variants (try_linearize, try_linear_transpose, and
eager::try_backward) propagate ADRuleError for missing primitive or
extension AD rules.
See the repository docs/ tree for the terminology guide, tutorials, and
implementer guides.
§Examples
ⓘ
use computegraph::resolve::resolve;
use tidu::{try_linear_transpose, try_linearize};
let view = resolve(vec![source_graph]);
let mut ctx = ();
let aliases = std::collections::HashMap::new();
let linear = try_linearize(&view, &[output_key], &[input_key], 1, &mut ctx, &aliases)?;
let _transposed = try_linear_transpose(&linear, &mut ctx)?;Re-exports§
pub use rules::ADKey;pub use rules::ADRuleError;pub use rules::ADRuleKind;pub use rules::ADRuleResult;pub use rules::DiffPassId;pub use rules::Primitive;pub use rules::PrimitiveBuilder;pub use rules::PrimitiveValue;
Modules§
- eager
- Generic eager reverse-mode recording for
Primitivefrontends. - rules
- Primitive AD rule contract consumed by
tidu.
Structs§
- Linearized
Graph - Graph produced by linearizing a primitive computation graph.
- Primitive
Graph - Borrowed primitive computation graph passed to downstream executors.
Functions§
- linear_
transpose - Transpose a linearized graph, reversing linear flow.
- linearize
- Linearize a resolved computation graph, producing a linear graph.
- try_
linear_ transpose - Fallible form of
linear_transpose. - try_
linear_ transpose_ with_ builder - Execute the transpose of a linearized graph using a caller-provided builder.
- try_
linearize - Fallible form of
linearize.