We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 25ca9ee commit c849ad8Copy full SHA for c849ad8
test/rulesets/Base/mapreduce.jl
@@ -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
+
5
@testset "Maps and Reductions" begin
6
@testset "sum(x; dims=$dims)" for dims in (:, 2, (1,3))
7
# Forward
@@ -94,10 +98,8 @@
94
98
@testset "sum(xs, weights) (#522)" begin
95
99
xs = rand(5)
96
100
weights = rand(5)
97
- Base.sum(xs::AbstractArray, weights::AbstractArray) = dot(xs, weights)
- struct MyRuleConfig <: RuleConfig{Union{HasReverseMode}} end
101
- @test rrule(MyRuleConfig(), Base.sum, xs, weights) isa Nothing
102
+ @test rrule(SumRuleConfig(), Base.sum, xs, weights) isa Nothing
103
end
104
105
@testset "prod" begin
0 commit comments