Skip to content

Commit c849ad8

Browse files
author
Miha Zgubic
committed
fix tests 2
1 parent 25ca9ee commit c849ad8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/rulesets/Base/mapreduce.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# for sum(xs, weights) (#522)
2+
Base.sum(xs::AbstractArray, weights::AbstractArray) = dot(xs, weights)
3+
struct SumRuleConfig <: RuleConfig{Union{HasReverseMode}} end
4+
15
@testset "Maps and Reductions" begin
26
@testset "sum(x; dims=$dims)" for dims in (:, 2, (1,3))
37
# Forward
@@ -94,10 +98,8 @@
9498
@testset "sum(xs, weights) (#522)" begin
9599
xs = rand(5)
96100
weights = rand(5)
97-
Base.sum(xs::AbstractArray, weights::AbstractArray) = dot(xs, weights)
98-
struct MyRuleConfig <: RuleConfig{Union{HasReverseMode}} end
99101

100-
@test rrule(MyRuleConfig(), Base.sum, xs, weights) isa Nothing
102+
@test rrule(SumRuleConfig(), Base.sum, xs, weights) isa Nothing
101103
end
102104

103105
@testset "prod" begin

0 commit comments

Comments
 (0)