Skip to content

Commit

Permalink
[Quantization][RELAY] Add check against NCHWc ops in the quantization…
Browse files Browse the repository at this point in the history
… pass (apache#2646)

* check in

* fix typo

* fix typo

* change message

* change message

* typo

* lint
  • Loading branch information
eqy authored and wweic committed Mar 12, 2019
1 parent 38ed396 commit df5d2c2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions python/tvm/relay/quantize/_annotate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pylint: disable=unused-argument
"""Internal module for registering attribute for annotation."""
from __future__ import absolute_import
import warnings

import topi
from . import _quantize
Expand Down Expand Up @@ -118,6 +119,14 @@ def attach_simulated_quantize(data, kind, sign=True, rounding="round"):
data, dom_scale, clip_min, clip_max, kind, sign, rounding)


@register_annotate_function("nn.contrib_conv2d_NCHWc")
def conv2d_nchwc_rewrite(ref_call, new_args, ctx):
warnings.warn("NCHWc layout Conv2D detected, please use a lower "
"optimization level before applying the quantization "
"pass as quantization will have no effect here...")
return None


@register_annotate_function("nn.conv2d")
def conv2d_rewrite(ref_call, new_args, ctx):
"""Rewrite function for conv2d. Lhs of conv will be quantized to
Expand Down

0 comments on commit df5d2c2

Please sign in to comment.