Skip to main content

Crate candle_graph

Crate candle_graph 

Source
Expand description

Static structure and dataflow analysis for candle-rs models.

See README.md for the motivation. In short: candle’s autograd graph is not inspectable at runtime (Tensor::op() is pub(crate)), and several candle-nn ops sever gradient flow silently, so the only way to answer “does this parameter receive a gradient” is to read the source.

It reconstructs module and parameter structure, expression-level dtype and gradient dataflow, deterministic CI baselines, and a standalone interactive report.

Compile-time static analysis is always available. Enable the runtime feature for train/inference phase graphs, runtime trace import, gradient audit, and profiling.

Re-exports§

pub use phase::ExecutionPhase;
pub use ir::Structure;

Modules§

analysis_cache
Optional on-disk cache for analyzed crate::model_ir::ModelIr documents.
baseline
Deterministic structure baselines for CI.
cargo_context
Bounded Cargo/config discovery for analyzing a crate in its real feature/cfg context.
cli
Shared CLI engine for candle-graph and cargo-candle-graph.
contracts
Conservative tensor-contract inference from qualified Rust functions.
dataflow
Expression-level dataflow, dtype, and gradient-connectivity analysis.
diagnostics
Rustc-like diagnostics rendered from unified model findings.
discover
Crate-wide model discovery and unified IR assembly.
extract
The structure extraction pass.
ir
The analysis IR.
known
Ground truth for the candle-nn constructors that register parameters.
load
Crate loading and the symbol table.
model_baseline
Deterministic ModelIr fingerprints for crate-wide CI checks.
model_ir
Unified, agent-oriented representation of a Candle model crate.
op_semantics
Transfer rules for candle Tensor ops and known candle-nn helpers.
phase
Train vs inference execution phase for static graphs and runtime traces.
profile
Runtime profiler: attach during train or inference to emit timed operation/edge traces.
query
Bounded queries over crate::model_ir::ModelIr.
report
Output formats.
runtime
Bounded runtime evidence and gradient-audit protocol.
verify
Cross-check the static parameter set against a real checkpoint.
viewer
Dependency-free interactive HTML viewer for structure (+ optional dataflow) JSON.