Skip to content

Commit b52c4b0

Browse files
authored
fix bug: convert char '/' to '-' (#1110)
1 parent 31903cf commit b52c4b0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/align_tool/align_with_onnx.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def __call__(self):
101101

102102
# set inputs , you can change your input here
103103
input_shape = session.get_inputs()[0].shape
104+
print(input_shape)
104105
if self.tengine_model is not None:
105106
input_array = np.random.randn(*input_shape).astype(np.float32)
106107
else:
@@ -139,7 +140,7 @@ def _save_result(self, outputs, result, const_name):
139140
print("-------------------------------------------------")
140141
print("export onnx output to text , please wait a moment")
141142
for one_node in tqdm(self.onnx_model.graph.node):
142-
sufix = self.export_path + '/' + one_node.name
143+
sufix = self.export_path + '/' + one_node.name.replace('/','-')
143144
for i, input in enumerate(one_node.input):
144145
if input not in const_name:
145146
self._write_data(sufix + f'_in_blob_data.txt', result[outputs.index(input)])
@@ -265,7 +266,7 @@ def _align_by_layer(self, outputs, result):
265266
print(out_info)
266267

267268
for one_node in self.onnx_model.graph.node:
268-
text_file_name = [one_node.name + "_out_blob_data.txt", one_node.name + "_in_blob_data.txt"]
269+
text_file_name = [(one_node.name + "_out_blob_data.txt").replace('/','-'), (one_node.name + "_in_blob_data.txt").replace('/','-')]
269270

270271
def compare_and_write(file_name, compare_input=False):
271272
if file_name in tm_txt_list:

0 commit comments

Comments
 (0)