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
14const Def* AutoDiffZero::rewrite(const Def* def) {
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
Base class for all Defs.
Definition def.h:198
World & world()
Definition pass.h:296
const Def * rewrite(const Def *) override
The automatic differentiation Plugin
Definition autodiff.h:6
const Def * zero_def(const Def *T)
Definition autodiff.cpp:140
auto match(const Def *def)
Definition axiom.h:112