Skip to content

Commit f85e88e

Browse files
authored
Make sure the path to save onnx zip file exist (#2351)
Signed-off-by: LinGeLin <1057445597@qq.com>
1 parent 0004163 commit f85e88e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tf2onnx/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ def save_onnx_model(save_path_root, onnx_file_name, feed_dict, model_proto, incl
292292

293293

294294
def save_onnx_zip(target_path, model_proto, external_tensor_storage):
295+
dir_name = os.path.dirname(target_path)
296+
if dir_name:
297+
os.makedirs(dir_name, exist_ok=True)
295298
with zipfile.ZipFile(target_path, 'w') as z:
296299
z.writestr("__MODEL_PROTO.onnx", model_proto.SerializeToString())
297300
for k, v in external_tensor_storage.name_to_tensor_data.items():

0 commit comments

Comments
 (0)