Skip to content

Commit d1ba756

Browse files
committed
statistics.jl autotangent
1 parent dbc8134 commit d1ba756

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed
Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
@testset "mean" begin
22
n = 9
3-
43
@testset "Basic" begin
5-
rrule_test(mean, randn(), (randn(n), randn(n)))
4+
test_rrule(mean, randn(n))
65
end
7-
86
@testset "with dims kwargs" begin
9-
X = randn(n, n+1)
10-
y, mean_pullback = rrule(mean, X; dims=1)
11-
= randn(size(y))
12-
_, dX = mean_pullback(ȳ)
13-
X̄_ad = extern(dX)
14-
X̄_fd = only(j′vp(_fdm, x->mean(x, dims=1), ȳ, X))
15-
@test X̄_ad X̄_fd rtol=1e-9 atol=1e-9
7+
test_rrule(mean, randn(n); fkwargs=(;dims=1))
8+
test_rrule(mean, randn(n,4); fkwargs=(;dims=2))
169
end
1710
end

0 commit comments

Comments
 (0)