File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 1
1
name = " ChainRulesTestUtils"
2
2
uuid = " cdddcdb0-9152-4a09-a978-84456f9df70a"
3
- version = " 0.7.11 "
3
+ version = " 0.7.12 "
4
4
5
5
[deps ]
6
6
ChainRulesCore = " d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Original file line number Diff line number Diff line change @@ -244,9 +244,14 @@ function test_rrule(
244
244
245
245
check_inferred && _test_inferred (pullback, ȳ)
246
246
ad_cotangents = pullback (ȳ)
247
- ad_cotangents isa Tuple || error (" The pullback must return (∂self, ∂args...), not $∂s ." )
248
- msg = " The pullback should return 1 cotangent for the primal and each primal input."
249
- @test_msg msg length (ad_cotangents) == 1 + length (args)
247
+ @test_msg (
248
+ " The pullback must return a Tuple (∂self, ∂args...)" ,
249
+ ad_cotangents isa Tuple
250
+ )
251
+ @test_msg (
252
+ " The pullback should return 1 cotangent for the primal and each primal input." ,
253
+ (ad_cotangents) == 1 + length (args)
254
+ )
250
255
251
256
# Correctness testing via finite differencing.
252
257
# TODO : remove Nothing when https://github.com/JuliaDiff/ChainRulesTestUtils.jl/issues/113
Original file line number Diff line number Diff line change @@ -548,6 +548,15 @@ struct MySpecialConfig <: RuleConfig{Union{MySpecialTrait}} end
548
548
@test fails (() -> test_frule (foo, 2.1 , 2.1 ))
549
549
@test fails (() -> test_rrule (foo, 21.0 , 32.0 ))
550
550
end
551
+
552
+ @testset " rrule not returning a tuple" begin
553
+ bar (x, y) = x + 3 y
554
+ function ChainRulesCore. rrule (:: typeof (bar), x, y)
555
+ bar_pullback (dy) = dy
556
+ return bar (x,y), bar_pullback
557
+ end
558
+ @test fails (() -> test_rrule (bar, 21.0 , 32.0 ))
559
+ end
551
560
end
552
561
553
562
@testset " structs" begin
You can’t perform that action at this time.
0 commit comments