masahi commented on a change in pull request #5204: [Frontend][Torch] Fix up
graph input handling
URL: https://github.com/apache/incubator-tvm/pull/5204#discussion_r401741564
##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -1139,10 +1149,20 @@ def _get_operator_nodes(nodes):
return ops
-def _get_relay_input_vars(input_shapes):
- """ Return Relay vars from input shapes """
- return {iname: _expr.var(iname, shape=ishape)
- for iname, ishape in input_shapes.items()}
+def _get_relay_input_vars(graph, input_shapes):
+ """
+ Return Relay vars from input shapes and create entries based on
+ expected graph inputs - to allow translation
+ """
+ input_vars = {}
+ ir_inputs = _get_graph_input_names(graph)
+ for idx, ir_input in enumerate(ir_inputs):
Review comment:
How about
```
for ir_input, (name, shape) in zip(ir_inputs, input_shapes):
...
```
----------------------------------------------------------------
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