16 if (
auto i = augmented.find(def); i != augmented.end())
return i->second;
17 augmented[def] =
augment_(def, f, f_diff);
18 return augmented[def];
22 if (
auto i = derived.find(def); i != derived.end())
return i->second;
28 if (
auto ad_app =
match<ad>(def); ad_app) {
32 auto arg = ad_app->arg();
33 world().DLOG(
"found a autodiff::autodiff of {}", arg);
39 assert(0 &&
"not implemented");
Helper class to retrieve Infer::arg if present.
Ref derive_(Ref)
Additionally to the derivation, the pullback is registered and the maps are initialized.
Ref augment_(Ref, Lam *, Lam *)
Rewrites the given definition in a lambda environment.
Ref augment(Ref, Lam *, Lam *)
Applies to (open) expressions in a functional context.
Ref rewrite(Ref) override
Detect autodiff calls.
Ref derive(Ref)
Acts on toplevel autodiff on closed terms:
The automatic differentiation Plugin