Skip to content

Commit

Permalink
Removed not needed guards.
Browse files Browse the repository at this point in the history
  • Loading branch information
popovaan committed Jul 2, 2024
1 parent f3c9d05 commit f3359cc
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/bindings/python/src/pyopenvino/frontend/frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void regclass_frontend_FrontEnd(py::module m) {
py::isinstance<py::str>(py_obj)) {

// Fix unicode path
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT)
return self.load(ov::util::string_to_wstring(model_path.c_str()));
#else
return self.load(model_path.c_str());
Expand Down Expand Up @@ -89,7 +89,7 @@ void regclass_frontend_FrontEnd(py::module m) {
py::isinstance<py::str>(model)) {

// Fix unicode path
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT)
return self.supported(ov::util::string_to_wstring(model_path.c_str()));
#else
return self.supported(model_path.c_str());
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/src/pyopenvino/frontend/manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void regclass_frontend_FrontEndManager(py::module m) {
std::string model_path = Common::utils::convert_path_to_string(model);

// Fix unicode path
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT)
return fem->load_by_model(ov::util::string_to_wstring(model_path.c_str()));
#else
std::string model_path_str = model_path;
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/src/pyopenvino/pyopenvino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ PYBIND11_MODULE(_pyopenvino, m) {
throw py::attribute_error("'model' argument is required and cannot be None.");
}
// Fix unicode path
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT)
ov::save_model(model,
ov::util::string_to_wstring(Common::utils::convert_path_to_string(xml_path)),
compress_to_fp16);
Expand Down
2 changes: 1 addition & 1 deletion src/core/include/openvino/core/graph_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ void save_model(const std::shared_ptr<const ov::Model>& model,
const std::string& output_model,
bool compress_to_fp16 = true);

#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT)
OPENVINO_API
void save_model(const std::shared_ptr<const ov::Model>& model,
const std::wstring& output_model,
Expand Down
4 changes: 2 additions & 2 deletions src/core/include/openvino/pass/serialize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class OPENVINO_API Serialize : public ov::pass::ModelPass {

Serialize(const std::string& xmlPath, const std::string& binPath, Version version = Version::UNSPECIFIED);

#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT)
Serialize(const std::wstring& xmlPath, const std::wstring& binPath, Version version = Version::UNSPECIFIED);
#endif

Expand All @@ -46,7 +46,7 @@ class OPENVINO_API Serialize : public ov::pass::ModelPass {
const std::string m_binPath;
const Version m_version;
const std::map<std::string, ov::OpSet> m_custom_opsets;
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT)
const std::wstring m_xmlPath_wchar;
const std::wstring m_binPath_wchar;
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/graph_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ void save_model(const std::shared_ptr<const ov::Model>& m, const std::string& ou
manager.run_passes(std::move(cloned));
}

#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT)
void save_model(const std::shared_ptr<const ov::Model>& m, const std::wstring& output_model, bool compress_to_fp16) {
auto cloned = m->clone();
if (compress_to_fp16) {
Expand Down
14 changes: 7 additions & 7 deletions src/core/src/pass/serialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ std::string valid_xml_path(const std::string& path) {
return path;
}

#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT)
std::wstring valid_xml_path(const std::wstring& path) {
OPENVINO_ASSERT(path.size() > 4, "Path for xml file is too short.");

Expand Down Expand Up @@ -1234,7 +1234,7 @@ bool pass::Serialize::run_on_model(const std::shared_ptr<ov::Model>& model) {
if (xmlDir != m_xmlPath)
ov::util::create_directory_recursive(xmlDir);
}
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT)
else {
auto xmlDir = ov::util::get_directory(m_xmlPath_wchar);
if (xmlDir != m_xmlPath_wchar)
Expand All @@ -1252,7 +1252,7 @@ bool pass::Serialize::run_on_model(const std::shared_ptr<ov::Model>& model) {
xml_file.open(m_xmlPath, std::ios::out);
OPENVINO_ASSERT(xml_file, "Can't open xml file: \"" + m_xmlPath + "\"");
}
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT)
else {
bin_file.open(m_binPath_wchar.c_str(), std::ios::out | std::ios::binary);
OPENVINO_ASSERT(bin_file, "Can't open bin file.");
Expand All @@ -1273,7 +1273,7 @@ bool pass::Serialize::run_on_model(const std::shared_ptr<ov::Model>& model) {
bin_file.close();
std::remove(m_xmlPath.c_str());
std::remove(m_binPath.c_str());
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT)
_wremove(m_xmlPath_wchar.c_str());
_wremove(m_binPath_wchar.c_str());
#endif
Expand All @@ -1290,7 +1290,7 @@ pass::Serialize::Serialize(std::ostream& xmlFile, std::ostream& binFile, pass::S
m_binFile{&binFile},
m_xmlPath{},
m_binPath{},
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT)
m_xmlPath_wchar{},
m_binPath_wchar{},
#endif
Expand All @@ -1302,14 +1302,14 @@ pass::Serialize::Serialize(const std::string& xmlPath, const std::string& binPat
m_binFile{nullptr},
m_xmlPath{valid_xml_path(xmlPath)},
m_binPath{provide_bin_path(xmlPath, binPath)},
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT)
m_xmlPath_wchar{},
m_binPath_wchar{},
#endif
m_version{version} {
}

#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT)
pass::Serialize::Serialize(const std::wstring& xmlPath, const std::wstring& binPath, pass::Serialize::Version version)
: m_xmlFile{nullptr},
m_binFile{nullptr},
Expand Down

0 comments on commit f3359cc

Please sign in to comment.