You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/10/04 22:24:44 UTC

[GitHub] [tvm] AndrewZhaoLuo commented on a change in pull request #9126: [Frontend][PaddlePaddle][Part1] Add 100+ operators for PaddlePaddle

AndrewZhaoLuo commented on a change in pull request #9126:
URL: https://github.com/apache/tvm/pull/9126#discussion_r721756932



##########
File path: tests/python/frontend/paddlepaddle/test_forward.py
##########
@@ -623,39 +829,30 @@ def slice4(inputs):
 
 
 @tvm.testing.uses_gpu
-def test_forward_tanh():
-    @paddle.jit.to_static
-    def tanh(inputs):
-        return paddle.tanh(inputs)
+def test_forward_math_api():
+    class MathAPI(nn.Layer):
+        def __init__(self, api_name):
+            super(MathAPI, self).__init__()
+            for candidate in (paddle, paddle.nn.functional):
+                self.func = getattr(candidate, api_name, None)
+                if self.func:
+                    break
 
-    input_shape = [1, 3, 10, 10]
-    input_data = paddle.rand(input_shape, dtype="float32")
-    verify_model(tanh, input_data=input_data)
+        @paddle.jit.to_static
+        def forward(self, inputs):
+            return self.func(inputs)
+
+    api_list = [
+        "exp",
+        "relu",
+        "tanh",
+    ]
+    input_shapes = [[128], [2, 256], [1000, 128, 32], [7, 3, 256, 256]]

Review comment:
       Please reduce the size of your test cases to something smaller e.g. less than 256 total elements (totally arbitrary, just as small as possible while still accomplishing the test)




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

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org