This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git


The following commit(s) were added to refs/heads/master by this push:
     new 3dfbae3  [TOPI, Cuda] Fix conv2d_transpose output padding (#6236)
3dfbae3 is described below

commit 3dfbae31b76e9c83f7387ee1bdbca3b26391f803
Author: Wuwei Lin <wu...@apache.org>
AuthorDate: Mon Aug 10 11:37:09 2020 -0400

    [TOPI, Cuda] Fix conv2d_transpose output padding (#6236)
---
 python/tvm/topi/cuda/conv2d_transpose_nchw.py | 4 ++--
 tests/python/relay/test_op_grad_level2.py     | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/python/tvm/topi/cuda/conv2d_transpose_nchw.py 
b/python/tvm/topi/cuda/conv2d_transpose_nchw.py
index d0a683e..7e41209 100644
--- a/python/tvm/topi/cuda/conv2d_transpose_nchw.py
+++ b/python/tvm/topi/cuda/conv2d_transpose_nchw.py
@@ -65,13 +65,13 @@ def conv2d_transpose_nchw(cfg, data, kernel, stride, 
padding, out_dtype,
     out_width = (inp_width - 1) * stride_width + \
         kernel_width - pad_left - pad_right + outpad_width
     pad_left = kernel_width - 1 - pad_left
-    pad_right = kernel_width - 1 - pad_right
+    pad_right = kernel_width - 1 - pad_right + outpad_width
     dilated_width = stride_width * (inp_width - 1) + 1
 
     out_height = (inp_height - 1) * stride_height + \
         kernel_height - pad_top - pad_bottom + outpad_height
     pad_top = kernel_height - 1 - pad_top
-    pad_bottom = kernel_height - 1 - pad_bottom
+    pad_bottom = kernel_height - 1 - pad_bottom + outpad_height
     dilated_height = stride_height * (inp_height - 1) + 1
 
     # compute pad
diff --git a/tests/python/relay/test_op_grad_level2.py 
b/tests/python/relay/test_op_grad_level2.py
index 8b434d6..50e3585 100644
--- a/tests/python/relay/test_op_grad_level2.py
+++ b/tests/python/relay/test_op_grad_level2.py
@@ -151,8 +151,7 @@ def verify_conv2d_grad(dshape, wshape, strides, padding, 
dilation, groups=1, mod
 def test_conv2d_grad():
     verify_conv2d_grad((1, 4, 16, 16), (16, 4, 3, 3), [1, 1], [1, 1], [1, 1])
     verify_conv2d_grad((1, 4, 16, 16), (16, 4, 1, 1), [1, 1], [0, 0], [1, 1])
-    # TODO(@vinx13) recover the test after we fix the conv2d grad.
-    # verify_conv2d_grad((1, 4, 16, 16), (16, 4, 1, 1), [2, 2], [0, 0], [1, 1])
+    verify_conv2d_grad((1, 4, 16, 16), (16, 4, 1, 1), [2, 2], [0, 0], [1, 1])
     verify_conv2d_grad((1, 4, 16, 16), (16, 4, 3, 3), [1, 1], [1, 1], [1, 1], 
mode='first_order')
 
 

Reply via email to