Skip to content

Commit f62a756

Browse files
committed
test bugs
1 parent 474fbf2 commit f62a756

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/rulesets/Base/broadcast.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,13 @@ end
393393

394394
function rrule(cfg::RCR, ::typeof(copybroadcasted), f_args...)
395395
tmp = rrule(cfg, broadcasted, f_args...)
396-
isnothing(tmp) && throw("rrule gave nothing")
396+
isnothing(tmp) && return nothing
397397
y, back = tmp
398398
return _maybe_copy(y), back
399399
end
400400
function rrule(::typeof(copybroadcasted), f_args...)
401401
tmp = rrule(broadcasted, f_args...)
402-
isnothing(tmp) && throw("rrule gave nothing")
402+
isnothing(tmp) && return nothing
403403
y, back = tmp
404404
return _maybe_copy(y), back
405405
end

test/unzipped.jl

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
using ChainRules: unzip_broadcast, unzip #, unzip_map
33

4-
@testset "unzip_broadcast.jl" begin
4+
@testset "unzipped.jl" begin
55
@testset "basics: $(sprint(show, fun))" for fun in [unzip_broadcast, unzipmap, unzipbroadcast] # unzip_map,
66
@test_throws Exception fun(sqrt, 1:3)
77

@@ -16,10 +16,8 @@ using ChainRules: unzip_broadcast, unzip #, unzip_map
1616
else
1717
@test fun(tuple, [1,2,3], [4 5]) == ([1 1; 2 2; 3 3], [4 5; 4 5; 4 5])
1818
end
19-
20-
if fun == unzip_map
21-
@test_broken fun(tuple, (1,2,3), (4,5,6)) == ((1, 2, 3), (4, 5, 6))
22-
elseif fun == unzipmap
19+
20+
if fun == unzipmap
2321
@test fun(tuple, (1,2,3), (4,5,6)) == ((1, 2, 3), (4, 5, 6))
2422
else
2523
@test fun(tuple, (1,2,3), (4,5,6)) == ((1, 2, 3), (4, 5, 6))
@@ -44,9 +42,9 @@ using ChainRules: unzip_broadcast, unzip #, unzip_map
4442
@test y2 == ([1 1; 2 2; 3 3], [4 5; 4 5; 4 5], [6 6; 6 6; 6 6])
4543
@test bk2(y2)[5] 36
4644

47-
y4, bk4 = rrule(CFG, unzip_map, tuple, [1,2,3.0], [4,5,6.0])
48-
@test y4 == ([1, 2, 3], [4, 5, 6])
49-
@test bk4(([1,10,100.0], [7,8,9.0]))[3] [1,10,100]
45+
# y4, bk4 = rrule(CFG, unzip_map, tuple, [1,2,3.0], [4,5,6.0])
46+
# @test y4 == ([1, 2, 3], [4, 5, 6])
47+
# @test bk4(([1,10,100.0], [7,8,9.0]))[3] ≈ [1,10,100]
5048
end
5149

5250
@testset "unzip" begin

0 commit comments

Comments
 (0)