Skip to content

Commit

Permalink
Fix for dynamic batch size conv2d nhwc (apache#7598)
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi authored and trevor-m committed May 11, 2021
1 parent ea8b16f commit 918611f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions python/tvm/relay/op/strategy/cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ def judge_winograd(
OH = (H + pt + pb - KH) // stride_h + 1
OW = (W + pl + pr - KW) // stride_w + 1
nH, nW = (OH + tile_size - 1) // tile_size, (OW + tile_size - 1) // tile_size
if not isinstance(N, int):
return False, False, False
P = N * nH * nW

judge_winograd_tensorcore = (
Expand Down
4 changes: 3 additions & 1 deletion python/tvm/topi/cuda/conv2d_nhwc.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,6 @@ def schedule_conv2d_nhwc_direct(cfg, s, Conv):

N, OH, OW, CO = get_const_tuple(output.shape)
KH, KW, CI, _ = get_const_tuple(kernel.shape)
cfg.add_flop(2 * N * OH * OW * CO * CI * KH * KW)

if isinstance(N, int):
cfg.add_flop(2 * N * OH * OW * CO * CI * KH * KW)

0 comments on commit 918611f

Please sign in to comment.