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 2020/10/13 21:28:39 UTC

[GitHub] [incubator-mxnet] Zha0q1 commented on a change in pull request #19324: Numpy std var large tensor fix

Zha0q1 commented on a change in pull request #19324:
URL: https://github.com/apache/incubator-mxnet/pull/19324#discussion_r504269092



##########
File path: tests/nightly/test_np_large_array.py
##########
@@ -1886,3 +1885,36 @@ def test_array_split():
     assert out[0][0][0] == 0
     assert out[1][-1][-1] == 2
 
+
+@use_np
+def test_std():
+    N = 2*20
+    inp = np.zeros((2, INT_OVERFLOW))
+    inp[-1, -1] = N
+    inp.attach_grad()
+    with mx.autograd.record():
+        out = np.std(inp, axis=1)
+        out.backward()
+    assert out.shape == (2, )

Review comment:
       I tried that first but it would take too long to run on large tensors so I instead derived a analytical formula. The correctness has been verified with small tensor size first then I switched to large tenosr




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