[CONFORMANCE][SUBGRAPHS DUMPER] Fix warning threated as error (#20279)

* [CONFORMANCE][SUBGRAPHS DUMPER] Fix warning threated as error

* apply comments
This commit is contained in:
Irina Efode 2023-10-06 00:28:47 +04:00 committed by Alexander Nesterov
parent 3bec9a3cd5
commit 7e87d560c1
2 changed files with 14 additions and 14 deletions

View File

@ -11,11 +11,12 @@ using namespace ov::tools::subgraph_dumper;
bool ExtractorsManager::match(const std::shared_ptr<ov::Model> &model, bool ExtractorsManager::match(const std::shared_ptr<ov::Model> &model,
const std::shared_ptr<ov::Model> &ref) { const std::shared_ptr<ov::Model> &ref) {
for (const auto &it : m_extractors) { // `match` is not virtual method in base `SubgraphExtractor` class
if (it.second->match(model, ref)) { // we can use function from any `extractor` to avoid of cycle
if (!m_extractors.empty()) {
if (m_extractors.begin()->second->match(model, ref)) {
return true; return true;
} }
return false;
} }
return false; return false;
} }
@ -25,8 +26,10 @@ ExtractorsManager::is_subgraph(const std::shared_ptr<ov::Model> &model,
const std::shared_ptr<ov::Model> &ref_model, const std::shared_ptr<ov::Model> &ref_model,
const std::map<std::string, InputInfo> &in_info, const std::map<std::string, InputInfo> &in_info,
const std::map<std::string, InputInfo> &in_info_ref) { const std::map<std::string, InputInfo> &in_info_ref) {
for (const auto &it : m_extractors) { if (!m_extractors.empty()) {
auto extractor_res = it.second->is_subgraph(model, ref_model); // `is_subgraph` is not virtual method in base `SubgraphExtractor` class
// we can use function from any `extractor` to avoid of cycle
auto extractor_res = m_extractors.begin()->second->is_subgraph(model, ref_model);
if (std::get<0>(extractor_res)) { if (std::get<0>(extractor_res)) {
std::map<std::string, InputInfo> graph_in_info, subgraph_in_info; std::map<std::string, InputInfo> graph_in_info, subgraph_in_info;
if (std::get<1>(extractor_res) == model && std::get<2>(extractor_res) == ref_model) { if (std::get<1>(extractor_res) == model && std::get<2>(extractor_res) == ref_model) {
@ -40,13 +43,13 @@ ExtractorsManager::is_subgraph(const std::shared_ptr<ov::Model> &model,
} }
try { try {
subgraph_in_info = align_input_info(std::get<2>(extractor_res), std::get<1>(extractor_res), subgraph_in_info, graph_in_info); subgraph_in_info = align_input_info(std::get<2>(extractor_res), std::get<1>(extractor_res), subgraph_in_info, graph_in_info);
} catch(...) { } catch(std::exception) {
return { false, nullptr, nullptr, {}, {} }; return { false, nullptr, nullptr, {}, {} };
} }
return { true, std::get<1>(extractor_res), std::get<2>(extractor_res), graph_in_info, subgraph_in_info }; return { true, std::get<1>(extractor_res), std::get<2>(extractor_res), graph_in_info, subgraph_in_info };
} }
return { false, nullptr, nullptr, {}, {} };
} }
return { false, nullptr, nullptr, {}, {} };
} }
bool ExtractorsManager::match(const std::shared_ptr<ov::Model> &model, bool ExtractorsManager::match(const std::shared_ptr<ov::Model> &model,
@ -57,7 +60,7 @@ bool ExtractorsManager::match(const std::shared_ptr<ov::Model> &model,
try { try {
in_info = align_input_info(model, ref, in_info, in_info_ref); in_info = align_input_info(model, ref, in_info, in_info_ref);
return true; return true;
} catch (...) { } catch (std::exception) {
return false; return false;
} }
} }

View File

@ -52,8 +52,7 @@ find_models(const std::vector<std::string> &dirs, const std::string& regexp) {
} else { } else {
continue; continue;
} }
} catch (...) { } catch (std::exception) {
// } catch (std::exception& e) {
not_read_model.emplace_back(model_file); not_read_model.emplace_back(model_file);
// std::cout << "[ ERROR ] Impossible to read model: " << model_file << std::endl << "Exception: " << e.what(); // std::cout << "[ ERROR ] Impossible to read model: " << model_file << std::endl << "Exception: " << e.what();
} }
@ -101,13 +100,11 @@ std::map<ModelCacheStatus, std::vector<std::string>> cache_models(
cache_status[ModelCacheStatus::LARGE_MODELS_INCLUDED].push_back(model); cache_status[ModelCacheStatus::LARGE_MODELS_INCLUDED].push_back(model);
} }
cache->update_cache(function, model, extract_body, from_cache); cache->update_cache(function, model, extract_body, from_cache);
} catch (...) { } catch (std::exception) {
// } catch (std::exception &e) {
// std::cout << "[ ERROR ] Model processing failed with exception:" << std::endl << e.what() << std::endl; // std::cout << "[ ERROR ] Model processing failed with exception:" << std::endl << e.what() << std::endl;
model_status = ModelCacheStatus::NOT_FULLY_CACHED; model_status = ModelCacheStatus::NOT_FULLY_CACHED;
} }
} catch (...) { } catch (std::exception) {
// } catch (std::exception &e) {
model_status = ModelCacheStatus::NOT_READ; model_status = ModelCacheStatus::NOT_READ;
// std::cout << "[ ERROR ] Model reading failed with exception:" << std::endl << e.what() << std::endl; // std::cout << "[ ERROR ] Model reading failed with exception:" << std::endl << e.what() << std::endl;
} }