We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nothing
julia> using Zygote, DifferentiationInterface julia> safe_log(x) = x > zero(x) ? log(x) : convert(typeof(x), NaN) safe_log (generic function with 1 method) julia> derivative(safe_log, AutoZygote(), 0.0) ERROR: MethodError: no method matching iterate(::Nothing) The function `iterate` exists, but no method is defined for this combination of argument types. Closest candidates are: iterate(::Combinatorics.Combinations) @ Combinatorics ~/.julia/packages/Combinatorics/Udg6X/src/combinations.jl:13 iterate(::Combinatorics.Combinations, ::Any) @ Combinatorics ~/.julia/packages/Combinatorics/Udg6X/src/combinations.jl:13 iterate(::Tables.DictRowTable) @ Tables ~/.julia/packages/Tables/8p03y/src/dicts.jl:122 ... Stacktrace: [1] dot(x::Float64, y::Nothing) @ LinearAlgebra ~/.julia/juliaup/julia-1.11.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/LinearAlgebra/src/generic.jl:855 [2] @ DifferentiationInterface ~/.julia/packages/DifferentiationInterface/gjT8p/src/first_order/pushforward.jl:161 [3] #6 @ ~/.julia/packages/DifferentiationInterface/gjT8p/src/first_order/pushforward.jl:192 [inlined] [4] ntuple @ ./ntuple.jl:48 [inlined] [5] value_and_pushforward @ ~/.julia/packages/DifferentiationInterface/gjT8p/src/first_order/pushforward.jl:191 [inlined] [6] pushforward @ ~/.julia/packages/DifferentiationInterface/gjT8p/src/first_order/pushforward.jl:220 [inlined] [7] derivative @ ~/.julia/packages/DifferentiationInterface/gjT8p/src/first_order/derivative.jl:124 [inlined] [8] derivative(::typeof(safe_log), ::AutoZygote, ::Float64) @ DifferentiationInterface ~/.julia/packages/DifferentiationInterface/gjT8p/src/fallbacks/no_prep.jl:49 [9] top-level scope @ REPL[13]:1 Some type information was truncated. Use `show(err)` to see complete types.
Zygote.jl returns a nothing given an invalid input, so I think this should be correctly handled. Returning a NaN seems like an option?
NaN
For AutoForwardDiff, this gives us:
AutoForwardDiff
julia> derivative(safe_log, AutoForwardDiff(), 0.0) 0.0
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Zygote.jl returns a
nothing
given an invalid input, so I think this should be correctly handled. Returning aNaN
seems like an option?For
AutoForwardDiff
, this gives us:The text was updated successfully, but these errors were encountered: