import numpy as np
import onnx
onnx_model = onnx.load("./xxx.onnx")
graph = onnx_model.graph
node = graph.node
for i in range(len(node)):
if node[i].op_type == 'Add':
node_rise = node[i]
if node_rise.output[0] == '58':
print(i)
import numpy as np
import onnx
onnx_model = onnx.load("./xxx.onnx")
graph = onnx_model.graph
old_nodes = graph.node
new_nodes = old_nodes[:20]
del onnx_model.graph.node[19:]
#onnx_model.graph.node.extend(new_nodes)
onnx_model.graph.node[18].output[0] ='xxx_output' #原out name
onnx.checker.check_model(onnx_model)
onnx.save(onnx_model, "./xxxx.onnx")
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)