comaniac commented on a change in pull request #6366:
URL: https://github.com/apache/incubator-tvm/pull/6366#discussion_r481627413
##########
File path: python/tvm/contrib/target/onnx.py
##########
@@ -349,13 +354,13 @@ def convert(cls, node_entry, model_container, node_dict):
name = node_entry['name']
data = numpy.asarray(attrs['pads'],
dtype=attrs['pads'][0].dtype).astype(numpy.int64)
- input_name = 'pads_{}'.format(name)
value =
numpy.dtype(node_entry['types'][0].dtype).type(attrs['constant_value'])
- input_value_name = 'value_{}'.format(name)
- add_input(data, input_name, model_container)
- add_input(value, input_value_name, model_container)
- input_names = [node_entry['input_names'][0], input_name,
input_value_name]
+ input_names = []
+ input_names.append(add_input(data, name, 'pads', model_container))
+ input_names.append(add_input(value, name, 'value', model_container))
+ input_names = [node_entry['input_names'][0]] + input_names
Review comment:
```suggestion
input_names = [node_entry['input_names'][0],
add_input(data, name, 'pads', model_container),
add_input(value, name, 'value', model_container)]
```
##########
File path: python/tvm/contrib/target/onnx.py
##########
@@ -111,14 +113,17 @@ def convert(cls, node_entry, model_container, node_dict):
Relay operator accepts shape as attribute but ONNX operator
accepts it as a input.
"""
-
+ name = node_entry['name']
shape = numpy.asarray([a.value for a in
node_entry['relay_node'].attrs.newshape],
dtype=numpy.int64)
- input_name = 'shape{}'.format(node_entry['name'])
- node = onnx.helper.make_node(cls.__name__,
[node_entry['input_names'][0], input_name],
+
+ input_names = []
+ input_names.append(add_input(shape, name, 'shape', model_container))
+ input_names = [node_entry['input_names'][0]] + input_names
Review comment:
```suggestion
input_names = [node_entry['input_names'][0],
add_input(shape, name, 'shape', model_container)]
```
----------------------------------------------------------------
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]