Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Fix context manager not resetting dc mode in case of exception
Browse files Browse the repository at this point in the history
  • Loading branch information
leezu committed Feb 20, 2020
1 parent f35c20e commit 7e23173
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/mxnet/_deferred_compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ def context(state=True):
# other code unexpectedly, when used in concurrent code."
# https://github.com/apache/incubator-mxnet/issues/17495#issuecomment-585461965
val = set_deferred_compute(state)
yield
set_deferred_compute(val)
try:
yield
finally:
set_deferred_compute(val)


def get_symbol(input_arrays, output_arrays, input_names=None, *, sym_cls=Symbol):
Expand Down

0 comments on commit 7e23173

Please sign in to comment.