optima2005 commented on a change in pull request #4639: [Relay/Topi][Op] Conv1D
URL: https://github.com/apache/incubator-tvm/pull/4639#discussion_r365054591
 
 

 ##########
 File path: tests/python/frontend/onnx/test_forward.py
 ##########
 @@ -1761,18 +1773,95 @@ def verify_conv(x_shape, w_shape, y_shape, p):
 
 def test_conv():
     # Convolution with padding
-    # (1, 1, 5, 5) input tensor
-    # (1, 1, 3, 3) tensor for convolution weights
-    # (1, 1, 5, 5) output tensor
-    # [1, 1, 1, 1] list for pads
-    verify_conv((1, 1, 5, 5), (1, 1, 3, 3), (1, 1, 5, 5), [1, 1, 1, 1])
+    # Conv2D
+    verify_conv(x_shape=(1, 1, 5, 5),
+                w_shape=(1, 1, 3, 3),
+                y_shape=(1, 1, 5, 5),
+                padding=[1, 1, 1, 1],
+                kernel_shape=[3, 3],
+                strides=[1, 1],
+                dilations=[1, 1])
+    # Conv1D
+    verify_conv(x_shape=(1, 1, 5),
+                w_shape=(1, 1, 3),
+                y_shape=(1, 1, 5),
+                padding=[1, 1],
+                kernel_shape=[3,],
+                strides=[1,],
+                dilations=[1,])
 
     # Convolution without padding
-    # (1, 1, 5, 5) input tensor
-    # (1, 1, 3, 3) tensor for convolution weights
-    # (1, 1, 3, 3) output tensor
-    # [0, 0, 0, 0] list for pads
-    verify_conv((1, 1, 5, 5), (1, 1, 3, 3), (1, 1, 3, 3), [0, 0, 0, 0])
+    # Conv2D
+    verify_conv(x_shape=(1, 1, 5, 5),
+                w_shape=(1, 1, 3, 3),
+                y_shape=(1, 1, 3, 3),
+                padding=[0, 0, 0, 0],
+                kernel_shape=[3, 3],
+                strides=[1, 1],
+                dilations=[1, 1])
+    # Conv1D
+    verify_conv(x_shape=(1, 1, 5),
+                w_shape=(1, 1, 3),
+                y_shape=(1, 1, 3),
+                padding=[0, 0],
+                kernel_shape=[3,],
+                strides=[1,],
+                dilations=[1,])
+
+    # Convolution with autopadding
+    verify_conv(x_shape=(1, 1, 5, 5),
+                w_shape=(1, 1, 3, 3),
+                y_shape=(1, 1, 5, 5),
+                kernel_shape=[3, 3],
+                strides=[1, 1],
+                dilations=[1, 1],
+                padding=None,
+                auto_pad="SAME_UPPER")
+    # Conv1D
+    verify_conv(x_shape=(1, 1, 5),
+                w_shape=(1, 1, 3),
+                y_shape=(1, 1, 5),
+                kernel_shape=[3,],
+                strides=[1,],
+                dilations=[1,],
+                padding=None,
+                auto_pad="SAME_UPPER")
+
+    # Convolution with non uniform stride
+    verify_conv(x_shape=(1, 1, 5, 5),
+                w_shape=(1, 1, 3, 3),
+                y_shape=(1, 1, 3, 3),
+                kernel_shape=[3, 3],
+                strides=[2, 2],
+                dilations=[1, 1],
+                padding=None,
+                auto_pad="SAME_UPPER")
+    # Conv1D
+    verify_conv(x_shape=(1, 1, 5),
+                w_shape=(1, 1, 3),
+                y_shape=(1, 1, 3),
+                kernel_shape=[3,],
+                strides=[2,],
+                dilations=[1,],
+                padding=None,
+                auto_pad="SAME_UPPER")
+
+    # Convolution with dilation
+    verify_conv(x_shape=(1, 1, 5, 5),
+                w_shape=(1, 1, 3, 3),
+                y_shape=(1, 1, 5, 5),
+                kernel_shape=[3, 3],
+                strides=[1, 1],
+                dilations=[2, 2],
+                padding=[2, 2, 2, 2])
+    # Conv1D
+    verify_conv(x_shape=(1, 1, 5),
+                w_shape=(1, 1, 3),
+                y_shape=(1, 1, 5),
+                kernel_shape=[3,],
+                strides=[1,],
+                dilations=[2,],
+                padding=[2, 2])
 
 Review comment:
   The parameter key words are not necessary for those 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:
[email protected]


With regards,
Apache Git Services

Reply via email to