forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework model loading in FE manager, implement PDPD probing (openvinot…
…oolkit#6358) * Rework model loading in FE manager, implement PDPD probing * Fix build * Fix build * Fix build * Fix unicode * Fix merge issues * Fix codestyle * Read frontends path from frontend_manager library location * Fix codestyle * Fix FE dependency * Fix dependencies * Fix codestyle * Check if model file exists * Revert adding model to lfs * Add test model * Fix cmake dependencies * Apply review feedback * Revert pugixml * make getFrontendLibraryPath not public API * Fix codestyle * Apply fix from Ilya Lavrenov * Add FE dependency in legacy tests * Remove not needed dependency * Better support Unicode * Fix build * Fix build * Fix build * Add dependency foe deprecated tests * Fix dependency * Fix typo * Revert adding FE dependency to IESharedTests * Remove relative paths from frontend unit tests * Apply review feedback * Fix typo * Return allow-undefined, since kmb dependecies fail to link * Fix merge conflict * Compare functions in reader tests * Simplify code to load from variants * Remove supported_by_arguments from public api * Fix codestyle * Fix build * Compare names in reader tests * Fix wchar in variant Co-authored-by: Ilya Churaev <[email protected]>
- Loading branch information
Showing
48 changed files
with
727 additions
and
390 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+7.66 KB
inference-engine/tests/functional/inference_engine/pdpd_reader/models/relu.pdmodel
Binary file not shown.
Binary file added
BIN
+7.66 KB
inference-engine/tests/functional/inference_engine/pdpd_reader/models/ひらがな日本語.pdmodel
Binary file not shown.
84 changes: 84 additions & 0 deletions
84
inference-engine/tests/functional/inference_engine/pdpd_reader/read_pdpd_model_test.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// Copyright (C) 2018-2021 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include <gtest/gtest.h> | ||
#include <set> | ||
#include <string> | ||
#include <fstream> | ||
|
||
#include <ie_blob.h> | ||
#include <ie_core.hpp> | ||
#include <file_utils.h> | ||
#include <ngraph/ngraph.hpp> | ||
#include <ngraph/opsets/opset8.hpp> | ||
#include "common_test_utils/ngraph_test_utils.hpp" | ||
|
||
TEST(PDPD_Reader_Tests, ImportBasicModelToCore) { | ||
auto model = std::string(PDPD_TEST_MODELS) + "relu.pdmodel"; | ||
InferenceEngine::Core ie; | ||
auto cnnNetwork = ie.ReadNetwork(model); | ||
auto function = cnnNetwork.getFunction(); | ||
|
||
const auto inputType = ngraph::element::f32; | ||
const auto inputShape = ngraph::Shape{ 3 }; | ||
|
||
const auto data = std::make_shared<ngraph::opset8::Parameter>(inputType, inputShape); | ||
data->set_friendly_name("x"); | ||
data->output(0).get_tensor().add_names({ "x" }); | ||
const auto relu = std::make_shared<ngraph::opset8::Relu>(data->output(0)); | ||
relu->set_friendly_name("relu_0.tmp_0"); | ||
relu->output(0).get_tensor().add_names({ "relu_0.tmp_0" }); | ||
const auto scale = std::make_shared<ngraph::opset8::Constant>(ngraph::element::f32, ngraph::Shape{ 1 }, std::vector<float>{1}); | ||
const auto bias = std::make_shared<ngraph::opset8::Constant>(ngraph::element::f32, ngraph::Shape{ 1 }, std::vector<float>{0}); | ||
const auto node_multiply = std::make_shared<ngraph::opset8::Multiply>(relu->output(0), scale); | ||
const auto node_add = std::make_shared<ngraph::opset8::Add>(node_multiply, bias); | ||
node_add->set_friendly_name("save_infer_model/scale_0.tmp_1"); | ||
node_add->output(0).get_tensor().add_names({ "save_infer_model/scale_0.tmp_1" }); | ||
const auto result = std::make_shared<ngraph::opset8::Result>(node_add->output(0)); | ||
result->set_friendly_name("save_infer_model/scale_0.tmp_1/Result"); | ||
const auto reference = std::make_shared<ngraph::Function>( | ||
ngraph::NodeVector{ result }, | ||
ngraph::ParameterVector{ data }, | ||
"RefPDPDFunction"); | ||
const FunctionsComparator func_comparator = FunctionsComparator::with_default().enable(FunctionsComparator::NAMES); | ||
const FunctionsComparator::Result res = func_comparator(function, reference); | ||
ASSERT_TRUE(res.valid); | ||
} | ||
|
||
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) | ||
TEST(PDPD_Reader_Tests, ImportBasicModelToCoreWstring) { | ||
std::string win_dir_path{ PDPD_TEST_MODELS }; | ||
std::replace(win_dir_path.begin(), win_dir_path.end(), '/', '\\'); | ||
const std::wstring unicode_win_dir_path = FileUtils::multiByteCharToWString(win_dir_path.c_str()); | ||
auto model = unicode_win_dir_path + L"ひらがな日本語.pdmodel"; | ||
InferenceEngine::Core ie; | ||
auto cnnNetwork = ie.ReadNetwork(model); | ||
auto function = cnnNetwork.getFunction(); | ||
|
||
const auto inputType = ngraph::element::f32; | ||
const auto inputShape = ngraph::Shape{ 3 }; | ||
|
||
const auto data = std::make_shared<ngraph::opset8::Parameter>(inputType, inputShape); | ||
data->set_friendly_name("x"); | ||
data->output(0).get_tensor().add_names({ "x" }); | ||
const auto relu = std::make_shared<ngraph::opset8::Relu>(data->output(0)); | ||
relu->set_friendly_name("relu_0.tmp_0"); | ||
relu->output(0).get_tensor().add_names({ "relu_0.tmp_0" }); | ||
const auto scale = std::make_shared<ngraph::opset8::Constant>(ngraph::element::f32, ngraph::Shape{ 1 }, std::vector<float>{1}); | ||
const auto bias = std::make_shared<ngraph::opset8::Constant>(ngraph::element::f32, ngraph::Shape{ 1 }, std::vector<float>{0}); | ||
const auto node_multiply = std::make_shared<ngraph::opset8::Multiply>(relu->output(0), scale); | ||
const auto node_add = std::make_shared<ngraph::opset8::Add>(node_multiply, bias); | ||
node_add->set_friendly_name("save_infer_model/scale_0.tmp_1"); | ||
node_add->output(0).get_tensor().add_names({ "save_infer_model/scale_0.tmp_1" }); | ||
const auto result = std::make_shared<ngraph::opset8::Result>(node_add->output(0)); | ||
result->set_friendly_name("save_infer_model/scale_0.tmp_1/Result"); | ||
const auto reference = std::make_shared<ngraph::Function>( | ||
ngraph::NodeVector{ result }, | ||
ngraph::ParameterVector{ data }, | ||
"RefPDPDFunction"); | ||
const FunctionsComparator func_comparator = FunctionsComparator::with_default().enable(FunctionsComparator::NAMES); | ||
const FunctionsComparator::Result res = func_comparator(function, reference); | ||
ASSERT_TRUE(res.valid); | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.