hzfan commented on a change in pull request #17749: Fix races in block scope
URL: https://github.com/apache/incubator-mxnet/pull/17749#discussion_r388115055
 
 

 ##########
 File path: python/mxnet/gluon/block.py
 ##########
 @@ -48,8 +48,9 @@ class _BlockScope(object):
     def __init__(self, block):
         self._block = block
         self._counter = {}
-        self._old_scope = None
-        self._name_scope = None
+        self._local = threading.local()
 
 Review comment:
   Considering that additional dependency on contextvars needs to be introduced 
for py3.5, a separate pr for contextvars seems better, which adds the 
dependency, and switch all thread local to contextvars. I may still go with 
thread local here, but I’ll be glad to switch to contextvars after we add the 
dependency.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

Reply via email to