diff --git a/src/plugins/intel_gna/gna_plugin_internal.hpp b/src/plugins/intel_gna/gna_plugin_internal.hpp index b3c48c82d8a6b3..d70c390b9a10b7 100644 --- a/src/plugins/intel_gna/gna_plugin_internal.hpp +++ b/src/plugins/intel_gna/gna_plugin_internal.hpp @@ -56,8 +56,11 @@ class GNAPluginInternal : public InferenceEngine::IInferencePlugin { updated_config.UpdateFromMap(config); auto plg = std::make_shared(updated_config.keyConfigMap); plgPtr = plg; + auto network_impl = std::make_shared(modelFileName, plg); + // set pointer for IInferencePlugin interface + network_impl->SetPointerToPlugin(shared_from_this()); - return std::make_shared(modelFileName, plg); + return network_impl; } InferenceEngine::IExecutableNetworkInternal::Ptr ImportNetwork(std::istream& networkModel, @@ -66,7 +69,11 @@ class GNAPluginInternal : public InferenceEngine::IInferencePlugin { updated_config.UpdateFromMap(config); auto plg = std::make_shared(updated_config.keyConfigMap); plgPtr = plg; - return std::make_shared(networkModel, plg); + auto network_impl = std::make_shared(networkModel, plg); + // set pointer for IInferencePlugin interface + network_impl->SetPointerToPlugin(shared_from_this()); + + return network_impl; } std::string GetName() const noexcept override { diff --git a/src/tests/functional/plugin/gna/shared_tests_instances/behavior/ov_plugin/life_time.cpp b/src/tests/functional/plugin/gna/shared_tests_instances/behavior/ov_plugin/life_time.cpp new file mode 100644 index 00000000000000..38881f03ebc661 --- /dev/null +++ b/src/tests/functional/plugin/gna/shared_tests_instances/behavior/ov_plugin/life_time.cpp @@ -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 \ No newline at end of file diff --git a/src/tests/functional/plugin/shared/src/behavior/ov_plugin/life_time.cpp b/src/tests/functional/plugin/shared/src/behavior/ov_plugin/life_time.cpp index b7e67945eb4a85..a6c5970c982cae 100644 --- a/src/tests/functional/plugin/shared/src/behavior/ov_plugin/life_time.cpp +++ b/src/tests/functional/plugin/shared/src/behavior/ov_plugin/life_time.cpp @@ -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;