File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change 127
127
# N.B: This means the gradient is not available for zero-arg function, but such
128
128
# a gradient would be guaranteed to be `()`, which is a bit of a useless thing
129
129
function (:: Type{∇} )(f, x1, args... )
130
- ∇ (f)(x1, args... )
130
+ unthunk .( ∇ (f)(x1, args... ) )
131
131
end
132
132
133
133
const gradient = ∇
@@ -159,7 +159,7 @@ function (f::PrimeDerivativeBack)(x)
159
159
z = ∂⃖¹ (lower_pd (f), x)
160
160
y = getfield (z, 1 )
161
161
f☆ = getfield (z, 2 )
162
- return getfield (f☆ (dx (y)), 2 )
162
+ return unthunk ( getfield (f☆ (dx (y)), 2 ) )
163
163
end
164
164
165
165
# Forwards primal derivative
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ let var"'" = Diffractor.PrimeDerivativeBack
108
108
# Control flow cases
109
109
@test @inferred ((x-> simple_control_flow (true , x))' (1.0 )) == sin' (1.0 )
110
110
@test @inferred ((x-> simple_control_flow (false , x))' (1.0 )) == cos' (1.0 )
111
- @test_broken (x-> sum (isa_control_flow (Matrix{Float64}, x)))' (Float32[1 2 ;]) == [1.0 1.0 ;]
111
+ @test (x-> sum (isa_control_flow (Matrix{Float64}, x)))' (Float32[1 2 ;]) == [1.0 1.0 ;]
112
112
@test times_three_while' (1.0 ) == 3.0
113
113
114
114
pow5p (x) = (x-> mypow (x, 5 ))' (x)
You can’t perform that action at this time.
0 commit comments