anirudh2290 commented on issue #9681: Better Exception Handling for Operators
URL: https://github.com/apache/incubator-mxnet/pull/9681#issuecomment-363523771
 
 
   ```
   try:
         x, y, z = op()
         x.asnumpy()
   except:
         handle_exc()
   
   '''
   The below just pushes operation to the engine, no guarantee that op2 is 
executed (ExecuteOprBlock may not be called)
   '''
   y = op2(y)
   y.asnumpy() # Guarantees that all the operations that are writing to y are 
executed
   ```
   @KellenSunderland As you mentioned since it is a lazy operation, there is no 
guarantee that operation is executed, just that it is pushed to the engine. So, 
there is no guarantee that ExecuteOprBlock is called for the operator. On the 
other hand, it is guaranteed that all operations which write to a particular 
variable are executed when the blocking call on that variable is made. 
Therefore, I have rethrown exceptions in WaitForVar and WaitForAll. I 
understand that this may not be as intuitive to users as throwing on the 
`y=op2(y)` line itself, but I don't think it is possible to rethrow when it is 
pushed to engine.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to