You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2021/03/06 02:52:55 UTC

[GitHub] [incubator-mxnet] waytrue17 commented on a change in pull request #19990: [wip][v1.x] ONNX Type inference support

waytrue17 commented on a change in pull request #19990:
URL: https://github.com/apache/incubator-mxnet/pull/19990#discussion_r588821133



##########
File path: python/mxnet/contrib/onnx/mx2onnx/export_onnx.py
##########
@@ -314,7 +325,24 @@ def create_onnx_graph_proto(self, sym, params, in_shape, in_type, verbose=False,
                     node_output_names = [converted[-1].name]
                 # process node outputs (sort by alphabetical order)
                 node_output_names.sort()
-                outputs_lookup.append(node_output_names)
+                # match the output names to output dtypes
+                if dtypes is not None:
+                    assert len(node_output_names) == len(dtypes)
+                    node_outputs = [NodeOutput(node_output_names[i], dtypes[i])
+                                    for i in range(len(dtypes))]
+                else:
+                    # in case dtypes is None, we just default to the dtype of the first input
+                    #TODO
+                    #assert len(node["inputs"]) > 0
+                    if len(node["inputs"]) > 0:
+                        first_input = node["inputs"][0]
+                        first_input_dtype = outputs_lookup[first_input[0]][first_input[1]].dtype
+                    else:
+                        #print('no inputs')

Review comment:
       Should we remove print?

##########
File path: python/mxnet/contrib/onnx/mx2onnx/export_onnx.py
##########
@@ -314,7 +325,24 @@ def create_onnx_graph_proto(self, sym, params, in_shape, in_type, verbose=False,
                     node_output_names = [converted[-1].name]
                 # process node outputs (sort by alphabetical order)
                 node_output_names.sort()
-                outputs_lookup.append(node_output_names)
+                # match the output names to output dtypes
+                if dtypes is not None:
+                    assert len(node_output_names) == len(dtypes)
+                    node_outputs = [NodeOutput(node_output_names[i], dtypes[i])
+                                    for i in range(len(dtypes))]
+                else:
+                    # in case dtypes is None, we just default to the dtype of the first input
+                    #TODO

Review comment:
       Seems no need for TODO here?




----------------------------------------------------------------
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