autograd
20 memberslucid.autogradClasses
no_grad3 methodsContext manager / decorator that disables gradient tracking.
enable_grad3 methodsContext manager / decorator that (re-)enables gradient tracking.
Function3 methodsBase class for custom differentiable operations.
FunctionCtx4 methodsPer-call context shared between Function.forward and
Function.backward.
detect_anomaly4 methodsContext manager / decorator that enables autograd anomaly detection.
RemovableHandle4 methodsHandle returned by lucid.Tensor.register_hook.
Functions
set_grad_enabled→ NoneGlobally set the autograd gradient-tracking flag.
is_grad_enabled→ boolReturn whether autograd gradient tracking is currently enabled.
inference_mode→ Iterator[None]Context manager for inference-time autograd suppression.
backward→ NoneCompute gradients of tensors w.r.t. the leaf variables in their graph.
grad→ tuple[Tensor or None, ...]Compute gradients of outputs w.r.t. inputs, returning them as a tuple.
gradcheck→ bool True if all gradients agree within tolerance.Compare analytical gradients from backward() against finite-difference Jacobians.
gradgradcheck→ boolVerify second-order gradients via finite differences.
is_anomaly_enabled→ boolReturn whether autograd anomaly detection is currently enabled.
set_detect_anomaly→ NoneProgrammatic global toggle for autograd anomaly detection.
jacobian→ Tensor or tuple of TensorCompute the Jacobian matrix of func with respect to each input.
hessian→ Tensor or tuple of tuple of TensorCompute the Hessian matrix of a scalar-valued func.
vjp→ tuple of (Tensor, tuple of (Tensor or None))Vector-Jacobian product (reverse-mode AD).
jvp→ tuple of (Tensor or tuple of Tensor, Tensor or tuple of Tensor)Jacobian-vector product (forward-mode directional derivative).
checkpoint→ TensorRun function under gradient checkpointing.