Skip to content

Commit 3e45c31

Browse files
author
Michael Abbott
committed
unrelated, start adding an option to turn CSE off
1 parent 14cddf0 commit 3e45c31

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/symbolic.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
using DiffRules
55

6+
const _CSE = Ref(true)
7+
68
function insert_symbolic_gradient(axislist, store)
79

810
dZ = Symbol(DEL, ZED)
@@ -50,7 +52,7 @@ function insert_symbolic_gradient(axislist, store)
5052
end
5153
end
5254
store.verbose>0 && @info "symbolic gradients" inbody
53-
ex_body = commonsubex(quote $(inbody...) end)
55+
ex_body = _CSE[] ? commonsubex(quote $(inbody...) end) : quote $(inbody...) end
5456

5557
ex_pre, ex_post = if store.redfun == :* # then nonzero LHS are handled already, but harder cases here:
5658
product_grad(prebody, store)

0 commit comments

Comments
 (0)