Skip to content

Commit

Permalink
Fixed import for the new api 2.0 (openvinotoolkit#10175)
Browse files Browse the repository at this point in the history
  • Loading branch information
mryzhov authored Feb 9, 2022
1 parent d28f8b7 commit a002b26
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/plugins/intel_gna/gna_plugin_internal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ class GNAPluginInternal : public InferenceEngine::IInferencePlugin {
updated_config.UpdateFromMap(config);
auto plg = std::make_shared<GNAPlugin>(updated_config.keyConfigMap);
plgPtr = plg;
auto network_impl = std::make_shared<GNAExecutableNetwork>(modelFileName, plg);
// set pointer for IInferencePlugin interface
network_impl->SetPointerToPlugin(shared_from_this());

return std::make_shared<GNAExecutableNetwork>(modelFileName, plg);
return network_impl;
}

InferenceEngine::IExecutableNetworkInternal::Ptr ImportNetwork(std::istream& networkModel,
Expand All @@ -66,7 +69,11 @@ class GNAPluginInternal : public InferenceEngine::IInferencePlugin {
updated_config.UpdateFromMap(config);
auto plg = std::make_shared<GNAPlugin>(updated_config.keyConfigMap);
plgPtr = plg;
return std::make_shared<GNAExecutableNetwork>(networkModel, plg);
auto network_impl = std::make_shared<GNAExecutableNetwork>(networkModel, plg);
// set pointer for IInferencePlugin interface
network_impl->SetPointerToPlugin(shared_from_this());

return network_impl;
}

std::string GetName() const noexcept override {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (C) 2018-2022 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include "behavior/ov_plugin/life_time.hpp"

using namespace ov::test::behavior;
namespace {

INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVHoldersTest,
::testing::Values(CommonTestUtils::DEVICE_GNA),
OVHoldersTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVHoldersTestOnImportedNetwork,
::testing::Values(CommonTestUtils::DEVICE_GNA),
OVHoldersTestOnImportedNetwork::getTestCaseName);

} // namespace
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,18 @@ void OVHoldersTestOnImportedNetwork::TearDown() {
::testing::GTEST_FLAG(death_test_style) = deathTestStyle;
}

TEST_P(OVHoldersTestOnImportedNetwork, LoadedTensor) {
ov::Core core = createCoreWithTemplate();
std::stringstream stream;
{
auto compiled_model = core.compile_model(function, targetDevice);
compiled_model.export_model(stream);
}
auto compiled_model = core.import_model(stream, targetDevice);
auto request = compiled_model.create_infer_request();
ov::Tensor tensor = request.get_input_tensor();
}

TEST_P(OVHoldersTestOnImportedNetwork, CreateRequestWithCoreRemoved) {
ov::Core core = createCoreWithTemplate();
std::stringstream stream;
Expand Down

0 comments on commit a002b26

Please sign in to comment.