1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! 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`], which builds a graph for a Jacobian-vector product (JVP)
//! of selected outputs with respect to selected inputs.
//! - [`linear_transpose`], which transposes a linearized graph so cotangents
//! can flow backward through the corresponding linear map.
//! - [`eager::backward`], which supports downstream eager frontends that
//! record graph invocations and want a reverse-mode `backward()` workflow.
//!
//! These transforms propagate [`ADRuleError`] for missing primitive or
//! extension AD rules.
//!
//! See the repository `docs/` tree for the terminology guide, tutorials, and
//! implementer guides.
//!
//! # Examples
//!
//! ```ignore
//! use computegraph::resolve::resolve;
//! use tidu::{linear_transpose, linearize};
//!
//! let view = resolve(vec![source_graph]);
//! let mut ctx = ();
//! let aliases = std::collections::HashMap::new();
//! let linear = linearize(&view, &[output_key], &[input_key], 1, &mut ctx, &aliases)?;
//! let _transposed = linear_transpose(&linear, &mut ctx)?;
//! # Ok::<(), tidu::ADRuleError>(())
//! ```
pub use ;
pub use linearize;
pub use LinearizedGraph;
pub use PrimitiveGraph;
pub use ;