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/05/25 20:57:01 UTC

[GitHub] [tvm] akmaru commented on a change in pull request #8131: [TensorRT] Fixed access to pad_value

akmaru commented on a change in pull request #8131:
URL: https://github.com/apache/tvm/pull/8131#discussion_r639199157



##########
File path: tests/python/contrib/test_tensorrt.py
##########
@@ -793,17 +793,19 @@ def get_graph(x_shape=(1, 16)):
 
 
 def test_pad():
-    def get_graph(x_shape, pad_width):
+    def get_graph(x_shape, pad_width, pad_value=0.0):
         x = relay.var("x", shape=(x_shape), dtype="float32")
-        out = relay.nn.pad(x, pad_width=pad_width)
+        out = relay.nn.pad(x, pad_width=pad_width, pad_value=pad_value)
         f = relay.Function([x], out)
         return f, {"x": x_shape}, []
 
     run_and_verify_func(get_graph((1, 8, 16, 16), [[0, 0], [0, 0], [0, 0], [0, 0]]))
     run_and_verify_func(get_graph((1, 8, 16, 16), [[0, 0], [0, 0], [1, 1], [1, 1]]))
+    run_and_verify_func(get_graph((1, 8, 16, 16), [[0, 0], [0, 0], [1, 1], [1, 1]], pad_value=-1.0e30))
     run_and_verify_func(get_graph((1, 8, 16, 16), [[0, 0], [0, 0], [0, 1], [2, 0]]))
+    run_and_verify_func(get_graph((1, 8, 16, 16), [[0, 0], [0, 0], [0, 1], [2, 0]], pad_value=-1.0e30))
     run_and_verify_func(get_graph((1, 8, 3, 16, 16), [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]))
-
+    run_and_verify_func(get_graph((1, 8, 3, 16, 16), [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]], pad_value=-1.0e30))

Review comment:
       Added the test cases.




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