Skip to content

jay-j/odin-autodiff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Odin AutoDiff

A basic library for automatic differentiation in Odin.

This implements Forward Accumulation by storing a list of operations (including derivatives) that get re-executed to calculate the effect of varying one (or more) inputs on the system.

The basic building block is a Var, which is an arbitray-length vector (including 1) representing constants, inputs, intermediate values, and outputs. Var are related by Op (operations), such as add(). The lists of Vars, Ops, and backing memory are bundled in a Graph

Usage

graph : ^Graph = graph_init()
x : Var = var_copy(graph, []f64{3}, "x")
y : Var = var_copy(graph, []f64{4}, "y")

z : Var = mult(x, y, "z")

uncertainty_collect(graph, targets = []Var{z}, knobs = []Var{x,y})

There are more examples in the code!

About

Basic automatic differentiation in Odin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published