anirudhacharya commented on a change in pull request #12967: [MXNET-1173] Debug 
operators - isfinite and isinf
URL: https://github.com/apache/incubator-mxnet/pull/12967#discussion_r227979334
 
 

 ##########
 File path: tests/python/unittest/test_ndarray.py
 ##########
 @@ -1495,6 +1495,20 @@ def test_dlpack():
             mx.test_utils.assert_almost_equal(a_np, d_np)
             mx.test_utils.assert_almost_equal(a_np, e_np)
 
+@with_seed()
+def test_ndarray_is_inf():
+    data = mx.nd.array([np.inf, -np.inf, np.NINF, -1])
+    output = mx.nd.contrib.isinf(data)
+    expected_output = mx.nd.array([1,1,1,0])
+    assert_almost_equal(output.asnumpy(), expected_output.asnumpy())
+
+@with_seed()
+def test_ndarray_is_finite():
+    data = mx.nd.array([np.inf, -np.inf, np.NINF, -1])
+    output = mx.nd.contrib.isfinite(data)
+    expected_output = mx.nd.array([0,0,0,1])
+    assert_almost_equal(output.asnumpy(), expected_output.asnumpy())
 
 Review comment:
   make a check for `Nan` values

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to