Thanks for using Compiler Explorer
C
C++
LLVM IR
Julia
MLIR
CUDA C++
Rust
CMake
rust source #1
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
rustc nightly
Options
Source code
#![feature(autodiff)] use std::autodiff::autodiff; // See https://enzyme.mit.edu/index.fcgi/rust/usage/usage.html // for more details #[autodiff(dsquare, Reverse, Active, Active)] pub fn square(num: f32) -> f32 { num * num } fn main(){ for i in 0..5 { // This also returns the derivative of square, 2 * x dbg!(dsquare(i as f32, 1.0)); } }
Become a Patron
Sponsor on GitHub
Donate via PayPal
Source on GitHub
Mailing list
Installed libraries
Wiki
Report an issue
How it works
Contact the author
CE on Mastodon
CE on Bluesky
About the author
Statistics
Changelog
Version tree