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 2022/07/12 21:47:59 UTC

[GitHub] [tvm] tkonolige commented on a diff in pull request #11936: [TOPI] Allow conv definition to have custom kernel layout

tkonolige commented on code in PR #11936:
URL: https://github.com/apache/tvm/pull/11936#discussion_r919453757


##########
tests/python/topi/python/test_topi_conv2d_nhwc.py:
##########
@@ -95,5 +95,34 @@ def test_conv2d_nhwc(target, dev, ref_data, dtype, stride, padding, dilation):
     tvm.testing.assert_allclose(b.numpy(), b_np, rtol=1e-5)
 
 
+def test_conv2d_explicit_layout(
+    dtype, batch, in_channel, in_size, num_filter, kernel, stride, padding, dilation
+):
+    in_height = in_width = in_size
+    a_shape = (batch, in_height, in_width, in_channel)
+    w_shape = (kernel, kernel, in_channel, num_filter)
+
+    A = te.placeholder(a_shape, name="A", dtype=dtype)
+    W = te.placeholder(w_shape, name="W", dtype=dtype)
+
+    topi.testing.check_compute_definition_equivalent(
+        [
+            A,
+            W,
+            topi.nn.conv2d(
+                A,
+                W,
+                stride,
+                padding,
+                dilation,
+                data_layout="NHWC",
+                kernel_layout="HWIO",
+                out_dtype="float32",
+            ),
+        ],
+        [A, W, topi.nn.conv2d_nhwc(A, W, stride, padding, dilation, "float32")],

Review Comment:
   `topi.nn.conv2d_nhwc` just calls `topi.nn.conv2d` under the hood, so this test isn't really checking anything.



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