Open sschlenkrich opened 1 month ago
We might have to add a custom ChainRule, since I can't eliminate the new try
–catch
without eliminating thread-safety. For now, maybe you could just do
using ChainRulesCore
@non_differentiable QuadGK.cachedrule(Any...)
to prevent Zygote from trying to differentiate through that function (which in fact is not differentiable, nor is it necessary for the derivative, so Zygote is just wasting effort with it).
You could also use QuadGK via Integrals.jl, which has custom chain rules already.
(It would be good for us to add a custom ChainRule anyway, since the new eval_segbuf
feature allows us to evaluate derivatives much more accurately and efficiently than was previously possible.)
Thansks a lot for quick response!
Your suggestion with flagging the problematic function as non-differentiable works for me.
Re-opening because this should ideally be fixed in QuadGK.
Hi,
I maintain a Julia package for Monte Carlo simulation in the finance domain. We use QuadGK in conjunction with Zygote.
The new QuadGK 2.11 seems to cause the following error: Compiling Tuple{typeof(QuadGK.cachedrule), Type{Float64}, Int64}: try/catch is not supported. See also
https://github.com/frame-consulting/DiffFusion.jl/actions/runs/10649757211/job/29520331450
It all worked well with earlier versions of QuadGK.
Any chance you could have a look and fix it?