Skip to content

Commit

Permalink
[Relay][Quantization] Fix duplicated simulated quantization (apache#2803
Browse files Browse the repository at this point in the history
)
  • Loading branch information
vinx13 authored and wweic committed Mar 20, 2019
1 parent 261f6a0 commit 10f41b2
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 @@ -112,6 +112,11 @@ def attach_simulated_quantize(data, kind, sign=True, rounding="round"):
kind: QAnnotateKind
the kind of annotation field.
"""
quantize_op = _op.get("relay.op.annotation.simulated_quantize")
if isinstance(data, _expr.Call) and data.op == quantize_op:
if data.attrs.kind == kind and data.attrs.sign == sign and data.attrs.rounding == rounding:
return data

dom_scale = _expr.var("dom_scale")
clip_min = _expr.var("clip_min")
clip_max = _expr.var("clip_max")
Expand Down

0 comments on commit 10f41b2

Please sign in to comment.