-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
Support for exception handling #88
Comments
My use case for this is the following:
As noted in the other issue, currently I implement this with this function. I have a macro for checking Ideally, a solution to this should allow replacing the exception with a real value (as if returned by the original function), typically |
Presumably other packages would not be throwing a
You could actually get this behaviour pretty easily with a custom adjoint. I think the macro approach is better myself but I'd nonetheless be happy to give advice on this, maybe on a new thread. |
Thanks for clarifying --- I now understand that the issue is the It also occurred to me that I can just catch outside the AD invocation. |
Just stumbled upon this when trying to replicate the Trebuchet example. It turns out that there try/catch is used, but only thanks to
I think it would be really helpful if at least these get support. |
See #466. It's a bit unfortunate that the logging code dumps so much stuff, but I guess we'd better support it. Also, note that there are several ways around this. You can use |
The easiest way is to assume that
try
blocks are successful, and if acatch
block ever runs we just disable back propagation entirely. Longer term we can do something smarter here, but it generally seems like exceptions should not be too common in people's numerical code.I doubt we'll ever be able to differentiate through thrown exceptions without continuations, or other similar heroics in the compiler. It might be possible to throw a backpropagator + call information somehow, but I haven't thought about it much yet.
The text was updated successfully, but these errors were encountered: