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/07/10 17:53:37 UTC

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

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