You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
julia>using Zygote
julia>functionf(x)
@info x
2* x
end
f (generic function with 1 method)
julia> f'(1.0)
[ Info:1.0
ERROR: Compiling Tuple{typeof(f),Float64}:try/catch is not supported.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] instrument(::IRTools.Inner.IR) at /Users/kai/.julia/packages/Zygote/9Mec5/src/compiler/reverse.jl:88
[3] #Primal#6 at /Users/kai/.julia/packages/Zygote/9Mec5/src/compiler/reverse.jl:158 [inlined]
[4] Type at ./none:0 [inlined]
[5] #Adjoint#22(::Nothing, ::Bool, ::Type{Zygote.Adjoint}, ::IRTools.Inner.IR) at /Users/kai/.julia/packages/Zygote/9Mec5/src/compiler/reverse.jl:271
[6] (::getfield(Core, Symbol("#kw#Type")))(::NamedTuple{(:varargs, :normalise),Tuple{Nothing,Bool}}, ::Type{Zygote.Adjoint}, ::IRTools.Inner.IR) at ./none:0
[7] _lookup_grad(::Type) at /Users/kai/.julia/packages/Zygote/9Mec5/src/compiler/emit.jl:101
[8] #s2641#1468 at /Users/kai/.julia/packages/Zygote/9Mec5/src/compiler/interface2.jl:21 [inlined]
[9] #s2641#1468(::Any, ::Any, ::Any) at ./none:0
[10] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any,N}where N) at ./boot.jl:524
[11] (::getfield(Zygote, Symbol("##28#29")){typeof(∂(f))})(::Float64) at /Users/kai/.julia/packages/Zygote/9Mec5/src/compiler/interface.jl:38
[12] gradient at /Users/kai/.julia/packages/Zygote/9Mec5/src/compiler/interface.jl:47 [inlined]
[13] (::getfield(Zygote, Symbol("##30#31")){typeof(f)})(::Float64) at /Users/kai/.julia/packages/Zygote/9Mec5/src/compiler/interface.jl:50
[14] top-level scope at REPL[3]:1
The text was updated successfully, but these errors were encountered:
This is hard because it immediately expands into try/catch, so we can't just nograd it.
One option is to split out a new function containing the @info and @nograd that. Another is to just fix exception support in Zygote, which we're probably past due on.
One option is to split out a new function containing the @info and @Nograd that. Another is to just fix exception support in Zygote, which we're probably past due on.
This is my current hack. Just a bit annoying one has to do this when using e.g. TensorBoardLogger as one of the advantage is you can simply do @info...
MWE
The text was updated successfully, but these errors were encountered: