Expand description
tenferro: AD-aware tensor interface layer on top of tenferro-rs.
The public surface includes reverse-mode helpers plus a narrow JVP
transform, [jvp], which returns JvpResult with primal outputs and
optional output tangents for the currently wired operations.
§Examples
use tenferro::{jvp, Tensor};
let x = Tensor::from_slice(&[1.0_f64, 2.0], &[2]).unwrap();
let primals = [x];
let tangents = [Some(Tensor::from_slice(&[1.0_f64, 0.0], &[2]).unwrap())];
let result = jvp(
|inputs| Ok(vec![inputs[0].add(&inputs[0]).unwrap().exp().unwrap().sum().unwrap()]),
&primals,
&tangents,
)
.unwrap();
assert_eq!(result.outputs.len(), 1);
assert_eq!(result.output_tangents.len(), 1);Builder .run() execution is configured through set_default_runtime.
The primary public frontend is Tensor, backed by tidu’s
Value<DynTensor> carrier. Custom downstream operations should use
LinearizableOp and LinearizedOp directly; jvp is not a public
dual-builder API and does not imply higher-order forward-mode or HVP
support.
Runtime-dispatched tensor operations such as Tensor::einsum,
Tensor::solve, Tensor::solve_triangular, Tensor::det,
Tensor::inv, Tensor::slogdet, Tensor::cholesky,
Tensor::lstsq, Tensor::lu, Tensor::norm,
Tensor::vector_norm, Tensor::matrix_norm, Tensor::qr,
Tensor::svd, Tensor::eig, Tensor::eigh, Tensor::pinv,
and Tensor::matrix_exp require an installed runtime via
set_default_runtime or runtime::with_runtime.
Re-exports§
pub use runtime::set_default_runtime;pub use runtime::with_default_runtime;
Modules§
Structs§
- AdExecution
Policy - Backward
Options - Cholesky
ExResult - Structured Cholesky result with numerical status information.
- Default
Runtime Guard - Guard returned by
set_default_runtime. - EigResult
- Eigh
Result - Grad
Options - InvEx
Result - Structured inverse result with numerical status information.
- JvpResult
- Lstsq
Result - LuFactor
ExResult - Packed LU factorization result with numerical status information.
- LuFactor
Result - Packed LU factorization result.
- LuResult
- QrResult
- Schema
- Runtime schema for op inputs or outputs.
- Slogdet
Result - Slot
Schema - AD-role metadata for one input or output slot.
- Solve
ExResult - Structured solve result with numerical status information.
- SvdOptions
- Options for truncated SVD.
- SvdResult
- Tensor
- Value
- Public value handle for reverse-mode AD.
Enums§
- Checkpoint
Hint - Public hint used by
crate::LinearizableOp::checkpoint_hintto guide retain-vs-replay policy decisions. - Checkpoint
Mode - Compute
Device - Compute device that can execute tensor operations.
- Error
- Crate-wide error type for dynamic
tenferroAPIs. - Logical
Memory Space - Logical memory space where tensor data resides.
- LuPivot
- Pivoting strategy for LU decomposition.
- Matrix
Norm Ord - Matrix norm order for [
crate::matrix_norm]-style public surfaces. - Memory
Order - Memory ordering for new allocations.
- Norm
Kind - Norm kind for [
crate::norm]. - Runtime
Context - Runtime execution context used by builder
.run()entry points. - Scalar
Type - Runtime scalar type tag used by dynamic tensor wrappers.
- Scalar
Value - Dynamic scalar value extracted from a rank-0 dynamic tensor.
- Vector
Norm Ord - Vector norm order for [
crate::vector_norm]-style public surfaces.
Traits§
Functions§
Type Aliases§
- Result
- Convenience result alias for dynamic
tenferroAPIs.