yzhliu commented on a change in pull request #4295: [Relay][Quantize] Integrate
data-aware calibration into quantization
URL: https://github.com/apache/incubator-tvm/pull/4295#discussion_r346537989
##########
File path: python/tvm/relay/quantize/quantize.py
##########
@@ -402,23 +304,21 @@ def prerequisite_optimize(graph, params=None):
_transform.FoldConstant()])
if params:
- graph = _bind_params(graph, params)
+ mod['main'] = _bind_params(mod['main'], params)
- mod = _module.Module.from_expr(graph)
- with _transform.PassContext(opt_level=3):
- mod = optimize(mod)
- return mod["main"]
+ mod = optimize(mod)
+ return mod
-def quantize(graph, params=None, dataset=None):
+def quantize(mod, params=None, dataset=None):
""" The quantization procedure. Before running the three main
procedure of quantization, "annotate", "calibrate" and "realize"
, we need to do "SimplifyInference", "FoldScaleAxis", "FoldConstant"
first for optimizing.
Parameters
---------
- graph: Function
+ mod: Function
Review comment:
```suggestion
mod: Module
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services