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 2019/10/17 15:43:27 UTC

[GitHub] [incubator-mxnet] ChaiBapchya commented on a change in pull request #16497: Large Vector tests for DGL Ops Part 2

ChaiBapchya commented on a change in pull request #16497: Large Vector tests for DGL Ops Part 2
URL: https://github.com/apache/incubator-mxnet/pull/16497#discussion_r336083432
 
 

 ##########
 File path: tests/nightly/test_large_vector.py
 ##########
 @@ -708,6 +708,111 @@ def test_full():
     assert a[-1] == 3
 
 
+def test_hyperbolic():
+    def test_arccosh(a):
+        mx_res = mx.nd.arccosh(a)
+        assert_almost_equal(mx_res[-1].asnumpy(), np.arccosh(a[-1].asnumpy()))
+
+    def test_arcsinh(a):
+        mx_res = mx.nd.arcsinh(a)
+        assert_almost_equal(mx_res[-1].asnumpy(), np.arcsinh(a[-1].asnumpy()))
+
+    def test_arctanh(a):
+        a[-1] = 0   # arctanh of 1 is inf, assert_almost_equal gives "divide by 0" for comparing 2 inf values
+        mx_res = mx.nd.arctanh(a)
+        assert_almost_equal(mx_res[-1].asnumpy(), np.arctanh(a[-1].asnumpy()))
+
+    def test_cosh(a):
+        mx_res = mx.nd.cosh(a)
+        assert_almost_equal(mx_res[-1].asnumpy(), np.cosh(a[-1].asnumpy()))
+
+    def test_sinh(a):
+        mx_res = mx.nd.sinh(a)
+        assert_almost_equal(mx_res[-1].asnumpy(), np.sinh(a[-1].asnumpy()))
+
+    def test_tanh(a):
+        mx_res = mx.nd.tanh(a)
+        assert_almost_equal(mx_res[-1].asnumpy(), np.tanh(a[-1].asnumpy()))
+
+    a = mx.nd.ones(LARGE_X)
+    test_arccosh(a)
+    test_arcsinh(a)
+    test_arctanh(a)
+    test_cosh(a)
+    test_sinh(a)
+    test_tanh(a)
+
+
+def test_sign():
+    a = mx.nd.random.normal(-1, 1, shape=LARGE_X)
+    mx_res = mx.nd.sign(a)
+    assert_almost_equal(mx_res[-1].asnumpy(), np.sign(a[-1].asnumpy()))
+
+
+def test_logical():
+    def test_logical_and(a, b):
+        mx_res = mx.nd.logical_and(a, b)
+        assert_almost_equal(mx_res[-1].asnumpy(), np.logical_and(a[-1].asnumpy(), b[-1].asnumpy()))
+
+    def test_logical_or(a, b):
+        mx_res = mx.nd.logical_and(a, b)
 
 Review comment:
   good catch!

----------------------------------------------------------------
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


With regards,
Apache Git Services