zxy844288792 commented on a change in pull request #6366:
URL: https://github.com/apache/incubator-tvm/pull/6366#discussion_r481319714



##########
File path: tests/python/contrib/test_onnx.py
##########
@@ -448,6 +448,38 @@ def verify_tuple_types(dshape, indices_or_sections, 
axis=None, dtype = "float32"
     verify_tuple_types((5, 5, 2, 2), [1, 3, 4], axis=0)
     verify_tuple_types((5, 5, 2, 2), [1, 3, 4], axis=1)
 
+def test_layout_transform():
+    def verify_layout_transform(dshape, src_layout, dst_layout, 
dtype="float32"):
+        x = relay.var("x", relay.ty.TensorType(dshape, dtype))
+        y = relay.layout_transform(x, src_layout, dst_layout)
+        func = relay.Function([x], y)
+        x_data = np.random.uniform(size=dshape).astype(dtype)
+        verify_results(func, [x_data], 'test_layout_transform', rtol=1e-5, 
atol=1e-5)
+
+    verify_layout_transform((1, 3, 8, 8), 'NCHW', 'NHWC')
+    verify_layout_transform((1, 8, 8, 3), 'NHWC', 'NCHW')

Review comment:
       On onnx side, perm will be [0, 1, 2, 3] and it passed onnxruntime. But 
it seems on relay side, this behavior will fail during compilation. 




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to