Skip to content

Commit d329ed8

Browse files
committed
Revert "Eagerly evaluate scalers rules"
This reverts commit dbe7765.
1 parent cf2bc6e commit d329ed8

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/differential_arithmetic.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,11 @@ end
5757
Base.:+(a::AbstractThunk, b::AbstractThunk) = unthunk(a) + unthunk(b)
5858
Base.:*(a::AbstractThunk, b::AbstractThunk) = unthunk(a) * unthunk(b)
5959
for T in (:Any,)
60-
# we want to eagerly compute the result when thunk meets other types
61-
@eval Base.:+(a::AbstractThunk, b::$T) = extern(a) + b
62-
@eval Base.:+(a::$T, b::AbstractThunk) = a + extern(b)
60+
@eval Base.:+(a::AbstractThunk, b::$T) = unthunk(a) + b
61+
@eval Base.:+(a::$T, b::AbstractThunk) = a + unthunk(b)
6362

64-
@eval Base.:*(a::AbstractThunk, b::$T) = extern(a) * b
65-
@eval Base.:*(a::$T, b::AbstractThunk) = a * extern(b)
63+
@eval Base.:*(a::AbstractThunk, b::$T) = unthunk(a) * b
64+
@eval Base.:*(a::$T, b::AbstractThunk) = a * unthunk(b)
6665
end
6766

6867
################## Composite ##############################################################

src/rule_definition_tools.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,7 @@ function propagation_expr(Δs, ∂s)
209209
# This is basically Δs ⋅ ∂s
210210
∂s = map(esc, ∂s)
211211

212-
# this is neccssary since we want to eagerly evaluate the result
213-
∂_mul_Δs = [:(@thunk($(∂s[i])) * $(Δs[i])) for i in 1:length(∂s)]
212+
∂_mul_Δs = ntuple(i->:($(∂s[i]) * $(Δs[i])), length(∂s))
214213
return :(+($(∂_mul_Δs...)))
215214
end
216215

0 commit comments

Comments
 (0)