Open cossio opened 4 years ago
Could we just ignore the do
keyword? Anytime a do-block is used, the user could have provided a defined function instead of an anonymous one. In the case of a defined function, we wouldn't descend into that function's body to detect early returns, so we shouldn't for do-blocks either.
Zygote says:
"Source-to-source" means that Zygote hooks into Julia's compiler, and generates the backwards pass for you – as if you had written it by hand.
Without compromising on performance, Zygote supports the full flexibility and dynamism of the Julia language, including control flow, recursion, closures, structs, dictionaries, and more.
So it seems this should be opened as a Zygote issue?
True, Zygote should support the try/catch handling, but I suggested opening an issue here because the source for ProgressMeter.jl specifically mentions not descending inner function returns.
I am just copying from https://github.com/FluxML/Zygote.jl/issues/668. Not sure if this should be fixed here or in Zygote.
Stacktrace
If I remove the
return
keyword,there is no error.
@darsnack pointed out this line: https://github.com/timholy/ProgressMeter.jl/blob/1aba22127a903f60a034fbb2fecb8ca6f0b499b0/src/ProgressMeter.jl#L522