Add: tensor FUID in exported ONNX

This commit is contained in:
Liyan Zheng 2023-04-22 20:28:17 +08:00
parent c451918224
commit 40e6db6608
1 changed files with 3 additions and 3 deletions

View File

@ -639,9 +639,9 @@ class OnnxStub:
if name is None: if name is None:
self.count_in += 1 self.count_in += 1
if tensor.getTensorType() == backend.TensorType.Input: if tensor.getTensorType() == backend.TensorType.Input:
name = "input{}".format(self.count_in) name = f"input{self.count_in}_{tensor.guid()}"
else: else:
name = "weight{}".format(self.count_in) name = f"weight{self.count_in}_{tensor.guid()}"
self.names[tensor] = name self.names[tensor] = name
if init != None: if init != None:
init.name = name init.name = name
@ -706,7 +706,7 @@ class OnnxStub:
for it in op.inputs() for it in op.inputs()
] ]
outputs = [ outputs = [
ctx.push_output("{}_{}".format(name, i), it) ctx.push_output(f"{name}_{i}_{it.guid()}", it)
for (i, it) in enumerate(op.outputs()) for (i, it) in enumerate(op.outputs())
] ]
if ty == backend.OpType.Conv: if ty == backend.OpType.Conv: