nudles commented on a change in pull request #416: singa-onnx
URL: https://github.com/apache/incubator-singa/pull/416#discussion_r264084037
 
 

 ##########
 File path: python/singa/sonnx.py
 ##########
 @@ -257,24 +255,28 @@ def to_onnx_model(inputs, y, model_name='sonnx'):
         the onnx model
     '''
     node = []
-    inputsx=inputs
     dependency = autograd.infer_dependency(y.creator)
     ready = deque([y.creator])
 
-    def output_name(op, index):
-        return '{}:{}'.format(op.name, index)
+    def output_name(op):
+        return '{}'.format(op.name)
 
     input_ids = set(id(x) for x in inputs)
     X = []
+    for x in inputs:
+        dtype = TensorProto.FLOAT
+        if y.dtype == tensor.int32:
+            dtype = TensorProto.INT
+        X.append(helper.make_tensor_value_info(x.name, dtype, x.shape))
     Y = [helper.make_tensor_value_info(
-        output_name(y.creator, 0), TensorProto.FLOAT, y.shape)]
+        output_name(y.creator), TensorProto.FLOAT, y.shape)]
 
     while len(ready) > 0:
         op = ready.pop()
         assert not isinstance(op, autograd.Dummy)
-        outputs = [output_name(op, idx)
+        outputs = [output_name(op)
 
 Review comment:
   if there are multiple outputs, then they all would have the same name.

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

Reply via email to