anirudh2290 commented on issue #9681: Better Exception Handling for Operators URL: https://github.com/apache/incubator-mxnet/pull/9681#issuecomment-364031160 After discussion with @piiswrong , we came to a conclusion that in an execution graph once an exception is thrown, the same exception should not be thrown again. For example: ``` x = None y = None try: x, y = op1() # Fails x.asnumpy() # Throw exception except: handle_exc(x, y) y.asnumpy() # Should execute fine z = op2(x) # Should execute fine, expectation is that user modified the value of x from garbage, when handling exception ``` You can see that op1 throws an exception and it may end up writing garbage values to x and y. The line x.asnumpy() throws exception. Once this is done, user may handle the exception or keep the garbage values as it is. Any consequent usage of x or op2 should not throw the same exception, since user is not expecting and it is already handled. One challenge during the implementation was that dereferencing exception_ptr in C++ will cause undefined behavior. So there is no way to modify state of the exception_object that exception_ptr points to, just by using exception_ptr itself. To workaround this limitation, we are holding the exception_ptr itself in a shared_ptr object. We decided to remove global_exception thrown in WaitForAll, since it adds unnecessary complexity and is not really used much except during benchmarking.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services