You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ma...@apache.org on 2020/12/11 03:41:50 UTC
[tvm] branch main updated: Handle case where ListConstruct makes a
python list which is output of whole model (#7088)
This is an automated email from the ASF dual-hosted git repository.
masahi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new df5ba51 Handle case where ListConstruct makes a python list which is output of whole model (#7088)
df5ba51 is described below
commit df5ba51e7cd3ad192af95b6a662898132227e185
Author: Trevor Morris <tr...@amazon.com>
AuthorDate: Thu Dec 10 19:41:35 2020 -0800
Handle case where ListConstruct makes a python list which is output of whole model (#7088)
---
python/tvm/relay/frontend/pytorch.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/python/tvm/relay/frontend/pytorch.py b/python/tvm/relay/frontend/pytorch.py
index ca188c7..0918843 100644
--- a/python/tvm/relay/frontend/pytorch.py
+++ b/python/tvm/relay/frontend/pytorch.py
@@ -3038,7 +3038,10 @@ def from_pytorch(script_module, input_infos, custom_convert_map=None, default_dt
qnn_torch.add_quant_params(tvm_params, weight_quant_params)
converter.update_convert_map(qnn_torch.convert_map)
- ret = converter.convert_operators(_get_operator_nodes(graph.nodes()), outputs, ret_name)
+ ret = converter.convert_operators(_get_operator_nodes(graph.nodes()), outputs, ret_name)[0]
+ if isinstance(ret, list):
+ # ListConstruct kept original python list. Convert to tuple.
+ ret = _expr.Tuple(ret)
- mod["main"] = tvm.relay.Function(_analysis.free_vars(ret[0]), ret[0])
+ mod["main"] = tvm.relay.Function(_analysis.free_vars(ret), ret)
return transform.RemoveUnusedFunctions()(mod), tvm_params