Skip to content

Commit 54fcbed

Browse files
committed
Tweak tests to match wrt. natural tangents
1 parent 81736ce commit 54fcbed

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

test/projection.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ struct NoSuperType end
212212
@test ProjectTo(I)(123) === NoTangent()
213213
@test ProjectTo(2 * I)(I * 3im) === 0.0 * I
214214
@test ProjectTo((4 + 5im) * I)(Tangent{typeof(im * I)}(; λ = 6)) === (6.0 + 0.0im) * I
215-
@test ProjectTo(7 * I)(Tangent{typeof(2I)}()) == ZeroTangent()
215+
@test ProjectTo(7 * I)(Tangent{typeof(2I)}()) == 0.0I
216216
end
217217

218218
@testset "LinearAlgebra: $adj vectors" for adj in [transpose, adjoint]
@@ -413,7 +413,6 @@ struct NoSuperType end
413413
@test pb(ZeroTangent()) isa AbstractZero # was a method ambiguity!
414414

415415
# all projectors preserve Zero, and specific type, via one fallback method:
416-
@test ProjectTo(pi)(ZeroTangent()) === ZeroTangent()
417416
@test ProjectTo(pi)(NoTangent()) === NoTangent()
418417
pv = ProjectTo(sprand(30, 0.3))
419418
@test pv(ZeroTangent()) === ZeroTangent()

test/rules.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ _second(t) = Base.tuple_type_head(Base.tuple_type_tail(t))
9494
frx, nice_pushforward = frule((dself, 1), nice, 1)
9595
@test nice_pushforward === ZeroTangent()
9696
rrx, nice_pullback = rrule(nice, 1)
97-
@test (NoTangent(), ZeroTangent()) === nice_pullback(1)
97+
@test (NoTangent(), 0.0) === nice_pullback(1)
9898

9999
# Test that these run. Do not care about numerical correctness.
100100
@test frule((nothing, 1.0, 1.0, 1.0), varargs_function, 0.5, 0.5, 0.5) == (1.5, 3.0)

0 commit comments

Comments
 (0)