You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/06/19 21:40:05 UTC

[GitHub] anirudh2290 commented on a change in pull request #11332: [MXNET-558] Fix 'AttributeError: '_thread._local' object has no attribute 'value'' on distributed processing applications

anirudh2290 commented on a change in pull request #11332: [MXNET-558] Fix 'AttributeError: '_thread._local' object has no attribute 'value'' on distributed processing applications
URL: https://github.com/apache/incubator-mxnet/pull/11332#discussion_r196586618
 
 

 ##########
 File path: tests/python/unittest/test_thread_local.py
 ##########
 @@ -133,6 +133,19 @@ def f():
     thread.join()
     event.clear()
     assert status[0], "Spawned thread isn't using the correct blockscope namemanager"
+    
+def test_createblock():
+    status = [False]
+    def f():
+        net = mx.gluon.nn.Dense(2)
+        net.initialize()
+        net(mx.nd.array([1, 2, 3]))
+        status[0] = True
+
+    thread = threading.Thread(target=f)
+    thread.start()
+    thread.join()
+    assert status[0], "Failed to create a layer within a thread"
 
 Review comment:
   Can you also add the test for running the following functions inside a thread:
   
   ```
     def g():
         data = mx.sym.Variable('data', attr={'a': 'b'})
   ```
   
   ```
     def f():
         a = mx.sym.var("a")
         b = mx.sym.var("b")
         a_ = mx.nd.ones((2, 2))
         c_ = a_.copy()
         func1 = (a + b).bind(mx.cpu(), args={'a': a_, 'b': c_})
         func1.forward()[0].wait_to_read()
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services