MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
autodiff_zero.cpp
Go to the documentation of this file.
2
3#include <iostream>
4
5#include <mim/lam.h>
6
10#include "mim/plug/mem/mem.h"
11
12namespace mim::plug::autodiff {
13
15 if (auto zero_app = match<zero>(def); zero_app) {
16 // callee = zero
17 // arg = type T
18 auto T = zero_app->arg();
19 world().DLOG("found a autodiff::zero of {}", T);
20 auto zero = zero_def(T);
21 if (zero) return zero;
22 return def;
23 }
24
25 return def;
26}
27
28} // namespace mim::plug::autodiff
World & world()
Definition pass.h:296
Helper class to retrieve Infer::arg if present.
Definition def.h:86
The automatic differentiation Plugin
Definition autodiff.h:6
const Def * zero_def(const Def *T)
Definition autodiff.cpp:140
auto match(Ref def)
Definition axiom.h:112