11
22using 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, unzip∘ map, unzip∘ broadcast] # 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 == unzip∘ map
19+
20+ if fun == unzip∘ map
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