Skip to content

Commit 9b3e51d

Browse files
committed
Check that metadata file is created
1 parent 8091216 commit 9b3e51d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

onnxruntime/core/providers/openvino/openvino_execution_provider.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ common::Status OpenVINOExecutionProvider::Compile(
114114
}
115115

116116
// Metadata is always read from model location, this could be a source or epctx model
117-
fs::path metadata_filename = context_model_file_path.filename().stem().string() + "_metadata.bin";
117+
fs::path metadata_filename = context_model_file_path.stem().string() + "_metadata.bin";
118118
fs::path metadata_file_path = context_model_file_path.parent_path() / metadata_filename;
119119
std::ifstream file(metadata_file_path, std::ios::binary);
120120
ORT_RETURN_IF_NOT(file, "Metadata file was not found: " + metadata_file_path.string());
@@ -202,9 +202,9 @@ common::Status OpenVINOExecutionProvider::Compile(
202202
// If saving metadata then save it to the provided path or ose the original model path
203203
// Multiple calls to Compile() will update the metadata and for the last call
204204
// the resulting file will contain the aggregated content
205-
if (std::ofstream file{metadata_file_path, std::ios::binary}) {
206-
file << metadata;
207-
}
205+
std::ofstream file{metadata_file_path, std::ios::binary};
206+
ORT_RETURN_IF_NOT(file, "Metadata file could not be written: ", metadata_file_path);
207+
file << metadata;
208208
}
209209

210210
return status;

0 commit comments

Comments
 (0)