diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-10-29 22:33:56 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-10-29 22:33:56 +0100 |
commit | b0b3c461701647d084f6f68160fe7afab406b12d (patch) | |
tree | cc73497f43b11f14774a7490ea0e76ee15ecd2f2 /src/ForwardAD | |
parent | 4acecc1099caefc2bd2fbe252d30d52ead2c74be (diff) |
Store only on tape what's used in the dual
Diffstat (limited to 'src/ForwardAD')
-rw-r--r-- | src/ForwardAD/DualNumbers.hs | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/src/ForwardAD/DualNumbers.hs b/src/ForwardAD/DualNumbers.hs index 4f84e8d..beb93da 100644 --- a/src/ForwardAD/DualNumbers.hs +++ b/src/ForwardAD/DualNumbers.hs @@ -189,24 +189,3 @@ dfwdDN = \case where err_accum = error "Accumulator operations unsupported in the source program" err_monoid = error "Monoid operations unsupported in the source program" - -emap :: Ex (a : env) b -> Ex env (TArr n a) -> Ex env (TArr n b) -emap f arr = - let STArr n t = typeOf arr - in ELet ext arr $ - EBuild ext n (EShape ext (EVar ext (STArr n t) IZ)) $ - ELet ext (EIdx ext (EVar ext (STArr n t) (IS IZ)) - (EVar ext (tTup (sreplicate n tIx)) IZ)) $ - weakenExpr (WCopy (WSink .> WSink)) f - -ezip :: Ex env (TArr n a) -> Ex env (TArr n b) -> Ex env (TArr n (TPair a b)) -ezip a b = - let STArr n t1 = typeOf a - STArr _ t2 = typeOf b - in ELet ext a $ - ELet ext (weakenExpr WSink b) $ - EBuild ext n (EShape ext (EVar ext (STArr n t1) (IS IZ))) $ - EPair ext (EIdx ext (EVar ext (STArr n t1) (IS (IS IZ))) - (EVar ext (tTup (sreplicate n tIx)) IZ)) - (EIdx ext (EVar ext (STArr n t2) (IS IZ)) - (EVar ext (tTup (sreplicate n tIx)) IZ)) |