ChaiBapchya commented on a change in pull request #13083: [WIP] [MXNET-345] Hardmax operator URL: https://github.com/apache/incubator-mxnet/pull/13083#discussion_r238519665
########## File path: tests/python/unittest/test_ndarray.py ########## @@ -1548,6 +1548,15 @@ def test_ndarray_is_nan(): np.testing.assert_equal(output.asnumpy(), expected_output.astype(int)) # astype since numpy functions default return type is boolean array instead of int +@with_seed() +def test_ndarray_hardmax(): + data = mxnet.test_utils.rand_ndarray([2,3,4],'default') + output = mx.nd.contrib.hardmax(data) + xn_r = mx.nd.reshape(data, shape=(6,4)) + xn_e = mx.nd.eye(xn_r.shape[1], dtype=data.dtype)[mx.nd.argmax(xn_r, axis=1)] + expected_output = mx.nd.reshape(xn_e, shape=data.shape) Review comment: @anirudh2290 added the mxnet commands instead of hardcoding the expected output ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services