Skip to content

Commit

Permalink
Merge 71f7884 into 3e6eee3
Browse files Browse the repository at this point in the history
  • Loading branch information
oxinabox committed Dec 23, 2019
2 parents 3e6eee3 + 71f7884 commit 4a8ceee
Showing 1 changed file with 6 additions and 25 deletions.
31 changes: 6 additions & 25 deletions test/rulesets/Base/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,13 @@
test_scalar(acscd, 1/x)
test_scalar(acotd, 1/x)
end
@testset "Multivariate" begin
@testset "atan2" begin
# https://en.wikipedia.org/wiki/Atan2
x, y = rand(2)
ratan = atan(x, y)
u = x^2 + y^2
datan = y/u - 2x/u

r, pushforward = frule(atan, x, y)
@test r === ratan
@test pushforward(NamedTuple(), 1, 2) === datan

r, pullback = rrule(atan, x, y)
@test r === ratan
dself, df1, df2 = pullback(1)
@test dself == NO_FIELDS
@test df1 + 2df2 === datan
end

@testset "sincos" begin
x, Δx, x̄ = randn(3)
Δz = (randn(), randn())

@testset "sincos" begin
x, Δx, x̄ = randn(3)
Δz = (randn(), randn())

frule_test(sincos, (x, Δx))
rrule_test(sincos, Δz, (x, x̄))
end
frule_test(sincos, (x, Δx))
rrule_test(sincos, Δz, (x, x̄))
end
end # Trig

Expand Down

0 comments on commit 4a8ceee

Please sign in to comment.