optima2005 commented on a change in pull request #4484: [FRONTEND][TF]
conv2d_transpose 'SAME' support kernel more than 1x1
URL: https://github.com/apache/incubator-tvm/pull/4484#discussion_r355865633
##########
File path: src/relay/op/nn/convolution.cc
##########
@@ -248,10 +248,17 @@ bool Conv2DTransposeRel(const Array<Type>& types,
}
// dilation
Array<IndexExpr> oshape({dshape_nchw[0], channels, 0, 0});
- oshape.Set(2, (param->strides[0] * (dshape_nchw[2] - 1) + dilated_ksize_y -
- 2 * param->padding[0] + param->output_padding[0]));
- oshape.Set(3, (param->strides[1] * (dshape_nchw[3] - 1) + dilated_ksize_x -
- 2 * param->padding[1] + param->output_padding[1]));
+ if ( param->padding.size() == 2 ) {
+ oshape.Set(2, (param->strides[0] * (dshape_nchw[2] - 1) + dilated_ksize_y -
+ 2 * param->padding[0] + param->output_padding[0]));
+ oshape.Set(3, (param->strides[1] * (dshape_nchw[3] - 1) + dilated_ksize_x -
+ 2 * param->padding[1] + param->output_padding[1]));
+ } else if (param->padding.size() == 4) {
+ oshape.Set(2, (param->strides[0] * (dshape_nchw[2] - 1) + dilated_ksize_y -
+ param->padding[0] - param->padding[2] +
param->output_padding[0]));
+ oshape.Set(3, (param->strides[1] * (dshape_nchw[3] - 1) + dilated_ksize_x -
+ param->padding[1] - param->padding[3] +
param->output_padding[1]));
Review comment:
This is better. Thanks!
----------------------------------------------------------------
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