icemelon9 commented on a change in pull request #5284: [Topi] Tensorcore 
support for Conv3D
URL: https://github.com/apache/incubator-tvm/pull/5284#discussion_r407151713
 
 

 ##########
 File path: python/tvm/relay/op/nn/_nn.py
 ##########
 @@ -139,13 +139,17 @@ def convert_conv2d(attrs, inputs, tinfos, 
desired_layout):
     # pylint: disable=import-outside-toplevel
     from tvm import relay
     data, weight = inputs
-    assert desired_layout == 'NCHW', \
-            "Currently only transformation to NCHW layout is supported."
+    new_attrs = dict(attrs)
     if desired_layout == 'NCHW':
-        new_attrs = dict(attrs)
         new_attrs['data_layout'] = desired_layout
         new_attrs['kernel_layout'] = 'OIHW'
         return relay.nn.conv2d(data, weight, **new_attrs)
+    elif desired_layout == 'NHWC':
+        new_attrs['data_layout'] = desired_layout
+        new_attrs['kernel_layout'] = 'HWIO'
 
 Review comment:
   This could be wrong for depthwise conv2d, which by default expects kernel 
layout to be "HWOI".

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