Skip to content

Commit c2937fc

Browse files
committed
tests
1 parent 0c46cfe commit c2937fc

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/compiler/chainrules.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ The two-argument `_project(x, dx)` applies this immediately.
158158
# Solve some ambiguity:
159159
(::ProjectTo{ChainRulesCore.NoTangent})(::ChainRulesCore.AbstractZero) = NoTangent()
160160

161+
# some splat?
162+
(project::ProjectTo{AbstractArray})(dx::ChainRulesCore.Tangent{<:Any, <:Tuple}) = project(collect(ChainRulesCore.backing(dx)))
163+
161164
"""
162165
ZBack{F}(back) <: Function
163166

test/gradcheck.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,10 @@ end
332332
@test gradient(x -> sum(log, filter(iseven, x)), 1:10) ==
333333
(map(x -> iseven(x) ? 1/x : 0, 1:10),)
334334
@test gradient(x -> sum(abs2, im .+ filter(iseven, x)), 1:10) ==
335-
(map(x -> iseven(x) ? 2x+2im : 0, 1:10),)
335+
(map(x -> iseven(x) ? 2x : 0, 1:10),)
336+
# (map(x -> iseven(x) ? 2x+2im : 0, 1:10),)
336337
end
337338

338-
339339
@testset "mean" begin
340340
@test gradtest(mean, rand(2, 3))
341341

0 commit comments

Comments
 (0)