Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 1.18 KB

internals.md

File metadata and controls

27 lines (21 loc) · 1.18 KB

The std::autodiff module in Rust allows differentiable programming:

#![feature(autodiff)]
use std::autodiff::autodiff;

// f(x) = x * x, f'(x) = 2.0 * x
// bar therefore returns (x * x, 2.0 * x)
#[autodiff(bar, Reverse, Active, Active)]
fn foo(x: f32) -> f32 { x * x }

fn main() {
    assert_eq!(bar(3.0, 1.0), (9.0, 6.0));
    assert_eq!(bar(4.0, 1.0), (16.0, 8.0));
}

The detailed documentation for the std::autodiff module is available at std::autodiff.

Differentiable programing is used in various fields like numerical computing, solid mechanics, computational chemistry, fluid dynamics or for Neural Network training via Backpropagation, ODE solver, differentiable rendering, quantum computing, and climate simulations.