Skip to content

Commit

Permalink
Added a check for viable quantization layers to annotation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwfromm committed May 14, 2019
1 parent bbf128a commit f06693e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/tvm/relay/quantize/_annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ def conv2d_rewrite(ref_call, new_args, ctx):
_set_conv_counter(cnt + 1)
return None

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

_set_conv_counter(cnt + 1)

lhs_expr, lhs_kind = _get_expr_kind(new_args[0])
Expand Down

0 comments on commit f06693e

Please sign in to comment.