mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-11 17:48:34 +00:00
opset12 code cleanup (#4242)
* opset12 code cleanup * opset12 code cleanup Co-authored-by: Ethan Tao <ettao@microsoft.com>
This commit is contained in:
parent
e0334f177c
commit
5d28efd434
3 changed files with 8 additions and 23 deletions
|
|
@ -11,7 +11,7 @@ import urllib.request
|
|||
import zipfile
|
||||
|
||||
# update these if the E2E test data changes
|
||||
ARCHIVE_BLOB_URL = "https://onnxruntimetestdata.blob.core.windows.net/training/onnxruntime_training_data_v12.zip?snapshot=2020-06-13T06:24:15.0833240Z"
|
||||
ARCHIVE_BLOB_URL = "https://onnxruntimetestdata.blob.core.windows.net/training/onnxruntime_training_data.zip?snapshot=2020-06-15T23:17:35.8314853Z"
|
||||
ARCHIVE_SHA256_DIGEST = "B01C169B6550D1A0A6F1B4E2F34AE2A8714B52DBB70AC04DA85D371F691BDFF9"
|
||||
|
||||
def _download(url, local_path):
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
step,total_loss,mlm_loss,nsp_loss
|
||||
0,11.2422,10.5228,0.717476
|
||||
5,10.1875,7.75453,2.43238
|
||||
10,8.42188,7.63755,0.792425
|
||||
10,8.42578,7.63755,0.792425
|
||||
15,8.35156,7.60502,0.744699
|
||||
20,8.22656,7.4854,0.749099
|
||||
25,8.29688,7.56207,0.73899
|
||||
|
|
|
|||
|
|
|
@ -25,9 +25,10 @@ if len(sys.argv) < 2:
|
|||
|
||||
input_model_name = sys.argv[1]
|
||||
output_model_name = input_model_name[:-5] + '_opset12.onnx'
|
||||
|
||||
model = onnx.load(input_model_name)
|
||||
|
||||
# for a given node input, look thru the graph nodes and find the node
|
||||
# whose output is matching the input
|
||||
def find_input_node(model, arg):
|
||||
result = []
|
||||
for node in model.graph.node:
|
||||
|
|
@ -36,27 +37,11 @@ def find_input_node(model, arg):
|
|||
result.append(node)
|
||||
return result[0] if len(result)== 1 else None
|
||||
|
||||
def find_output_node(model, arg):
|
||||
result = []
|
||||
for node in model.graph.node:
|
||||
for input in node.input:
|
||||
if input == arg:
|
||||
result.append(node)
|
||||
return result[0] if len(result) == 1 else None
|
||||
|
||||
def find_input(model, arg):
|
||||
for initializer in model.graph.initializer:
|
||||
if initializer.name == arg:
|
||||
return initializer
|
||||
return None
|
||||
|
||||
def get_node_index(model, node):
|
||||
i = 0
|
||||
while i < len(model.graph.node):
|
||||
if model.graph.node[i] == node:
|
||||
break;
|
||||
i += 1
|
||||
return i if i < len(model.graph.node) else None;
|
||||
for i, graph_node in enumerate(model.graph.node):
|
||||
if graph_node == node:
|
||||
return i
|
||||
return None
|
||||
|
||||
def add_const(model, name, output, t_value = None, f_value = None):
|
||||
const_node = model.graph.node.add()
|
||||
|
|
|
|||
Loading…
Reference in a new issue