access2rohit commented on a change in pull request #19294:
URL: https://github.com/apache/incubator-mxnet/pull/19294#discussion_r525603178
##########
File path: tests/nightly/test_np_large_array.py
##########
@@ -542,6 +564,113 @@ def test_slice_assign():
B[-1] = 2
assert B[-1, 0] == 2 and B[-1, 1] == 2
+@use_np
+def test_flatnonzero():
+ inp = np.zeros((2, INT_OVERFLOW))
+ inp[-1, -1] = 1
+ inp.attach_grad()
+ with mx.autograd.record():
+ out = np.flatnonzero(inp)
+ out.backward()
+ assert out.shape == (1, )
+ assert out[0] == int(2 * INT_OVERFLOW - 1)
+ assert inp.grad.shape == inp.shape
+ assert inp.grad[-1, -1] == 0
+
+@use_np
+def test_ravel():
+ inp = np.zeros((2, INT_OVERFLOW))
+ inp[0, -1], inp[-1, -1] = 1, 2
+ inp.attach_grad()
+ with mx.autograd.record():
+ out = np.ravel(inp)
+ out.backward()
+ assert out.shape == (DOUBLE_INT_OVERFLOW, )
+ assert out[INT_OVERFLOW-1] == 1 and out[-1] == 2
+ assert inp.grad.shape == inp.shape
+ assert inp.grad[-1, -1] == 1
+
+@use_np
+def test_mean():
+ inp = np.arange(DOUBLE_INT_OVERFLOW).reshape((2, INT_OVERFLOW))
+ inp.attach_grad()
+ with mx.autograd.record():
+ out = np.mean(inp, axis=1)
+ out.backward()
+ assert out.shape == (2, )
+ assert_almost_equal(out[0], np.array((HALF_INT_OVERFLOW-0.5)), \
Review comment:
can you specify dtype in the input itself ?
----------------------------------------------------------------
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:
[email protected]