access2rohit commented on a change in pull request #19313:
URL: https://github.com/apache/incubator-mxnet/pull/19313#discussion_r502548640
##########
File path: tests/nightly/test_np_large_array.py
##########
@@ -1874,3 +1873,24 @@ def test_cross():
assert inp.grad[0, 0] == 1 and inp.grad[0, 1] == -1 and inp.grad[0, 2] == 0
assert inp.grad[-1, 0] == 5 and inp.grad[-1, 1] == -4 and inp.grad[-1, 2]
== -1
+
+@use_np
+def test_vstack():
+ inp1 = np.zeros((INT_OVERFLOW, 1))
+ inp2 = np.ones((INT_OVERFLOW, 1))
+ inp1.attach_grad()
+ inp2.attach_grad()
+ with mx.autograd.record():
+ out1 = np.vstack((inp1, inp2))
+ out1.backward()
+ assert out1.shape == (DOUBLE_INT_OVERFLOW, 1)
+ assert out1[INT_OVERFLOW-1, 0] == 0 and out1[-1, 0] == 1
+ assert inp1.grad.shape == inp1.shape
+ assert inp1.grad[-1, -1] == 1
+ with mx.autograd.record():
+ out2 = np.vstack((inp1.flatten(), inp2.flatten()))
+ out2.backward()
+ assert out2.shape == (2, INT_OVERFLOW)
+ assert out2[0, -1] == 0 and out2[1, -1] == 1
+ assert inp2.grad.shape == inp2.shape
+ assert inp2.grad[-1, -1] == 1
Review comment:
New line ?
----------------------------------------------------------------
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]