tvm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-tvm] seanlatias opened a new pull request #5768: [Relay] Fix Calibration Pass to Support Modules with Multiple Functions
Date Wed, 10 Jun 2020 16:47:56 GMT

seanlatias opened a new pull request #5768:
URL: https://github.com/apache/incubator-tvm/pull/5768


   With the existing calibration pass, it only returns the module that is built from the main
function. However, the input can have more than one functions (e.g., after using BYOC). This
PR provides a quick fix by setting the function dictionary of `from_expr`.
   
   Following is a case where the existing pass would go wrong but is fixed by this PR.
   
   ```python
   def test_extern_dnnl_mobilenet():
       if not tvm.get_global_func("relay.ext.dnnl", True):
           print("skip because DNNL codegen is not available")
           return
    
       dtype = 'float32'
       ishape = (1, 3, 224, 224)
       mod, params = relay.testing.mobilenet.get_workload(
           batch_size=1, dtype='float32')
    
    
       mod = transform.AnnotateTarget(["dnnl"])(mod)
       mod = transform.MergeCompilerRegions()(mod)
       mod = transform.PartitionGraph()(mod)
    
       with relay.quantize.qconfig(skip_conv_layers=[]):
           mod = relay.quantize.quantize(mod, params)
   ```
   
   However, with this current fix, we still only run the calibration pass on the main function
instead of all input functions. In the future, we may need to consider applying the analysis
to all functions.
   
   I also did a quick check on other passes to see if there exist similar issues but I think
this is the only pass.
   
   @comaniac @zhiics @anijain2305 please take a look. Thanks.
   


----------------------------------------------------------------
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:
users@infra.apache.org



Mime
View raw message