From 5fe882e5503d7d244e60c587f7b9e16db3095a39 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Fri, 12 Feb 2021 11:45:51 +0300 Subject: [PATCH] CVS-48367: Enable HoldersTestOnImportedNetwork test on GNA (#4230) --- .../src/gna_plugin/gna_executable_network.hpp | 4 ++-- inference-engine/src/gna_plugin/gna_plugin.cpp | 7 +++++-- inference-engine/src/gna_plugin/gna_plugin.hpp | 1 + .../shared_tests_instances/behavior/cpp_holders.cpp | 10 ++++++++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/inference-engine/src/gna_plugin/gna_executable_network.hpp b/inference-engine/src/gna_plugin/gna_executable_network.hpp index 2aea7b80d40..0193586a026 100644 --- a/inference-engine/src/gna_plugin/gna_executable_network.hpp +++ b/inference-engine/src/gna_plugin/gna_executable_network.hpp @@ -74,8 +74,8 @@ class GNAExecutableNetwork : public InferenceEngine::ExecutableNetworkThreadSafe using ExecutableNetworkInternal::Export; - void ExportImpl(std::ostream&) override { - THROW_IE_EXCEPTION_WITH_STATUS(NOT_IMPLEMENTED); + void Export(std::ostream& modelStream) override { + plg->Export(modelStream); } void SetConfig(const std::map& config) override { diff --git a/inference-engine/src/gna_plugin/gna_plugin.cpp b/inference-engine/src/gna_plugin/gna_plugin.cpp index 9409afc426b..c4e6b267e38 100644 --- a/inference-engine/src/gna_plugin/gna_plugin.cpp +++ b/inference-engine/src/gna_plugin/gna_plugin.cpp @@ -1583,6 +1583,11 @@ InferenceEngine::ExecutableNetwork GNAPlugin::ImportNetwork(std::istream& networ } void GNAPlugin::Export(const std::string &fileName) { + std::fstream outStream(fileName, ios_base::out | ios_base::binary); + Export(outStream); +} + +void GNAPlugin::Export(std::ostream &outStream) { if (inputsDesc->ptr_inputs_global_id.empty() || outputsDesc.empty()) { THROW_GNA_EXCEPTION << " network not loaded"; } @@ -1593,8 +1598,6 @@ void GNAPlugin::Export(const std::string &fileName) { } #endif - std::fstream outStream(fileName, ios_base::out | ios_base::binary); - // TODO: nnet group parameter looks only used in application - so can we move this line into load network. IE_ASSERT(!inputsDataMap.empty()); auto inputDims = inputsDataMap.begin()->second->getTensorDesc().getDims(); diff --git a/inference-engine/src/gna_plugin/gna_plugin.hpp b/inference-engine/src/gna_plugin/gna_plugin.hpp index 32f09cb9a5d..1a6e20d558c 100644 --- a/inference-engine/src/gna_plugin/gna_plugin.hpp +++ b/inference-engine/src/gna_plugin/gna_plugin.hpp @@ -128,6 +128,7 @@ class GNAPlugin : public InferenceEngine::IInferencePlugin { void Wait(uint32_t sync, InferenceEngine::Blob &result) { THROW_GNA_EXCEPTION << "Not implemented"; } void Export(const std::string &fileName); + void Export(std::ostream &networkModel); InferenceEngine::ExecutableNetwork ImportNetwork(const std::string &modelFileName, const std::map &config) override { THROW_GNA_EXCEPTION << "Not implemented"; diff --git a/inference-engine/tests/functional/plugin/gna/shared_tests_instances/behavior/cpp_holders.cpp b/inference-engine/tests/functional/plugin/gna/shared_tests_instances/behavior/cpp_holders.cpp index c14c4dc1729..666fef809b7 100644 --- a/inference-engine/tests/functional/plugin/gna/shared_tests_instances/behavior/cpp_holders.cpp +++ b/inference-engine/tests/functional/plugin/gna/shared_tests_instances/behavior/cpp_holders.cpp @@ -27,4 +27,14 @@ namespace { ::testing::ValuesIn(orders)), HoldersTest::getTestCaseName); + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, HoldersTestImportNetwork, + ::testing::Combine( + ::testing::Values(CommonTestUtils::DEVICE_GNA), + ::testing::ValuesIn(orders)), + HoldersTest::getTestCaseName); + + INSTANTIATE_TEST_CASE_P(smoke_BehaviorTests, HoldersTestOnImportedNetwork, + ::testing::Values(CommonTestUtils::DEVICE_GNA), + HoldersTestOnImportedNetwork::getTestCaseName); + } // namespace \ No newline at end of file