0 purchases
autodiff dart
autodiff_dart #
automatic differentiation library for Dart!
inspired by Karpathy's micrograd, I thought that building this would be a good experience for me to learn dart, and deepen my understanding of backpropagation.
This started as a toy project to get to learn dart, and how automatic differentiation works behind the scenes in neural networks.
But I do think that this could actually be useful in a calculator application. autodiff_dart could be used to implement derivative functionality in that context.
Simple Example #
import 'package:autodiff_dart/value.dart';
void main() {
// y = mx + b
var m = Value(3);
var x = Value(4);
var b = Value(5);
var y = m * x + b;
// compute dy/dx
y.backward();
// print gradients
print("$m\n$x\n$b");
}
copied to clipboard
output:
Value Object{value: 3, op: null, grad: 4}
Value Object{value: 4, op: null, grad: 3}
Value Object{value: 5, op: null, grad: 1}
copied to clipboard
Installation #
dart pub add autodiff_dart
Contributing #
PR's welcome!
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.