Skip to content

Commit

Permalink
skip legalize when batch size is dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi committed Dec 11, 2021
1 parent 65fbc0a commit efceccb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/tvm/topi/cuda/conv2d_alter_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,10 @@ def _conv2d_legalize(attrs, inputs, arg_types):

elif data_dtype in ["float16"]:
if data_layout == "NHWC" and kernel_layout == "HWIO":
if isinstance(data_tensor.shape[0], tvm.tir.expr.Any):
# Skip legalize when the batch size is dynamic
return None

batch = data_tensor.shape[0].value
in_channel = data_tensor.shape[3].value
out_channel = kernel_tensor.shape[3].value
Expand Down

0 comments on commit efceccb

Please sign in to comment.