Skip to content

Commit c6a2045

Browse files
derisavitqchen
authored andcommitted
fixed algorithm. padding should be on both sides (#489)
1 parent a3cbefd commit c6a2045

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tutorials/optimize/opt_conv_cuda.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
# Algorithm
3737
A = tvm.placeholder((in_size, in_size, in_channel, batch), name='A')
3838
W = tvm.placeholder((kernel, kernel, in_channel, out_channel), name='W')
39-
out_size = (in_size - kernel + pad) // stride + 1
39+
out_size = (in_size - kernel + 2*pad) // stride + 1
4040
# Pad input
4141
Apad = tvm.compute(
42-
(in_size + pad, in_size + pad, in_channel, batch),
42+
(in_size + 2*pad, in_size + 2*pad, in_channel, batch),
4343
lambda yy, xx, cc, nn: tvm.select(
4444
tvm.all(yy >= pad, yy - pad < in_size,
4545
xx >= pad, xx - pad < in_size),

0 commit comments

Comments
 (0)