Thorin 1.9.0
The Higher ORder INtermediate representation
Loading...
Searching...
No Matches
autodiff_zero.cpp
Go to the documentation of this file.
2
3#include <iostream>
4
5#include <thorin/lam.h>
6
10#include "thorin/plug/mem/mem.h"
11
12namespace thorin::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 thorin::plug::autodiff
World & world()
Definition pass.h:296
Helper class to retrieve Infer::arg if present.
Definition def.h:87
The automatic differentiation Plugin
Definition autodiff.h:7
const Def * zero_def(const Def *T)
Definition autodiff.cpp:140