Tutorials
These tutorials are ordered, runnable introductions to the main tenferro workflows. They complement the guides: tutorials show one complete path, while guides describe the broader APIs and tradeoffs.
All non-trivial code in this section is sourced from docs/tutorial-code and is run by the workspace test workflow.
Suggested Order
| Tutorial | Use it when |
|---|---|
| TypedTensor for numeric computation without autodiff | You know the scalar type in Rust and want ndarray-like CPU tensor computation without AD. |
| Eager autodiff, PyTorch style | You want immediate execution, scalar losses, backward(), and accumulated gradients. |
| Traced autodiff, JAX style | You want to build a graph, compile/run it, and use grad or jvp on the traced graph. |
| Einsum: subscripts to gradients | You contract more than two tensors and want planned contraction order plus AD. |
| XLA backend: einsum to StableHLO | You want to lower a fixed-shape N-ary einsum path through the experimental XLA executor. |
| Dynamic shapes: truncated SVD | Output ranks depend on runtime values such as singular-value thresholds. |
Running The Tutorial Code
From the repository root:
cargo test -p tenferro-tutorial-code --releaseThe CI workflow runs this package through the existing workspace test command, so tutorial execution does not add a second tenferro compilation step after unit tests.