Crate tenferro

Crate tenferro 

Source
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§

error
jvp
runtime
snapshot

Structs§

AdExecutionPolicy
BackwardOptions
CholeskyExResult
Structured Cholesky result with numerical status information.
DefaultRuntimeGuard
Guard returned by set_default_runtime.
EigResult
EighResult
GradOptions
InvExResult
Structured inverse result with numerical status information.
JvpResult
LstsqResult
LuFactorExResult
Packed LU factorization result with numerical status information.
LuFactorResult
Packed LU factorization result.
LuResult
QrResult
Schema
Runtime schema for op inputs or outputs.
SlogdetResult
SlotSchema
AD-role metadata for one input or output slot.
SolveExResult
Structured solve result with numerical status information.
SvdOptions
Options for truncated SVD.
SvdResult
Tensor
Value
Public value handle for reverse-mode AD.

Enums§

CheckpointHint
Public hint used by crate::LinearizableOp::checkpoint_hint to guide retain-vs-replay policy decisions.
CheckpointMode
ComputeDevice
Compute device that can execute tensor operations.
Error
Crate-wide error type for dynamic tenferro APIs.
LogicalMemorySpace
Logical memory space where tensor data resides.
LuPivot
Pivoting strategy for LU decomposition.
MatrixNormOrd
Matrix norm order for [crate::matrix_norm]-style public surfaces.
MemoryOrder
Memory ordering for new allocations.
NormKind
Norm kind for [crate::norm].
RuntimeContext
Runtime execution context used by builder .run() entry points.
ScalarType
Runtime scalar type tag used by dynamic tensor wrappers.
ScalarValue
Dynamic scalar value extracted from a rank-0 dynamic tensor.
VectorNormOrd
Vector norm order for [crate::vector_norm]-style public surfaces.

Traits§

LinearizableOp
LinearizedOp

Functions§

backward
grad
jvp
with_ad_policy

Type Aliases§

Result
Convenience result alias for dynamic tenferro APIs.