Skip to content

Commit f06693e

Browse files
committed
Added a check for viable quantization layers to annotation.
1 parent bbf128a commit f06693e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

python/tvm/relay/quantize/_annotate.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ def conv2d_rewrite(ref_call, new_args, ctx):
163163
_set_conv_counter(cnt + 1)
164164
return None
165165

166+
# Check if the kernel is suitable for quantization, post warning if not.
167+
in_channels = new_args[1].data.shape[1]
168+
if in_channels % 4 != 0:
169+
print("Conv layer %d may not be suitable for quantization. Consider leaving it FP." %cnt)
170+
166171
_set_conv_counter(cnt + 1)
167172

168173
lhs_expr, lhs_kind = _get_expr_kind(new_args[0])

0 commit comments

Comments
 (0)