-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
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
Failure to handle nothing
output from Zygote.jl
#662
Comments
Hi @MilesCranmer, sorry for the delay. I am aware of the issue, it is more or less a duplicate of #604. |
Yeah that sounds good |
Actually maybe I could suggest another workaround – could we have an opt-in setting in the AutoZygote backend that does replace |
Actually a AugoZygote(replace_nothing_with=(x, dx) -> zero(x)) or AutoZygote(replace_nothing_with=(x, dx) -> convert(typeof(x), NaN) so then I have full awareness of this being a potential footgun |
I get where you're coming from but I'm very skeptical about this. A nothing with Zygote denotes a missing rule, and it's not DI's place to go around and tinker with the output of missing rules. Otherwise we'd have to offer the same for every backend: "your function doesn't support dual numbers, do you want me to output NaN instead?". The proper fix for a missing rule will always be the AD backend itself and not DI. |
Wait so does ForwardDiff output 0.0 for missing rules? |
No, that's my point. Missing rules error for ForwardDiff, for Enzyme too, I don't see why we should introduce a special shortcut to zero them out for Zygote only |
Oh I see. I thought ForwardDiff was outputting 0.0 for missing rules. I'm surprised that it covers so many functions! |
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: