Skip to content

Commit

Permalink
fix missing parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
nomadbl committed Dec 14, 2023
1 parent c36d81c commit cb53974
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/testers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,10 @@ function _test_cotangent(
end

# we marked the argument as non-differentiable
function _test_cotangent(::NoTangent, ad_cotangent, ::NoTangent; kwargs...)
function _test_cotangent(::NoTangent, ad_cotangent, ::NoTangent, msg=""; kwargs...)
@test ad_cotangent isa NoTangent
end
function _test_cotangent(::NoTangent, ::ZeroTangent, ::NoTangent; kwargs...)
function _test_cotangent(::NoTangent, ::ZeroTangent, ::NoTangent, msg=""; kwargs...)
error(
"The pullback in the rrule should use NoTangent()" *
" rather than ZeroTangent() for non-perturbable arguments."
Expand All @@ -324,7 +324,8 @@ end
function _test_cotangent(
::NoTangent,
ad_cotangent::ChainRulesCore.NotImplemented,
::NoTangent;
::NoTangent,
msg="";
kwargs...,
)
# this situation can occur if a cotangent is not implemented and
Expand All @@ -334,6 +335,6 @@ function _test_cotangent(
# https://github.com/JuliaDiff/ChainRulesTestUtils.jl/issues/217
@test_broken ad_cotangent isa NoTangent
end
function _test_cotangent(::NoTangent, ad_cotangent, fd_cotangent; kwargs...)
function _test_cotangent(::NoTangent, ad_cotangent, fd_cotangent, msg=""; kwargs...)

Check warning on line 338 in src/testers.jl

View check run for this annotation

Codecov / codecov/patch

src/testers.jl#L338

Added line #L338 was not covered by tests
error("cotangent obtained with finite differencing has to be NoTangent()")
end

0 comments on commit cb53974

Please sign in to comment.