Skip to content

Commit d14b200

Browse files
committed
Make sure the path to save onnx zip file exist
Signed-off-by: LinGeLin <[email protected]>
1 parent 0004163 commit d14b200

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tf2onnx/utils.py

+3
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)