Skip to content

Commit 113455f

Browse files
Miha Zgubicoxinabox
authored andcommitted
remove using nothing to mean nondifferentiable
1 parent 6a1d704 commit 113455f

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

src/testers.jl

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,8 @@ function test_frule(
136136
Ω = call_on_copy(primals...)
137137
test_approx(Ω_ad, Ω; isapprox_kwargs...)
138138

139-
# TODO: remove Nothing when https://github.com/JuliaDiff/ChainRulesTestUtils.jl/issues/113
140-
is_ignored = isa.(tangents, Union{Nothing,NoTangent})
141-
if any(tangents .== nothing)
142-
Base.depwarn(
143-
"test_frule(f, k ⊢ nothing) is deprecated, use " *
144-
"test_frule(f, k ⊢ NoTangent()) instead for non-differentiable ks",
145-
:test_frule,
146-
)
147-
end
148-
149139
# Correctness testing via finite differencing.
140+
is_ignored = isa.(tangents, NoTangent)
150141
dΩ_fd = _make_jvp_call(fdm, call_on_copy, Ω, primals, tangents, is_ignored)
151142
test_approx(dΩ_ad, dΩ_fd; isapprox_kwargs...)
152143

@@ -254,22 +245,13 @@ function test_rrule(
254245
)
255246

256247
# Correctness testing via finite differencing.
257-
# TODO: remove Nothing when https://github.com/JuliaDiff/ChainRulesTestUtils.jl/issues/113
258-
is_ignored = isa.(accum_cotangents, Union{Nothing, NoTangent})
259-
if any(accum_cotangents .== nothing)
260-
Base.depwarn(
261-
"test_rrule(f, k ⊢ nothing) is deprecated, use " *
262-
"test_rrule(f, k ⊢ NoTangent()) instead for non-differentiable ks",
263-
:test_rrule,
264-
)
265-
end
266-
248+
is_ignored = isa.(accum_cotangents, NoTangent)
267249
fd_cotangents = _make_j′vp_call(fdm, call, ȳ, primals, is_ignored)
268250

269251
for (accum_cotangent, ad_cotangent, fd_cotangent) in zip(
270252
accum_cotangents, ad_cotangents, fd_cotangents
271253
)
272-
if accum_cotangent isa Union{Nothing,NoTangent} # then we marked this argument as not differentiable # TODO remove once #113
254+
if accum_cotangent isa NoTangent # then we marked this argument as not differentiable
273255
@assert fd_cotangent === nothing # this is how `_make_j′vp_call` works
274256
ad_cotangent isa ZeroTangent && error(
275257
"The pullback in the rrule should use NoTangent()" *

0 commit comments

Comments
 (0)