pub fn backward(root: &Tensor) -> EtensorResult<Gradients>Expand description
Triggers the backpropagation engine starting from the given root tensor (usually the Loss).
This function:
- Seeds the root tensor’s gradient with
1.0. - Extracts the
thread_local!Tape. - Executes all recorded
TapeActionsin strict reverse order. - Returns the fully populated
Gradientsmap containing all derivatives.