Skip to content

Commit

Permalink
Remove threes
Browse files Browse the repository at this point in the history
  • Loading branch information
gdalle committed May 13, 2024
1 parent 28828c9 commit 252d5b4
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions DifferentiationInterfaceTest/src/tests/correctness.jl
Original file line number Diff line number Diff line change
Expand Up @@ -227,22 +227,16 @@ function test_correctness(

dx2 = pullback(f, ba, x, dy, extras)

y3, pullbackfunc = value_and_pullback_split(f, ba, x, extras)
pullbackfunc(dy) # call once in case the second errors
dx3 = pullbackfunc(dy)

let ()(x, y) = isapprox(x, y; atol, rtol)
@testset "Extras type" begin
@test extras isa PullbackExtras
end
@testset "Primal value" begin
@test y1 y
@test y3 y
end
@testset "Cotangent value" begin
@test dx1 dx_true
@test dx2 dx_true
@test dx3 dx_true
end
end
end
Expand Down Expand Up @@ -278,26 +272,18 @@ function test_correctness(
dx2_in = mysimilar(x)
dx2 = pullback!(f, dx2_in, ba, x, dy, extras)

y3, pullbackfunc! = value_and_pullback!_split(f, ba, x, extras)
pullbackfunc!(mysimilar(x), dy) # call once in case the second errors
dx3_in = mysimilar(x)
dx3 = pullbackfunc!(dx3_in, dy)

let ()(x, y) = isapprox(x, y; atol, rtol)
@testset "Extras type" begin
@test extras isa PullbackExtras
end
@testset "Primal value" begin
@test y1 y
@test y3 y
end
@testset "Cotangent value" begin
@test dx1_in dx_true
@test dx1 dx_true
@test dx2_in dx_true
@test dx2 dx_true
@test dx3_in dx_true
@test dx3 dx_true
end
end
end
Expand Down Expand Up @@ -334,26 +320,17 @@ function test_correctness(
y2_in = mysimilar(y)
dx2 = pullback(f!, y2_in, ba, x, dy, extras)

y3_in = mysimilar(y)
y3, pullbackfunc = value_and_pullback_split(f!, y3_in, ba, x, extras)
pullbackfunc(mysimilar(y), dy) # call once in case the second errors
y3_in2 = mysimilar(y)
dx3 = pullbackfunc(y3_in2, dy)

let ()(x, y) = isapprox(x, y; atol, rtol)
@testset "Extras type" begin
@test extras isa PullbackExtras
end
@testset "Primal value" begin
@test y1_in y
@test y1 y
@test y3_in y
@test y3 y
end
@testset "Cotangent value" begin
@test dx1 dx_true
@test dx2 dx_true
@test dx3 dx_true
end
end
end
Expand Down Expand Up @@ -390,29 +367,19 @@ function test_correctness(
y2_in, dx2_in = mysimilar(y), mysimilar(x)
dx2 = pullback!(f!, y2_in, dx2_in, ba, x, dy, extras)

y3_in = mysimilar(y)
y3, pullbackfunc! = value_and_pullback!_split(f!, y3_in, ba, x, extras)
pullbackfunc!(mysimilar(y), mysimilar(x), dy) # call once in case the second errors
y3_in2, dx3_in = mysimilar(y), mysimilar(x)
dx3 = pullbackfunc!(y3_in2, dx3_in, dy)

let ()(x, y) = isapprox(x, y; atol, rtol)
@testset "Extras type" begin
@test extras isa PullbackExtras
end
@testset "Primal value" begin
@test y1_in y
@test y1 y
@test y3_in y
@test y3 y
end
@testset "Cotangent value" begin
@test dx1_in dx_true
@test dx1 dx_true
@test dx2_in dx_true
@test dx2 dx_true
@test dx3_in dx_true
@test dx3 dx_true
end
end
end
Expand Down

0 comments on commit 252d5b4

Please sign in to comment.