Skip to content

Commit

Permalink
fixed algorithm. padding should be on both sides (#489)
Browse files Browse the repository at this point in the history
  • Loading branch information
derisavi authored and tqchen committed Sep 25, 2017
1 parent a3cbefd commit c6a2045
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tutorials/optimize/opt_conv_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
# Algorithm
A = tvm.placeholder((in_size, in_size, in_channel, batch), name='A')
W = tvm.placeholder((kernel, kernel, in_channel, out_channel), name='W')
out_size = (in_size - kernel + pad) // stride + 1
out_size = (in_size - kernel + 2*pad) // stride + 1
# Pad input
Apad = tvm.compute(
(in_size + pad, in_size + pad, in_channel, batch),
(in_size + 2*pad, in_size + 2*pad, in_channel, batch),
lambda yy, xx, cc, nn: tvm.select(
tvm.all(yy >= pad, yy - pad < in_size,
xx >= pad, xx - pad < in_size),
Expand Down

0 comments on commit c6a2045

Please sign in to comment.