Skip to content

Commit 0b6ae3c

Browse files
committed
Update InputModel
1 parent 1ac8664 commit 0b6ae3c

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/frontends/ir/src/frontend.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ InputModel::Ptr FrontEnd::load_impl(const std::vector<ov::Any>& variants) const
163163
return exts;
164164
};
165165

166-
auto create_input_model = [&](std::string weights_path) -> std::shared_ptr<InputModel> {
166+
auto create_input_model = [&](std::filesystem::path weights_path) -> std::shared_ptr<InputModel> {
167167
if (provided_model_stream) {
168168
return std::make_shared<InputModel>(*provided_model_stream,
169169
weights,
@@ -243,7 +243,7 @@ InputModel::Ptr FrontEnd::load_impl(const std::vector<ov::Any>& variants) const
243243
}
244244
}
245245

246-
return create_input_model(ov::util::path_to_string(weights_path));
246+
return create_input_model(weights_path);
247247
}
248248

249249
std::shared_ptr<ov::Model> FrontEnd::convert(const InputModel::Ptr& model) const {

src/frontends/ir/src/input_model.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,13 @@ class InputModel::InputModelIRImpl {
208208
std::unordered_map<std::string, ov::OpSet> m_opsets;
209209
pugi::xml_node m_root;
210210
pugi::xml_document m_xml_doc;
211-
std::string m_weights_path;
211+
std::filesystem::path m_weights_path;
212212

213213
public:
214214
InputModelIRImpl(std::istream& model,
215215
const std::shared_ptr<ov::AlignedBuffer>& weights,
216216
const std::unordered_map<ov::DiscreteTypeInfo, ov::BaseOpExtension::Ptr>& extensions,
217-
std::string weights_path)
217+
std::filesystem::path weights_path)
218218
: m_weights(weights),
219219
m_extensions(extensions),
220220
m_weights_path(std::move(weights_path)) {
@@ -226,7 +226,7 @@ class InputModel::InputModelIRImpl {
226226
InputModelIRImpl(const std::shared_ptr<ov::AlignedBuffer>& model,
227227
const std::shared_ptr<ov::AlignedBuffer>& weights,
228228
const std::unordered_map<ov::DiscreteTypeInfo, ov::BaseOpExtension::Ptr>& extensions,
229-
std::string weights_path)
229+
std::filesystem::path weights_path)
230230
: m_weights(weights),
231231
m_extensions(extensions),
232232
m_weights_path(std::move(weights_path)) {
@@ -249,14 +249,14 @@ class InputModel::InputModelIRImpl {
249249
InputModel::InputModel(std::istream& model,
250250
const std::shared_ptr<ov::AlignedBuffer>& weights,
251251
const std::unordered_map<ov::DiscreteTypeInfo, ov::BaseOpExtension::Ptr>& extensions,
252-
std::string weights_path) {
252+
std::filesystem::path weights_path) {
253253
_impl = std::make_shared<InputModelIRImpl>(model, weights, extensions, std::move(weights_path));
254254
}
255255

256256
InputModel::InputModel(const std::shared_ptr<ov::AlignedBuffer>& model,
257257
const std::shared_ptr<ov::AlignedBuffer>& weights,
258258
const std::unordered_map<ov::DiscreteTypeInfo, ov::BaseOpExtension::Ptr>& extensions,
259-
std::string weights_path) {
259+
std::filesystem::path weights_path) {
260260
_impl = std::make_shared<InputModelIRImpl>(model, weights, extensions, std::move(weights_path));
261261
}
262262

@@ -274,7 +274,7 @@ std::shared_ptr<ov::Model> InputModel::InputModelIRImpl::convert() {
274274
visitor.on_attribute("net", model);
275275
model->get_rt_info()["version"] = int64_t(version);
276276
if (!m_weights_path.empty())
277-
model->get_rt_info()["__weights_path"] = m_weights_path;
277+
model->get_rt_info()["__weights_path"] = ov::util::path_to_string(m_weights_path);
278278
parse_pre_process(m_root, m_weights, model);
279279

280280
return model;

src/frontends/ir/src/input_model.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#pragma once
66

7+
#include <filesystem>
78
#include <istream>
89
#include <memory>
910

@@ -23,12 +24,12 @@ class InputModel : public ov::frontend::InputModel {
2324
InputModel(std::istream& stream,
2425
const std::shared_ptr<ov::AlignedBuffer>& weights,
2526
const std::unordered_map<ov::DiscreteTypeInfo, ov::BaseOpExtension::Ptr>& extensions,
26-
std::string weights_path = {});
27+
std::filesystem::path weights_path = {});
2728

2829
InputModel(const std::shared_ptr<ov::AlignedBuffer>& model_buf,
2930
const std::shared_ptr<ov::AlignedBuffer>& weights,
3031
const std::unordered_map<ov::DiscreteTypeInfo, ov::BaseOpExtension::Ptr>& extensions,
31-
std::string weights_path = {});
32+
std::filesystem::path weights_path = {});
3233

3334
std::shared_ptr<Model> convert();
3435
};

0 commit comments

Comments
 (0)