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/06/03 02:46:24 UTC

[GitHub] [tvm] YuhengHuang42 opened a new issue #8182: Support conv2d transpose operator with groups > 1

YuhengHuang42 opened a new issue #8182:
URL: https://github.com/apache/tvm/issues/8182


   Currently TVM doesn't support operator with groups > 1. When turning Pytorch model to Relay there will be an error.
   
   Detail discussion could be seen at: https://discuss.tvm.apache.org/t/pytorch-error-when-turning-a-simple-pytorch-model-to-relay/10158
   
   P.S. It may be better if TVM can show some warnings saying that a specific parameter for an op is unsupported, rather than  just gives some kind of error?
   


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



[GitHub] [tvm] Lyken17 commented on issue #8182: Support conv2d transpose operator with groups > 1

Posted by GitBox <gi...@apache.org>.
Lyken17 commented on issue #8182:
URL: https://github.com/apache/tvm/issues/8182#issuecomment-877677173


   happened to be here. It was surprising the issue was not solved after so long time. For anyone who also had this trouble, you may refer following code to support `group` parameter in transposed convolution
   
   ```python
       out_c = simplify(out_c)
       out_channels = simplify(out_c * groups)
   
       out_h = simplify(in_h - filter_h + 1)
       out_w = simplify(in_w - filter_w + 1)
       dc = te.reduce_axis((0, in_c // groups), name="dc")
       dh = te.reduce_axis((0, filter_h), name="dh")
       dw = te.reduce_axis((0, filter_w), name="dw")
       
       # data: batch, in_channels, out_h, out_w
       # weight: out_channels // G, in_channels, out_h, out_w
       return te.compute(
           (batch, out_channels, out_h, out_w),
           lambda b, c, h, w: te.sum(
               data_pad[
                   b, 
                   c // (out_channels // groups) * (in_channels // groups) + dc, 
                   h + dh, 
                   w + dw
               ].astype(out_dtype)
               * kernel_transform[
                   c % (out_channels // groups), 
                   c // (out_channels // groups) * (in_channels // groups) + dc, 
                   dh, 
                   dw
               ].astype(out_dtype),
               axis=[dc, dh, dw],
           ),
           tag="conv2d_transpose_nchw",
       )
   ```


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



[GitHub] [tvm] Lyken17 commented on issue #8182: Support conv2d transpose operator with groups > 1

Posted by GitBox <gi...@apache.org>.
Lyken17 commented on issue #8182:
URL: https://github.com/apache/tvm/issues/8182#issuecomment-883943024


   @tqchen Sure, I can craft a PR. 


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



[GitHub] [tvm] Lyken17 edited a comment on issue #8182: Support conv2d transpose operator with groups > 1

Posted by GitBox <gi...@apache.org>.
Lyken17 edited a comment on issue #8182:
URL: https://github.com/apache/tvm/issues/8182#issuecomment-877677173


   happened to be here. It was surprising the issue was not solved after so long time. TranposedConv2d is an important operator in GAN related applications. For anyone who also had this trouble, you may refer following code to support `group` parameter in transposed convolution
   
   ```python
       out_c = simplify(out_c)
       out_channels = simplify(out_c * groups)
   
       out_h = simplify(in_h - filter_h + 1)
       out_w = simplify(in_w - filter_w + 1)
       dc = te.reduce_axis((0, in_c // groups), name="dc")
       dh = te.reduce_axis((0, filter_h), name="dh")
       dw = te.reduce_axis((0, filter_w), name="dw")
       
       # data: batch, in_channels, out_h, out_w
       # weight: out_channels // G, in_channels, out_h, out_w
       return te.compute(
           (batch, out_channels, out_h, out_w),
           lambda b, c, h, w: te.sum(
               data_pad[
                   b, 
                   c // (out_channels // groups) * (in_channels // groups) + dc, 
                   h + dh, 
                   w + dw
               ].astype(out_dtype)
               * kernel_transform[
                   c % (out_channels // groups), 
                   c // (out_channels // groups) * (in_channels // groups) + dc, 
                   dh, 
                   dw
               ].astype(out_dtype),
               axis=[dc, dh, dw],
           ),
           tag="conv2d_transpose_nchw",
       )
   ```


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



[GitHub] [tvm] tqchen commented on issue #8182: Support conv2d transpose operator with groups > 1

Posted by GitBox <gi...@apache.org>.
tqchen commented on issue #8182:
URL: https://github.com/apache/tvm/issues/8182#issuecomment-883664486


   Thanks @Lyken17 , do you mind to send a PR to resolve the case?


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