Fixed release oreder (#9218)
This commit is contained in:
1 parent
dbf8fcf556
commit
114d37b28c
33 files changed
+615
-164
No files matched your search
+19
@@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2018-2021 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_TEMPLATE),
|
||||
OVHoldersTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVHoldersTestOnImportedNetwork,
|
||||
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE, "HETERO:TEMPLATE"),
|
||||
OVHoldersTestOnImportedNetwork::getTestCaseName);
|
||||
|
||||
} // namespace
|
||||
@@ -85,6 +85,17 @@ class OPENVINO_API Any {
|
||||
constexpr static const bool value = sizeof(test<std::map<T...>>(nullptr)) == sizeof(char);
|
||||
};
|
||||
|
||||
template <typename... T>
|
||||
struct EqualityComparable<std::vector<T...>> {
|
||||
static void* conv(bool);
|
||||
template <typename U>
|
||||
static char test(decltype(conv(std::declval<typename U::value_type>() ==
|
||||
std::declval<typename U::value_type>())));
|
||||
template <typename U>
|
||||
static long test(...);
|
||||
constexpr static const bool value = sizeof(test<std::vector<T...>>(nullptr)) == sizeof(char);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct HasBaseMemberType {
|
||||
template <class U>
|
||||
@@ -333,7 +344,7 @@ class OPENVINO_API Any {
|
||||
friend class ::ov::runtime::RemoteTensor;
|
||||
friend class ::ov::runtime::InferencePlugin;
|
||||
|
||||
Any(const std::shared_ptr<void>& so, const Any& other);
|
||||
Any(const Any& other, const std::shared_ptr<void>& so);
|
||||
|
||||
void impl_check() const;
|
||||
|
||||
@@ -342,11 +353,32 @@ class OPENVINO_API Any {
|
||||
Base::Ptr _impl;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Default constructor
|
||||
*/
|
||||
/// @brief Default constructor
|
||||
Any() = default;
|
||||
|
||||
/// @brief Default copy constructor
|
||||
/// @param other other Any object
|
||||
Any(const Any& other) = default;
|
||||
|
||||
/// @brief Default copy assignment operator
|
||||
/// @param other other Any object
|
||||
/// @return reference to the current object
|
||||
Any& operator=(const Any& other) = default;
|
||||
|
||||
/// @brief Default move constructor
|
||||
/// @param other other Any object
|
||||
Any(Any&& other) = default;
|
||||
|
||||
/// @brief Default move assignment operator
|
||||
/// @param other other Any object
|
||||
/// @return reference to the current object
|
||||
Any& operator=(Any&& other) = default;
|
||||
|
||||
/**
|
||||
* @brief Destructor presereves unload order of implementation object and reference to library
|
||||
*/
|
||||
~Any();
|
||||
|
||||
/**
|
||||
* @brief Constructor creates any with object
|
||||
*
|
||||
|
||||
@@ -64,25 +64,46 @@ class Tensor;
|
||||
* And constructs default based on `new` `delete` c++ calls allocator if created without parameters
|
||||
*/
|
||||
class OPENVINO_API Allocator {
|
||||
std::shared_ptr<void> _so;
|
||||
AllocatorImpl::Ptr _impl;
|
||||
std::shared_ptr<void> _so;
|
||||
|
||||
/**
|
||||
* @brief Constructs Tensor from the initialized std::shared_ptr
|
||||
* @param impl Initialized shared pointer
|
||||
* @param so Plugin to use. This is required to ensure that Allocator can work properly even if plugin object is
|
||||
* destroyed.
|
||||
* @param impl Initialized shared pointer
|
||||
*/
|
||||
Allocator(const std::shared_ptr<void>& so, const AllocatorImpl::Ptr& impl);
|
||||
Allocator(const AllocatorImpl::Ptr& impl, const std::shared_ptr<void>& so);
|
||||
|
||||
friend class ov::runtime::Tensor;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Creates the default implementation of the OpenVINO allocator.
|
||||
* @brief Destructor presereves unload order of implementation object and reference to library
|
||||
*/
|
||||
~Allocator();
|
||||
|
||||
/// @brief Default constructor
|
||||
Allocator();
|
||||
|
||||
/// @brief Default copy constructor
|
||||
/// @param other other Allocator object
|
||||
Allocator(const Allocator& other) = default;
|
||||
|
||||
/// @brief Default copy assignment operator
|
||||
/// @param other other Allocator object
|
||||
/// @return reference to the current object
|
||||
Allocator& operator=(const Allocator& other) = default;
|
||||
|
||||
/// @brief Default move constructor
|
||||
/// @param other other Allocator object
|
||||
Allocator(Allocator&& other) = default;
|
||||
|
||||
/// @brief Default move assignment operator
|
||||
/// @param other other Allocator object
|
||||
/// @return reference to the current object
|
||||
Allocator& operator=(Allocator&& other) = default;
|
||||
|
||||
/**
|
||||
* @brief Constructs Allocator from the initialized std::shared_ptr
|
||||
* @param impl Initialized shared pointer
|
||||
|
||||
@@ -36,16 +36,16 @@ class VariableState;
|
||||
*/
|
||||
class OPENVINO_API Tensor {
|
||||
protected:
|
||||
std::shared_ptr<void> _so; //!< Reference to dynamicly loaded library
|
||||
std::shared_ptr<InferenceEngine::Blob> _impl; //!< Shared pointer to internal tensor representation
|
||||
std::shared_ptr<void> _so; //!< Reference to dynamically loaded library
|
||||
|
||||
/**
|
||||
* @brief Constructs Tensor from the initialized std::shared_ptr
|
||||
* @param impl Initialized shared pointer
|
||||
* @param so Plugin to use. This is required to ensure that Tensor can work properly even if plugin object is
|
||||
* destroyed.
|
||||
* @param impl Initialized shared pointer
|
||||
*/
|
||||
Tensor(const std::shared_ptr<void>& so, const std::shared_ptr<InferenceEngine::Blob>& impl);
|
||||
Tensor(const std::shared_ptr<InferenceEngine::Blob>& impl, const std::shared_ptr<void>& so);
|
||||
|
||||
friend class ov::runtime::Core;
|
||||
friend class ov::runtime::InferRequest;
|
||||
@@ -53,6 +53,32 @@ protected:
|
||||
friend class ov::runtime::VariableState;
|
||||
|
||||
public:
|
||||
/// @brief Default constructor
|
||||
Tensor() = default;
|
||||
|
||||
/// @brief Default copy constructor
|
||||
/// @param other other Tensor object
|
||||
Tensor(const Tensor& other) = default;
|
||||
|
||||
/// @brief Default copy assignment operator
|
||||
/// @param other other Tensor object
|
||||
/// @return reference to the current object
|
||||
Tensor& operator=(const Tensor& other) = default;
|
||||
|
||||
/// @brief Default move constructor
|
||||
/// @param other other Tensor object
|
||||
Tensor(Tensor&& other) = default;
|
||||
|
||||
/// @brief Default move assignment operator
|
||||
/// @param other other Tensor object
|
||||
/// @return reference to the current object
|
||||
Tensor& operator=(Tensor&& other) = default;
|
||||
|
||||
/**
|
||||
* @brief Destructor presereves unload order of implementation object and reference to library
|
||||
*/
|
||||
~Tensor();
|
||||
|
||||
/**
|
||||
* @brief Checks openvino tensor type
|
||||
* @param tensor a tensor which type will be checked
|
||||
@@ -60,11 +86,6 @@ public:
|
||||
*/
|
||||
static void type_check(const Tensor& tensor);
|
||||
|
||||
/**
|
||||
* @brief Default constructor
|
||||
*/
|
||||
Tensor() = default;
|
||||
|
||||
/**
|
||||
* @brief Constructs Tensor using element type and shape. Allocate internal host storage using default allocator
|
||||
* @param type Tensor element type
|
||||
|
||||
@@ -40,7 +40,12 @@ bool Any::Base::visit_attributes(AttributeVisitor& visitor) const {
|
||||
return const_cast<Any::Base*>(this)->visit_attributes(visitor);
|
||||
}
|
||||
|
||||
Any::Any(const std::shared_ptr<void>& so, const Any& other) : _so{so}, _impl{other._impl} {}
|
||||
Any::~Any() {
|
||||
_runtime_attribute_impl = {};
|
||||
_impl = {};
|
||||
}
|
||||
|
||||
Any::Any(const Any& other, const std::shared_ptr<void>& so) : _impl{other._impl}, _so{so} {}
|
||||
|
||||
Any::Any(const char* str) : Any(std::string{str}) {}
|
||||
|
||||
|
||||
@@ -14,9 +14,13 @@ namespace runtime {
|
||||
|
||||
Allocator::Allocator() : _impl{std::make_shared<BlobAllocator>()} {}
|
||||
|
||||
Allocator::Allocator(const std::shared_ptr<void>& so, const std::shared_ptr<AllocatorImpl>& impl)
|
||||
: _so{so},
|
||||
_impl{impl} {
|
||||
Allocator::~Allocator() {
|
||||
_impl = {};
|
||||
}
|
||||
|
||||
Allocator::Allocator(const std::shared_ptr<AllocatorImpl>& impl, const std::shared_ptr<void>& so)
|
||||
: _impl{impl},
|
||||
_so{so} {
|
||||
OPENVINO_ASSERT(_impl != nullptr, "Allocator was not initialized.");
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,11 @@ namespace runtime {
|
||||
|
||||
void Tensor::type_check(const Tensor&) {}
|
||||
|
||||
Tensor::Tensor(const std::shared_ptr<void>& so, const std::shared_ptr<ie::Blob>& impl) : _so{so}, _impl{impl} {
|
||||
Tensor::~Tensor() {
|
||||
_impl = {};
|
||||
}
|
||||
|
||||
Tensor::Tensor(const std::shared_ptr<ie::Blob>& impl, const std::shared_ptr<void>& so) : _impl{impl}, _so{so} {
|
||||
OPENVINO_ASSERT(_impl != nullptr, "Tensor was not initialized.");
|
||||
}
|
||||
|
||||
|
||||
@@ -13,15 +13,19 @@ namespace detail {
|
||||
|
||||
class OPENVINO_API SOExtension : public Extension {
|
||||
public:
|
||||
SOExtension(const std::shared_ptr<void>& so, const Extension::Ptr& ext) : m_so(so), m_ext(ext) {}
|
||||
~SOExtension() {
|
||||
m_ext = {};
|
||||
}
|
||||
|
||||
SOExtension(const Extension::Ptr& ext, const std::shared_ptr<void>& so) : m_ext(ext), m_so(so) {}
|
||||
|
||||
const Extension::Ptr& extension() const;
|
||||
|
||||
const std::shared_ptr<void> shared_object() const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<void> m_so;
|
||||
Extension::Ptr m_ext;
|
||||
std::shared_ptr<void> m_so;
|
||||
};
|
||||
|
||||
inline std::vector<Extension::Ptr> load_extensions(const std::string& path) {
|
||||
@@ -34,7 +38,7 @@ inline std::vector<Extension::Ptr> load_extensions(const std::string& path) {
|
||||
so_extensions.reserve(extensions.size());
|
||||
|
||||
for (auto&& ex : extensions) {
|
||||
so_extensions.emplace_back(std::make_shared<SOExtension>(so, ex));
|
||||
so_extensions.emplace_back(std::make_shared<SOExtension>(ex, so));
|
||||
}
|
||||
return so_extensions;
|
||||
}
|
||||
|
||||
@@ -31,10 +31,18 @@ struct SoPtr {
|
||||
SoPtr() = default;
|
||||
|
||||
/**
|
||||
* @brief Constructs an object with existing shared object reference and loaded pointer
|
||||
* @param soLoader Existing pointer to a library loader
|
||||
* @brief Destructor presereves unload order of implementation object and reference to library
|
||||
*/
|
||||
SoPtr(const std::shared_ptr<void>& so, const std::shared_ptr<T>& ptr) : _so{so}, _ptr{ptr} {}
|
||||
~SoPtr() {
|
||||
_ptr = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Constructs an object with existing shared object reference and loaded pointer
|
||||
* @param ptr pointer to the loaded object
|
||||
* @param so Existing reference to library
|
||||
*/
|
||||
SoPtr(const std::shared_ptr<T>& ptr, const std::shared_ptr<void>& so) : _ptr{ptr}, _so{so} {}
|
||||
|
||||
/**
|
||||
* @brief The copy-like constructor, can create So Pointer that dereferenced into child type if T is derived of U
|
||||
@@ -71,15 +79,15 @@ struct SoPtr {
|
||||
return static_cast<bool>(ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The shared object or dinamic loaded library
|
||||
*/
|
||||
std::shared_ptr<void> _so;
|
||||
|
||||
/**
|
||||
* @brief Gets a smart pointer to the custom object
|
||||
*/
|
||||
std::shared_ptr<T> _ptr;
|
||||
|
||||
/**
|
||||
* @brief The shared object or dinamic loaded library
|
||||
*/
|
||||
std::shared_ptr<void> _so;
|
||||
};
|
||||
} // namespace runtime
|
||||
} // namespace ov
|
||||
@@ -35,25 +35,46 @@ class IExecutableNetworkInternal;
|
||||
* @brief This is an interface of an executable network
|
||||
*/
|
||||
class INFERENCE_ENGINE_API_CLASS(ExecutableNetwork) {
|
||||
std::shared_ptr<void> _so;
|
||||
std::shared_ptr<IExecutableNetworkInternal> _impl;
|
||||
std::shared_ptr<void> _so;
|
||||
|
||||
/**
|
||||
* @brief Constructs ExecutableNetwork from the initialized std::shared_ptr
|
||||
* @param impl Initialized shared pointer
|
||||
* @param so Plugin to use. This is required to ensure that ExecutableNetwork can work properly even if plugin
|
||||
* object is destroyed.
|
||||
* @param impl Initialized shared pointer
|
||||
*/
|
||||
ExecutableNetwork(const std::shared_ptr<void>& so, const std::shared_ptr<IExecutableNetworkInternal>& impl);
|
||||
ExecutableNetwork(const std::shared_ptr<IExecutableNetworkInternal>& impl, const std::shared_ptr<void>& so);
|
||||
friend class Core;
|
||||
friend class ov::runtime::Core;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief A default constructor.
|
||||
*/
|
||||
/// @brief Default constructor
|
||||
ExecutableNetwork() = default;
|
||||
|
||||
/// @brief Default copy constructor
|
||||
/// @param other other ExecutableNetwork object
|
||||
ExecutableNetwork(const ExecutableNetwork& other) = default;
|
||||
|
||||
/// @brief Default copy assignment operator
|
||||
/// @param other other ExecutableNetwork object
|
||||
/// @return reference to the current object
|
||||
ExecutableNetwork& operator=(const ExecutableNetwork& other) = default;
|
||||
|
||||
/// @brief Default move constructor
|
||||
/// @param other other ExecutableNetwork object
|
||||
ExecutableNetwork(ExecutableNetwork&& other) = default;
|
||||
|
||||
/// @brief Default move assignment operator
|
||||
/// @param other other ExecutableNetwork object
|
||||
/// @return reference to the current object
|
||||
ExecutableNetwork& operator=(ExecutableNetwork&& other) = default;
|
||||
|
||||
/**
|
||||
* @brief Destructor presereves unload order of implementation object and reference to library
|
||||
*/
|
||||
~ExecutableNetwork();
|
||||
|
||||
/**
|
||||
* @brief Gets the Executable network output Data node information.
|
||||
*
|
||||
|
||||
@@ -32,16 +32,16 @@ class ICompletionCallbackWrapper;
|
||||
* It can throw exceptions safely for the application, where it is properly handled.
|
||||
*/
|
||||
class INFERENCE_ENGINE_API_CLASS(InferRequest) {
|
||||
std::shared_ptr<void> _so;
|
||||
std::shared_ptr<IInferRequestInternal> _impl;
|
||||
std::shared_ptr<void> _so;
|
||||
|
||||
/**
|
||||
* @brief Constructs InferRequest from the initialized std::shared_ptr
|
||||
* @param impl Initialized shared pointer
|
||||
* @param so Plugin to use. This is required to ensure that InferRequest can work properly even if plugin object is
|
||||
* destroyed.
|
||||
* @param impl Initialized shared pointer
|
||||
*/
|
||||
InferRequest(const std::shared_ptr<void>& so, const std::shared_ptr<IInferRequestInternal>& impl);
|
||||
InferRequest(const std::shared_ptr<IInferRequestInternal>& impl, const std::shared_ptr<void>& so);
|
||||
friend class ExecutableNetwork;
|
||||
|
||||
public:
|
||||
@@ -61,11 +61,32 @@ public:
|
||||
*/
|
||||
using Ptr = std::shared_ptr<InferRequest>;
|
||||
|
||||
/**
|
||||
* @brief Default constructor
|
||||
*/
|
||||
/// @brief Default constructor
|
||||
InferRequest() = default;
|
||||
|
||||
/// @brief Default copy constructor
|
||||
/// @param other other InferRequest object
|
||||
InferRequest(const InferRequest& other) = default;
|
||||
|
||||
/// @brief Default copy assignment operator
|
||||
/// @param other other InferRequest object
|
||||
/// @return reference to the current object
|
||||
InferRequest& operator=(const InferRequest& other) = default;
|
||||
|
||||
/// @brief Default move constructor
|
||||
/// @param other other InferRequest object
|
||||
InferRequest(InferRequest&& other) = default;
|
||||
|
||||
/// @brief Default move assignment operator
|
||||
/// @param other other InferRequest object
|
||||
/// @return reference to the current object
|
||||
InferRequest& operator=(InferRequest&& other) = default;
|
||||
|
||||
/**
|
||||
* @brief Destructor presereves unload order of implementation object and reference to library
|
||||
*/
|
||||
~InferRequest();
|
||||
|
||||
/**
|
||||
* @brief Sets input/output data to infer
|
||||
*
|
||||
|
||||
@@ -24,8 +24,8 @@ class IVariableStateInternal;
|
||||
* @brief VariableState class
|
||||
*/
|
||||
class INFERENCE_ENGINE_API_CLASS(VariableState) {
|
||||
std::shared_ptr<void> _so;
|
||||
std::shared_ptr<IVariableStateInternal> _impl;
|
||||
std::shared_ptr<void> _so;
|
||||
|
||||
/**
|
||||
* @brief Constructs VariableState from the initialized std::shared_ptr
|
||||
@@ -33,16 +33,37 @@ class INFERENCE_ENGINE_API_CLASS(VariableState) {
|
||||
* @param so Optional: Plugin to use. This is required to ensure that VariableState can work properly even if plugin
|
||||
* object is destroyed.
|
||||
*/
|
||||
VariableState(const std::shared_ptr<void>& so, const std::shared_ptr<IVariableStateInternal>& impl);
|
||||
VariableState(const std::shared_ptr<IVariableStateInternal>& impl, const std::shared_ptr<void>& so);
|
||||
friend class InferRequest;
|
||||
friend class ExecutableNetwork;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Default constructor
|
||||
*/
|
||||
/// @brief Default constructor
|
||||
VariableState() = default;
|
||||
|
||||
/// @brief Default copy constructor
|
||||
/// @param other other VariableState object
|
||||
VariableState(const VariableState& other) = default;
|
||||
|
||||
/// @brief Default copy assignment operator
|
||||
/// @param other other VariableState object
|
||||
/// @return reference to the current object
|
||||
VariableState& operator=(const VariableState& other) = default;
|
||||
|
||||
/// @brief Default move constructor
|
||||
/// @param other other VariableState object
|
||||
VariableState(VariableState&& other) = default;
|
||||
|
||||
/// @brief Default move assignment operator
|
||||
/// @param other other VariableState object
|
||||
/// @return reference to the current object
|
||||
VariableState& operator=(VariableState&& other) = default;
|
||||
|
||||
/**
|
||||
* @brief Destructor presereves unload order of implementation object and reference to library
|
||||
*/
|
||||
~VariableState();
|
||||
|
||||
/**
|
||||
* @brief Reset internal variable state for relevant infer request,
|
||||
* to a value specified as default for according ReadValue node
|
||||
|
||||
@@ -34,17 +34,17 @@ class InferRequest;
|
||||
* @brief This is an interface of an executable network
|
||||
*/
|
||||
class OPENVINO_RUNTIME_API CompiledModel {
|
||||
std::shared_ptr<void> _so;
|
||||
std::shared_ptr<InferenceEngine::IExecutableNetworkInternal> _impl;
|
||||
std::shared_ptr<void> _so;
|
||||
|
||||
/**
|
||||
* @brief Constructs CompiledModel from the initialized std::shared_ptr
|
||||
* @param impl Initialized shared pointer
|
||||
* @param so Plugin to use. This is required to ensure that CompiledModel can work properly even if plugin
|
||||
* object is destroyed.
|
||||
* @param impl Initialized shared pointer
|
||||
*/
|
||||
CompiledModel(const std::shared_ptr<void>& so,
|
||||
const std::shared_ptr<InferenceEngine::IExecutableNetworkInternal>& impl);
|
||||
CompiledModel(const std::shared_ptr<InferenceEngine::IExecutableNetworkInternal>& impl,
|
||||
const std::shared_ptr<void>& so);
|
||||
friend class ov::runtime::Core;
|
||||
friend class ov::runtime::InferRequest;
|
||||
|
||||
@@ -54,6 +54,11 @@ public:
|
||||
*/
|
||||
CompiledModel() = default;
|
||||
|
||||
/**
|
||||
* @brief Destructor presereves unload order of implementation object and reference to library
|
||||
*/
|
||||
~CompiledModel();
|
||||
|
||||
/**
|
||||
* @brief Get executable graph information from a device
|
||||
*
|
||||
|
||||
@@ -34,24 +34,47 @@ class CompiledModel;
|
||||
* It can throw exceptions safely for the application, where it is properly handled.
|
||||
*/
|
||||
class OPENVINO_RUNTIME_API InferRequest {
|
||||
std::shared_ptr<void> _so;
|
||||
std::shared_ptr<InferenceEngine::IInferRequestInternal> _impl;
|
||||
std::shared_ptr<void> _so;
|
||||
|
||||
/**
|
||||
* @brief Constructs InferRequest from the initialized std::shared_ptr
|
||||
* @param impl Initialized shared pointer
|
||||
* @param so Plugin to use. This is required to ensure that InferRequest can work properly even if plugin object is
|
||||
* destroyed.
|
||||
* @param impl Initialized shared pointer
|
||||
*/
|
||||
InferRequest(const std::shared_ptr<void>& so, const std::shared_ptr<InferenceEngine::IInferRequestInternal>& impl);
|
||||
InferRequest(const std::shared_ptr<InferenceEngine::IInferRequestInternal>& impl, const std::shared_ptr<void>& so);
|
||||
friend class ov::runtime::CompiledModel;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Default constructor
|
||||
*/
|
||||
/// @brief Default constructor
|
||||
InferRequest() = default;
|
||||
|
||||
/// @brief Default copy constructor
|
||||
/// @param other other InferRequest object
|
||||
InferRequest(const InferRequest& other) = default;
|
||||
|
||||
/// @brief Default copy assignment operator
|
||||
/// @param other other InferRequest object
|
||||
/// @return reference to the current object
|
||||
InferRequest& operator=(const InferRequest& other) = default;
|
||||
|
||||
/// @brief Default move constructor
|
||||
/// @param other other InferRequest object
|
||||
InferRequest(InferRequest&& other) = default;
|
||||
|
||||
/// @brief Default move assignment operator
|
||||
/// @param other other InferRequest object
|
||||
/// @return reference to the current object
|
||||
InferRequest& operator=(InferRequest&& other) = default;
|
||||
|
||||
/**
|
||||
* @brief Destructor presereves unload order of implementation object and reference to library
|
||||
* @note To preserve destruction order inside default generated assignment operator we store `_impl` before `_so`.
|
||||
* And use destructor to remove implementation object before reference to library explicitly
|
||||
*/
|
||||
~InferRequest();
|
||||
|
||||
/**
|
||||
* @brief Sets input/output data to infer
|
||||
*
|
||||
|
||||
@@ -37,20 +37,46 @@ class CompiledModel;
|
||||
*/
|
||||
class OPENVINO_RUNTIME_API RemoteContext {
|
||||
protected:
|
||||
std::shared_ptr<void> _so; //!< Reference to shared object that loaded implementation
|
||||
std::shared_ptr<InferenceEngine::RemoteContext> _impl; //!< Pointer to remote context implementation
|
||||
std::shared_ptr<void> _so; //!< Reference to shared object that loaded implementation
|
||||
|
||||
/**
|
||||
* @brief Constructs RemoteContext from the initialized std::shared_ptr
|
||||
* @param impl Initialized shared pointer
|
||||
* @param so Plugin to use. This is required to ensure that RemoteContext can work properly even if plugin
|
||||
* object is destroyed.
|
||||
* @param impl Initialized shared pointer
|
||||
*/
|
||||
RemoteContext(const std::shared_ptr<void>& so, const std::shared_ptr<InferenceEngine::RemoteContext>& impl);
|
||||
RemoteContext(const std::shared_ptr<InferenceEngine::RemoteContext>& impl, const std::shared_ptr<void>& so);
|
||||
friend class ov::runtime::Core;
|
||||
friend class ov::runtime::CompiledModel;
|
||||
|
||||
public:
|
||||
/// @brief Default constructor
|
||||
RemoteContext() = default;
|
||||
|
||||
/// @brief Default copy constructor
|
||||
/// @param other other RemoteContext object
|
||||
RemoteContext(const RemoteContext& other) = default;
|
||||
|
||||
/// @brief Default copy assignment operator
|
||||
/// @param other other RemoteContext object
|
||||
/// @return reference to the current object
|
||||
RemoteContext& operator=(const RemoteContext& other) = default;
|
||||
|
||||
/// @brief Default move constructor
|
||||
/// @param other other RemoteContext object
|
||||
RemoteContext(RemoteContext&& other) = default;
|
||||
|
||||
/// @brief Default move assignment operator
|
||||
/// @param other other RemoteContext object
|
||||
/// @return reference to current object
|
||||
RemoteContext& operator=(RemoteContext&& other) = default;
|
||||
|
||||
/**
|
||||
* @brief Destructor presereves unload order of implementation object and reference to library
|
||||
*/
|
||||
~RemoteContext();
|
||||
|
||||
/**
|
||||
* @brief Checks openvino remote type
|
||||
* @param remote_context a remote context which type will be checked
|
||||
@@ -60,11 +86,6 @@ public:
|
||||
static void type_check(const RemoteContext& remote_context,
|
||||
const std::map<std::string, std::vector<std::string>>& type_info = {});
|
||||
|
||||
/**
|
||||
* @brief Default constructor
|
||||
*/
|
||||
RemoteContext() = default;
|
||||
|
||||
/**
|
||||
* @brief Checks if the RemoteContext object can be cast to the type T
|
||||
*
|
||||
|
||||
@@ -29,8 +29,8 @@ class InferRequest;
|
||||
* @brief VariableState class
|
||||
*/
|
||||
class OPENVINO_RUNTIME_API VariableState {
|
||||
std::shared_ptr<void> _so;
|
||||
std::shared_ptr<InferenceEngine::IVariableStateInternal> _impl;
|
||||
std::shared_ptr<void> _so;
|
||||
|
||||
/**
|
||||
* @brief Constructs VariableState from the initialized std::shared_ptr
|
||||
@@ -38,8 +38,8 @@ class OPENVINO_RUNTIME_API VariableState {
|
||||
* @param so Optional: Plugin to use. This is required to ensure that VariableState can work properly even if plugin
|
||||
* object is destroyed.
|
||||
*/
|
||||
VariableState(const std::shared_ptr<void>& so,
|
||||
const std::shared_ptr<InferenceEngine::IVariableStateInternal>& impl);
|
||||
VariableState(const std::shared_ptr<InferenceEngine::IVariableStateInternal>& impl,
|
||||
const std::shared_ptr<void>& so);
|
||||
|
||||
friend class ov::runtime::InferRequest;
|
||||
|
||||
@@ -49,6 +49,11 @@ public:
|
||||
*/
|
||||
VariableState() = default;
|
||||
|
||||
/**
|
||||
* @brief Destructor presereves unload order of implementation object and reference to library
|
||||
*/
|
||||
~VariableState();
|
||||
|
||||
/**
|
||||
* @brief Reset internal variable state for relevant infer request,
|
||||
* to a value specified as default for according ReadValue node
|
||||
|
||||
@@ -33,9 +33,13 @@ namespace InferenceEngine {
|
||||
OPENVINO_ASSERT(false, "Unexpected exception"); \
|
||||
}
|
||||
|
||||
ExecutableNetwork::ExecutableNetwork(const std::shared_ptr<void>& so, const IExecutableNetworkInternal::Ptr& impl)
|
||||
: _so(so),
|
||||
_impl(impl) {
|
||||
ExecutableNetwork::~ExecutableNetwork() {
|
||||
_impl = {};
|
||||
}
|
||||
|
||||
ExecutableNetwork::ExecutableNetwork(const IExecutableNetworkInternal::Ptr& impl, const std::shared_ptr<void>& so)
|
||||
: _impl(impl),
|
||||
_so(so) {
|
||||
IE_ASSERT(_impl != nullptr);
|
||||
}
|
||||
|
||||
@@ -66,7 +70,7 @@ ExecutableNetwork::operator IExecutableNetwork::Ptr() {
|
||||
}
|
||||
|
||||
InferRequest ExecutableNetwork::CreateInferRequest() {
|
||||
EXEC_NET_CALL_STATEMENT(return {_so, _impl->CreateInferRequest()});
|
||||
EXEC_NET_CALL_STATEMENT(return {_impl->CreateInferRequest(), _so});
|
||||
}
|
||||
|
||||
InferRequest::Ptr ExecutableNetwork::CreateInferRequestPtr() {
|
||||
@@ -90,11 +94,11 @@ void ExecutableNetwork::SetConfig(const std::map<std::string, Parameter>& config
|
||||
}
|
||||
|
||||
Parameter ExecutableNetwork::GetConfig(const std::string& name) const {
|
||||
EXEC_NET_CALL_STATEMENT(return {_so, _impl->GetConfig(name)});
|
||||
EXEC_NET_CALL_STATEMENT(return {_impl->GetConfig(name), _so});
|
||||
}
|
||||
|
||||
Parameter ExecutableNetwork::GetMetric(const std::string& name) const {
|
||||
EXEC_NET_CALL_STATEMENT(return {_so, _impl->GetMetric(name)});
|
||||
EXEC_NET_CALL_STATEMENT(return {_impl->GetMetric(name), _so});
|
||||
}
|
||||
|
||||
RemoteContext::Ptr ExecutableNetwork::GetContext() const {
|
||||
@@ -112,10 +116,15 @@ ExecutableNetwork::operator bool() const noexcept {
|
||||
|
||||
namespace ov {
|
||||
namespace runtime {
|
||||
CompiledModel::CompiledModel(const std::shared_ptr<void>& so,
|
||||
const std::shared_ptr<ie::IExecutableNetworkInternal>& impl)
|
||||
: _so{so},
|
||||
_impl{impl} {
|
||||
|
||||
CompiledModel::~CompiledModel() {
|
||||
_impl = {};
|
||||
}
|
||||
|
||||
CompiledModel::CompiledModel(const std::shared_ptr<ie::IExecutableNetworkInternal>& impl,
|
||||
const std::shared_ptr<void>& so)
|
||||
: _impl{impl},
|
||||
_so{so} {
|
||||
OPENVINO_ASSERT(_impl != nullptr, "CompiledModel was not initialized.");
|
||||
}
|
||||
|
||||
@@ -191,7 +200,7 @@ ov::Output<const ov::Node> CompiledModel::output(const std::string& tensor_name)
|
||||
}
|
||||
|
||||
InferRequest CompiledModel::create_infer_request() {
|
||||
OV_EXEC_NET_CALL_STATEMENT(return {_so, _impl->CreateInferRequest()});
|
||||
OV_EXEC_NET_CALL_STATEMENT(return {_impl->CreateInferRequest(), _so});
|
||||
}
|
||||
|
||||
void CompiledModel::export_model(std::ostream& networkModel) {
|
||||
@@ -203,15 +212,15 @@ void CompiledModel::set_config(const ie::ParamMap& config) {
|
||||
}
|
||||
|
||||
ie::Parameter CompiledModel::get_config(const std::string& name) const {
|
||||
OV_EXEC_NET_CALL_STATEMENT(return {_so, _impl->GetConfig(name)});
|
||||
OV_EXEC_NET_CALL_STATEMENT(return {_impl->GetConfig(name), _so});
|
||||
}
|
||||
|
||||
ie::Parameter CompiledModel::get_metric(const std::string& name) const {
|
||||
OV_EXEC_NET_CALL_STATEMENT(return {_so, _impl->GetMetric(name)});
|
||||
OV_EXEC_NET_CALL_STATEMENT(return {_impl->GetMetric(name), _so});
|
||||
}
|
||||
|
||||
RemoteContext CompiledModel::get_context() const {
|
||||
OV_EXEC_NET_CALL_STATEMENT(return {_so, _impl->GetContext()});
|
||||
OV_EXEC_NET_CALL_STATEMENT(return {_impl->GetContext(), _so});
|
||||
}
|
||||
|
||||
bool CompiledModel::operator!() const noexcept {
|
||||
|
||||
@@ -59,9 +59,13 @@ namespace InferenceEngine {
|
||||
OPENVINO_ASSERT(false, "Unexpected exception"); \
|
||||
}
|
||||
|
||||
InferRequest::InferRequest(const std::shared_ptr<void>& so, const IInferRequestInternal::Ptr& impl)
|
||||
: _so(so),
|
||||
_impl(impl) {
|
||||
InferRequest::~InferRequest() {
|
||||
_impl = {};
|
||||
}
|
||||
|
||||
InferRequest::InferRequest(const IInferRequestInternal::Ptr& impl, const std::shared_ptr<void>& so)
|
||||
: _impl(impl),
|
||||
_so(so) {
|
||||
IE_ASSERT(_impl != nullptr);
|
||||
}
|
||||
|
||||
@@ -152,7 +156,7 @@ void InferRequest::SetCompletionCallbackImpl(std::function<void()> callbackToSet
|
||||
void InferRequest::SetCompletionCallbackImpl(std::function<void(InferRequest, StatusCode)> callbackToSet) {
|
||||
INFER_REQ_CALL_STATEMENT(
|
||||
auto weakThis =
|
||||
InferRequest{_so, std::shared_ptr<IInferRequestInternal>{_impl.get(), [](IInferRequestInternal*) {}}};
|
||||
InferRequest{std::shared_ptr<IInferRequestInternal>{_impl.get(), [](IInferRequestInternal*) {}}, _so};
|
||||
_impl->SetCallback([callbackToSet, weakThis](std::exception_ptr exceptionPtr) {
|
||||
StatusCode statusCode = StatusCode::OK;
|
||||
if (exceptionPtr != nullptr) {
|
||||
@@ -175,7 +179,7 @@ void InferRequest::SetCompletionCallbackImpl(std::function<void(InferRequest, St
|
||||
void InferRequest::SetCompletionCallbackImpl(IInferRequest::CompletionCallback callbackToSet) {
|
||||
INFER_REQ_CALL_STATEMENT(
|
||||
IInferRequest::Ptr weakThis =
|
||||
InferRequest{_so, std::shared_ptr<IInferRequestInternal>{_impl.get(), [](IInferRequestInternal*) {}}};
|
||||
InferRequest{std::shared_ptr<IInferRequestInternal>{_impl.get(), [](IInferRequestInternal*) {}}, _so};
|
||||
_impl->SetCallback([callbackToSet, weakThis](std::exception_ptr exceptionPtr) {
|
||||
StatusCode statusCode = StatusCode::OK;
|
||||
if (exceptionPtr != nullptr) {
|
||||
@@ -203,7 +207,7 @@ std::vector<VariableState> InferRequest::QueryState() {
|
||||
std::vector<VariableState> controller;
|
||||
INFER_REQ_CALL_STATEMENT(for (auto&& state
|
||||
: _impl->QueryState()) {
|
||||
controller.emplace_back(VariableState{_so, state});
|
||||
controller.emplace_back(VariableState{state, _so});
|
||||
})
|
||||
return controller;
|
||||
}
|
||||
@@ -241,9 +245,13 @@ std::string get_legacy_name_from_port(const ov::Output<const ov::Node>& port) {
|
||||
namespace ov {
|
||||
namespace runtime {
|
||||
|
||||
InferRequest::InferRequest(const std::shared_ptr<void>& so, const ie::IInferRequestInternal::Ptr& impl)
|
||||
: _so{so},
|
||||
_impl{impl} {
|
||||
InferRequest::~InferRequest() {
|
||||
_impl = {};
|
||||
}
|
||||
|
||||
InferRequest::InferRequest(const ie::IInferRequestInternal::Ptr& impl, const std::shared_ptr<void>& so)
|
||||
: _impl{impl},
|
||||
_so{so} {
|
||||
OPENVINO_ASSERT(_impl != nullptr, "InferRequest was not initialized.");
|
||||
}
|
||||
|
||||
@@ -312,7 +320,7 @@ Tensor InferRequest::get_tensor(const ov::Output<const ov::Node>& port) {
|
||||
OV_INFER_REQ_CALL_STATEMENT({
|
||||
const auto& name = get_legacy_name_from_port(port);
|
||||
auto blob = _impl->GetBlob(name);
|
||||
return {_so, blob};
|
||||
return {blob, _so};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -441,14 +449,14 @@ std::vector<VariableState> InferRequest::query_state() {
|
||||
std::vector<VariableState> variable_states;
|
||||
OV_INFER_REQ_CALL_STATEMENT({
|
||||
for (auto&& state : _impl->QueryState()) {
|
||||
variable_states.emplace_back(VariableState{_so, state});
|
||||
variable_states.emplace_back(VariableState{state, _so});
|
||||
}
|
||||
})
|
||||
return variable_states;
|
||||
}
|
||||
|
||||
CompiledModel InferRequest::get_compiled_model() {
|
||||
OV_INFER_REQ_CALL_STATEMENT(return {_so, _impl->getPointerToExecutableNetworkInternal()});
|
||||
OV_INFER_REQ_CALL_STATEMENT(return {_impl->getPointerToExecutableNetworkInternal(), _so});
|
||||
}
|
||||
|
||||
bool InferRequest::operator!() const noexcept {
|
||||
|
||||
@@ -38,8 +38,12 @@ namespace InferenceEngine {
|
||||
* It can throw exceptions safely for the application, where it is properly handled.
|
||||
*/
|
||||
struct InferencePlugin {
|
||||
std::shared_ptr<void> _so;
|
||||
std::shared_ptr<InferenceEngine::IInferencePlugin> _ptr;
|
||||
std::shared_ptr<void> _so;
|
||||
|
||||
~InferencePlugin() {
|
||||
_ptr = {};
|
||||
}
|
||||
|
||||
void SetName(const std::string & deviceName) {
|
||||
PLUGIN_CALL_STATEMENT(_ptr->SetName(deviceName));
|
||||
@@ -62,17 +66,17 @@ struct InferencePlugin {
|
||||
}
|
||||
|
||||
ov::runtime::SoPtr<IExecutableNetworkInternal> LoadNetwork(const CNNNetwork& network, const std::map<std::string, std::string>& config) {
|
||||
PLUGIN_CALL_STATEMENT(return {_so, _ptr->LoadNetwork(network, config)});
|
||||
PLUGIN_CALL_STATEMENT(return {_ptr->LoadNetwork(network, config), _so});
|
||||
}
|
||||
|
||||
ov::runtime::SoPtr<IExecutableNetworkInternal> LoadNetwork(const CNNNetwork& network,
|
||||
const std::shared_ptr<RemoteContext>& context,
|
||||
const std::map<std::string, std::string>& config) {
|
||||
PLUGIN_CALL_STATEMENT(return {_so, _ptr->LoadNetwork(network, config, context)});
|
||||
PLUGIN_CALL_STATEMENT(return {_ptr->LoadNetwork(network, config, context), _so});
|
||||
}
|
||||
|
||||
ov::runtime::SoPtr<IExecutableNetworkInternal> LoadNetwork(const std::string& modelPath, const std::map<std::string, std::string>& config) {
|
||||
PLUGIN_CALL_STATEMENT(return {_so, _ptr->LoadNetwork(modelPath, config)});
|
||||
PLUGIN_CALL_STATEMENT(return {_ptr->LoadNetwork(modelPath, config), _so});
|
||||
}
|
||||
|
||||
QueryNetworkResult QueryNetwork(const CNNNetwork& network,
|
||||
@@ -85,34 +89,34 @@ struct InferencePlugin {
|
||||
|
||||
ov::runtime::SoPtr<IExecutableNetworkInternal> ImportNetwork(const std::string& modelFileName,
|
||||
const std::map<std::string, std::string>& config) {
|
||||
PLUGIN_CALL_STATEMENT(return {_so, _ptr->ImportNetwork(modelFileName, config)});
|
||||
PLUGIN_CALL_STATEMENT(return {_ptr->ImportNetwork(modelFileName, config), _so});
|
||||
}
|
||||
|
||||
ov::runtime::SoPtr<IExecutableNetworkInternal> ImportNetwork(std::istream& networkModel,
|
||||
const std::map<std::string, std::string>& config) {
|
||||
PLUGIN_CALL_STATEMENT(return {_so, _ptr->ImportNetwork(networkModel, config)});
|
||||
PLUGIN_CALL_STATEMENT(return {_ptr->ImportNetwork(networkModel, config), _so});
|
||||
}
|
||||
|
||||
ov::runtime::SoPtr<IExecutableNetworkInternal> ImportNetwork(std::istream& networkModel,
|
||||
const std::shared_ptr<RemoteContext>& context,
|
||||
const std::map<std::string, std::string>& config) {
|
||||
PLUGIN_CALL_STATEMENT(return {_so, _ptr->ImportNetwork(networkModel, context, config)});
|
||||
PLUGIN_CALL_STATEMENT(return {_ptr->ImportNetwork(networkModel, context, config), _so});
|
||||
}
|
||||
|
||||
Parameter GetMetric(const std::string& name, const std::map<std::string, Parameter>& options) const {
|
||||
PLUGIN_CALL_STATEMENT(return {_so, _ptr->GetMetric(name, options)});
|
||||
PLUGIN_CALL_STATEMENT(return {_ptr->GetMetric(name, options), _so});
|
||||
}
|
||||
|
||||
ov::runtime::SoPtr<RemoteContext> CreateContext(const ParamMap& params) {
|
||||
PLUGIN_CALL_STATEMENT(return {_so, _ptr->CreateContext(params)});
|
||||
PLUGIN_CALL_STATEMENT(return {_ptr->CreateContext(params), _so});
|
||||
}
|
||||
|
||||
ov::runtime::SoPtr<RemoteContext> GetDefaultContext(const ParamMap& params) {
|
||||
PLUGIN_CALL_STATEMENT(return {_so, _ptr->GetDefaultContext(params)});
|
||||
PLUGIN_CALL_STATEMENT(return {_ptr->GetDefaultContext(params), _so});
|
||||
}
|
||||
|
||||
Parameter GetConfig(const std::string& name, const std::map<std::string, Parameter>& options) const {
|
||||
PLUGIN_CALL_STATEMENT(return {_so, _ptr->GetConfig(name, options)});
|
||||
PLUGIN_CALL_STATEMENT(return {_ptr->GetConfig(name, options), _so});
|
||||
}
|
||||
};
|
||||
} // namespace InferenceEngine
|
||||
@@ -139,15 +143,19 @@ namespace runtime {
|
||||
* It can throw exceptions safely for the application, where it is properly handled.
|
||||
*/
|
||||
class InferencePlugin {
|
||||
std::shared_ptr<void> _so;
|
||||
std::shared_ptr<ie::IInferencePlugin> _ptr;
|
||||
std::shared_ptr<void> _so;
|
||||
|
||||
public:
|
||||
InferencePlugin() = default;
|
||||
|
||||
InferencePlugin(const std::shared_ptr<void>& so, const std::shared_ptr<ie::IInferencePlugin>& impl) :
|
||||
_so{so},
|
||||
_ptr{impl} {
|
||||
~InferencePlugin() {
|
||||
_ptr = {};
|
||||
}
|
||||
|
||||
InferencePlugin(const std::shared_ptr<ie::IInferencePlugin>& ptr, const std::shared_ptr<void>& so) :
|
||||
_ptr{ptr},
|
||||
_so{so} {
|
||||
OPENVINO_ASSERT(_ptr != nullptr, "InferencePlugin was not initialized.");
|
||||
}
|
||||
|
||||
@@ -172,17 +180,17 @@ public:
|
||||
}
|
||||
|
||||
SoPtr<ie::IExecutableNetworkInternal> compile_model(const ie::CNNNetwork& network, const ConfigMap& config) {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_so, _ptr->LoadNetwork(network, config)});
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->LoadNetwork(network, config), _so});
|
||||
}
|
||||
|
||||
SoPtr<ie::IExecutableNetworkInternal> compile_model(const ie::CNNNetwork& network,
|
||||
const std::shared_ptr<ie::RemoteContext>& context,
|
||||
const ConfigMap& config) {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_so, _ptr->LoadNetwork(network, config, context)});
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->LoadNetwork(network, config, context), _so});
|
||||
}
|
||||
|
||||
SoPtr<ie::IExecutableNetworkInternal> compile_model(const std::string& modelPath, const ConfigMap& config) {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_so, _ptr->LoadNetwork(modelPath, config)});
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->LoadNetwork(modelPath, config), _so});
|
||||
}
|
||||
|
||||
ie::QueryNetworkResult query_model(const ie::CNNNetwork& network,
|
||||
@@ -195,34 +203,34 @@ public:
|
||||
|
||||
SoPtr<ie::IExecutableNetworkInternal> import_model(const std::string& modelFileName,
|
||||
const ConfigMap& config) {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_so, _ptr->ImportNetwork(modelFileName, config)});
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->ImportNetwork(modelFileName, config), _so});
|
||||
}
|
||||
|
||||
SoPtr<ie::IExecutableNetworkInternal> import_model(std::istream& networkModel,
|
||||
const ConfigMap& config) {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_so, _ptr->ImportNetwork(networkModel, config)});
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->ImportNetwork(networkModel, config), _so});
|
||||
}
|
||||
|
||||
SoPtr<ie::IExecutableNetworkInternal> import_model(std::istream& networkModel,
|
||||
const std::shared_ptr<ie::RemoteContext>& context,
|
||||
const ConfigMap& config) {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_so, _ptr->ImportNetwork(networkModel, context, config)});
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->ImportNetwork(networkModel, context, config), _so});
|
||||
}
|
||||
|
||||
ie::Parameter get_metric(const std::string& name, const ie::ParamMap& options) const {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_so, _ptr->GetMetric(name, options)});
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->GetMetric(name, options), _so});
|
||||
}
|
||||
|
||||
SoPtr<ie::RemoteContext> create_context(const ie::ParamMap& params) {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_so, _ptr->CreateContext(params)});
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->CreateContext(params), _so});
|
||||
}
|
||||
|
||||
SoPtr<ie::RemoteContext> get_default_context(const ie::ParamMap& params) {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_so, _ptr->GetDefaultContext(params)});
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->GetDefaultContext(params), _so});
|
||||
}
|
||||
|
||||
ie::Parameter get_config(const std::string& name, const ie::ParamMap& options) const {
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_so, _ptr->GetConfig(name, options)});
|
||||
OV_PLUGIN_CALL_STATEMENT(return {_ptr->GetConfig(name, options), _so});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -47,9 +47,13 @@ void RemoteContext::type_check(const RemoteContext& tensor,
|
||||
}
|
||||
}
|
||||
|
||||
RemoteContext::RemoteContext(const std::shared_ptr<void>& so, const ie::RemoteContext::Ptr& impl)
|
||||
: _so{so},
|
||||
_impl{impl} {
|
||||
RemoteContext::~RemoteContext() {
|
||||
_impl = {};
|
||||
}
|
||||
|
||||
RemoteContext::RemoteContext(const ie::RemoteContext::Ptr& impl, const std::shared_ptr<void>& so)
|
||||
: _impl{impl},
|
||||
_so{so} {
|
||||
OPENVINO_ASSERT(_impl != nullptr, "RemoteContext was not initialized.");
|
||||
}
|
||||
|
||||
@@ -65,7 +69,7 @@ RemoteTensor RemoteContext::create_tensor(const element::Type& element_type,
|
||||
{ie::details::convertPrecision(element_type), shape, ie::TensorDesc::getLayoutByRank(shape.size())},
|
||||
params);
|
||||
blob->allocate();
|
||||
return {_so, blob};
|
||||
return {blob, _so};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -74,7 +78,7 @@ Tensor RemoteContext::create_host_tensor(const element::Type element_type, const
|
||||
auto blob = _impl->CreateHostBlob(
|
||||
{ie::details::convertPrecision(element_type), shape, ie::TensorDesc::getLayoutByRank(shape.size())});
|
||||
blob->allocate();
|
||||
return {_so, blob};
|
||||
return {blob, _so};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -82,7 +86,7 @@ ParamMap RemoteContext::get_params() const {
|
||||
ParamMap paramMap;
|
||||
OV_REMOTE_CONTEXT_STATEMENT({
|
||||
for (auto&& param : _impl->getParams()) {
|
||||
paramMap.emplace(param.first, Any{_so, param.second});
|
||||
paramMap.emplace(param.first, Any{param.second, _so});
|
||||
}
|
||||
});
|
||||
return paramMap;
|
||||
|
||||
@@ -28,9 +28,13 @@
|
||||
|
||||
namespace InferenceEngine {
|
||||
|
||||
VariableState::VariableState(const std::shared_ptr<void>& so, const IVariableStateInternal::Ptr& impl)
|
||||
: _so(so),
|
||||
_impl(impl) {
|
||||
VariableState::~VariableState() {
|
||||
_impl = {};
|
||||
}
|
||||
|
||||
VariableState::VariableState(const IVariableStateInternal::Ptr& impl, const std::shared_ptr<void>& so)
|
||||
: _impl(impl),
|
||||
_so(so) {
|
||||
if (_impl == nullptr)
|
||||
IE_THROW() << "VariableState was not initialized.";
|
||||
}
|
||||
@@ -58,9 +62,13 @@ void VariableState::SetState(Blob::Ptr state) {
|
||||
namespace ov {
|
||||
namespace runtime {
|
||||
|
||||
VariableState::VariableState(const std::shared_ptr<void>& so, const ie::IVariableStateInternal::Ptr& impl)
|
||||
: _so{so},
|
||||
_impl{impl} {
|
||||
VariableState::~VariableState() {
|
||||
_impl = {};
|
||||
}
|
||||
|
||||
VariableState::VariableState(const ie::IVariableStateInternal::Ptr& impl, const std::shared_ptr<void>& so)
|
||||
: _impl{impl},
|
||||
_so{so} {
|
||||
OPENVINO_ASSERT(_impl != nullptr, "VariableState was not initialized.");
|
||||
}
|
||||
|
||||
@@ -73,7 +81,7 @@ std::string VariableState::get_name() const {
|
||||
}
|
||||
|
||||
Tensor VariableState::get_state() const {
|
||||
OV_VARIABLE_CALL_STATEMENT(return {_so, std::const_pointer_cast<ie::Blob>(_impl->GetState())});
|
||||
OV_VARIABLE_CALL_STATEMENT(return {std::const_pointer_cast<ie::Blob>(_impl->GetState()), _so});
|
||||
}
|
||||
|
||||
void VariableState::set_state(const Tensor& state) {
|
||||
|
||||
@@ -525,7 +525,7 @@ public:
|
||||
} else {
|
||||
res = compile_model_impl(network, plugin, parsed._config, nullptr, {}, {}, forceDisableCache);
|
||||
}
|
||||
return {{res._so}, res._ptr};
|
||||
return {res._ptr, res._so};
|
||||
}
|
||||
|
||||
ie::SoExecutableNetworkInternal LoadNetwork(const std::string& modelPath,
|
||||
@@ -551,7 +551,7 @@ public:
|
||||
auto cnnNetwork = ReadNetwork(modelPath, std::string());
|
||||
res = compile_model_impl(cnnNetwork, plugin, parsed._config, nullptr, {}, modelPath);
|
||||
}
|
||||
return {{res._so}, res._ptr};
|
||||
return {res._ptr, res._so};
|
||||
}
|
||||
|
||||
ie::SoExecutableNetworkInternal ImportNetwork(std::istream& networkModel,
|
||||
@@ -607,7 +607,7 @@ public:
|
||||
// not from ngraph. Plugins should use SetExeNetworkInfo
|
||||
}
|
||||
|
||||
return {{exec._so}, exec._ptr};
|
||||
return {exec._ptr, exec._so};
|
||||
}
|
||||
|
||||
ie::QueryNetworkResult QueryNetwork(const ie::CNNNetwork& network,
|
||||
@@ -748,13 +748,13 @@ public:
|
||||
if (desc.pluginCreateFunc) { // static OpenVINO case
|
||||
std::shared_ptr<ie::IInferencePlugin> plugin_impl;
|
||||
desc.pluginCreateFunc(plugin_impl);
|
||||
plugin = InferencePlugin{nullptr, plugin_impl};
|
||||
plugin = InferencePlugin{plugin_impl, {}};
|
||||
} else {
|
||||
so = ov::util::load_shared_object(desc.libraryLocation.c_str());
|
||||
std::shared_ptr<ie::IInferencePlugin> plugin_impl;
|
||||
reinterpret_cast<InferenceEngine::CreatePluginEngineFunc*>(
|
||||
ov::util::get_symbol(so, InferenceEngine::create_plugin_function))(plugin_impl);
|
||||
plugin = InferencePlugin{so, plugin_impl};
|
||||
plugin = InferencePlugin{plugin_impl, so};
|
||||
}
|
||||
|
||||
{
|
||||
@@ -1166,21 +1166,21 @@ ExecutableNetwork Core::LoadNetwork(const CNNNetwork& network,
|
||||
const std::string& deviceName,
|
||||
const std::map<std::string, std::string>& config) {
|
||||
auto exec = _impl->LoadNetwork(network, deviceName, config);
|
||||
return {exec._so, exec._ptr};
|
||||
return {exec._ptr, exec._so};
|
||||
}
|
||||
|
||||
ExecutableNetwork Core::LoadNetwork(const CNNNetwork& network,
|
||||
RemoteContext::Ptr context,
|
||||
const std::map<std::string, std::string>& config) {
|
||||
auto exec = _impl->LoadNetwork(network, std::dynamic_pointer_cast<RemoteContext>(context), config);
|
||||
return {{exec._so}, exec._ptr};
|
||||
return {exec._ptr, exec._so};
|
||||
}
|
||||
|
||||
ExecutableNetwork Core::LoadNetwork(const std::string& modelPath,
|
||||
const std::string& deviceName,
|
||||
const std::map<std::string, std::string>& config) {
|
||||
auto exec = _impl->LoadNetwork(modelPath, deviceName, config);
|
||||
return {exec._so, exec._ptr};
|
||||
return {exec._ptr, exec._so};
|
||||
}
|
||||
|
||||
RemoteContext::Ptr Core::CreateContext(const std::string& deviceName, const ParamMap& params) {
|
||||
@@ -1237,7 +1237,7 @@ ExecutableNetwork Core::ImportNetwork(const std::string& modelFileName,
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::IE, "Core::ImportNetwork");
|
||||
auto parsed = ov::runtime::parseDeviceNameIntoConfig(deviceName, config);
|
||||
auto exec = _impl->GetCPPPluginByName(parsed._deviceName).import_model(modelFileName, parsed._config);
|
||||
return {{exec._so}, exec._ptr};
|
||||
return {exec._ptr, exec._so};
|
||||
}
|
||||
|
||||
ExecutableNetwork Core::ImportNetwork(std::istream& networkModel,
|
||||
@@ -1245,7 +1245,7 @@ ExecutableNetwork Core::ImportNetwork(std::istream& networkModel,
|
||||
const std::map<std::string, std::string>& config) {
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::IE, "Core::ImportNetwork");
|
||||
auto exec = _impl->ImportNetwork(networkModel, deviceName, config);
|
||||
return {exec._so, exec._ptr};
|
||||
return {exec._ptr, exec._so};
|
||||
}
|
||||
|
||||
ExecutableNetwork Core::ImportNetwork(std::istream& networkModel) {
|
||||
@@ -1267,7 +1267,7 @@ ExecutableNetwork Core::ImportNetwork(std::istream& networkModel) {
|
||||
networkModel.seekg(currentPos, networkModel.beg);
|
||||
|
||||
auto exec = _impl->GetCPPPluginByName(deviceName).import_model(networkModel, {});
|
||||
return {{exec._so}, exec._ptr};
|
||||
return {exec._ptr, exec._so};
|
||||
}
|
||||
|
||||
ExecutableNetwork Core::ImportNetwork(std::istream& networkModel,
|
||||
@@ -1286,7 +1286,7 @@ ExecutableNetwork Core::ImportNetwork(std::istream& networkModel,
|
||||
auto parsed = ov::runtime::parseDeviceNameIntoConfig(deviceName, config);
|
||||
auto exec = _impl->GetCPPPluginByName(deviceName)
|
||||
.import_model(networkModel, std::dynamic_pointer_cast<RemoteContext>(context), parsed._config);
|
||||
return {{exec._so}, exec._ptr};
|
||||
return {exec._ptr, exec._so};
|
||||
}
|
||||
|
||||
QueryNetworkResult Core::QueryNetwork(const CNNNetwork& network,
|
||||
@@ -1446,7 +1446,7 @@ CompiledModel Core::compile_model(const std::shared_ptr<const ov::Model>& model,
|
||||
const ConfigMap& config) {
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto exec = _impl->LoadNetwork(toCNN(model), deviceName, config);
|
||||
return {exec._so, exec._ptr};
|
||||
return {exec._ptr, exec._so};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1455,7 +1455,7 @@ CompiledModel Core::compile_model(const std::string& modelPath,
|
||||
const ConfigMap& config) {
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto exec = _impl->LoadNetwork(modelPath, deviceName, config);
|
||||
return {exec._so, exec._ptr};
|
||||
return {exec._ptr, exec._so};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1464,7 +1464,7 @@ CompiledModel Core::compile_model(const std::shared_ptr<const ov::Model>& model,
|
||||
const ConfigMap& config) {
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto exec = _impl->LoadNetwork(toCNN(model), context._impl, config);
|
||||
return {exec._so, exec._ptr};
|
||||
return {exec._ptr, exec._so};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1492,7 +1492,7 @@ CompiledModel Core::import_model(std::istream& modelStream, const std::string& d
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::IE, "Core::import_model");
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto exec = _impl->ImportNetwork(modelStream, deviceName, config);
|
||||
return {exec._so, exec._ptr};
|
||||
return {exec._ptr, exec._so};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1517,7 +1517,7 @@ CompiledModel Core::import_model(std::istream& modelStream, const RemoteContext&
|
||||
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto exec = _impl->GetCPPPluginByName(deviceName).import_model(modelStream, {});
|
||||
return {exec._so, exec._ptr};
|
||||
return {exec._ptr, exec._so};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1600,7 +1600,7 @@ RemoteContext Core::create_context(const std::string& deviceName, const ParamMap
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto parsed = parseDeviceNameIntoConfig(deviceName, params);
|
||||
auto remoteContext = _impl->GetCPPPluginByName(parsed._deviceName).create_context(parsed._config);
|
||||
return {remoteContext._so, remoteContext._ptr};
|
||||
return {remoteContext._ptr, remoteContext._so};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1612,7 +1612,7 @@ RemoteContext Core::get_default_context(const std::string& deviceName) {
|
||||
OV_CORE_CALL_STATEMENT({
|
||||
auto parsed = parseDeviceNameIntoConfig(deviceName, ParamMap());
|
||||
auto remoteContext = _impl->GetCPPPluginByName(parsed._deviceName).get_default_context(parsed._config);
|
||||
return {remoteContext._so, remoteContext._ptr};
|
||||
return {remoteContext._ptr, remoteContext._so};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ class Reader : public IReader {
|
||||
std::shared_ptr<IReader> plugin_impl;
|
||||
using createFunc = void(std::shared_ptr<IReader>&);
|
||||
reinterpret_cast<createFunc*>(ov::util::get_symbol(so, "CreateReader"))(plugin_impl);
|
||||
ptr = {so, plugin_impl};
|
||||
ptr = {plugin_impl, so};
|
||||
# endif // OPENVINO_STATIC_LIBRARY
|
||||
});
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ ie::ParamMap RemoteTensor::get_params() const {
|
||||
try {
|
||||
ParamMap paramMap;
|
||||
for (auto&& param : remote_impl->getParams()) {
|
||||
paramMap.emplace(param.first, Any{_so, param.second});
|
||||
paramMap.emplace(param.first, Any{param.second, _so});
|
||||
}
|
||||
return paramMap;
|
||||
} catch (const std::exception& ex) {
|
||||
|
||||
@@ -119,7 +119,7 @@ void MultiDeviceExecutableNetwork::GenerateWorkers(const std::string& device, co
|
||||
auto* idleWorkerRequestsPtr = &(idleWorkerRequests);
|
||||
idleWorkerRequests.set_capacity(numRequests);
|
||||
for (auto&& workerRequest : workerRequests) {
|
||||
workerRequest._inferRequest = { executableNetwork._so, executableNetwork->CreateInferRequest() };
|
||||
workerRequest._inferRequest = {executableNetwork->CreateInferRequest(), executableNetwork._so};
|
||||
auto* workerRequestPtr = &workerRequest;
|
||||
IE_ASSERT(idleWorkerRequests.try_push(workerRequestPtr) == true);
|
||||
workerRequest._inferRequest->SetCallback(
|
||||
|
||||
@@ -69,7 +69,7 @@ void HeteroInferRequest::CreateInferRequest(
|
||||
|
||||
// go over all subnet and create requests
|
||||
for (auto&& desc : _inferRequests) {
|
||||
desc._request = {desc._network._so, desc._network->CreateInferRequest()};
|
||||
desc._request = {desc._network->CreateInferRequest(), desc._network._so};
|
||||
// go over all inputs and get blobs from subnet infer requests
|
||||
for (auto&& outputInfo : desc._network->GetOutputsInfo()) {
|
||||
requestBlob(outputInfo.first, desc._request, true);
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base/ov_behavior_test_utils.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
namespace behavior {
|
||||
|
||||
class OVHoldersTest : public CommonTestUtils::TestsCommon,
|
||||
public ::testing::WithParamInterface<std::string> {
|
||||
public:
|
||||
static std::string getTestCaseName(testing::TestParamInfo<std::string> obj);
|
||||
|
||||
void SetUp() override;
|
||||
|
||||
void TearDown() override;
|
||||
|
||||
std::string deathTestStyle;
|
||||
std::shared_ptr<ngraph::Function> function;
|
||||
std::string targetDevice;
|
||||
};
|
||||
|
||||
class OVHoldersTestOnImportedNetwork : public CommonTestUtils::TestsCommon,
|
||||
public ::testing::WithParamInterface<std::string> {
|
||||
public:
|
||||
static std::string getTestCaseName(testing::TestParamInfo<std::string> obj);
|
||||
|
||||
void SetUp() override;
|
||||
void TearDown() override;
|
||||
|
||||
std::shared_ptr<ngraph::Function> function;
|
||||
std::string targetDevice;
|
||||
std::string deathTestStyle;
|
||||
};
|
||||
|
||||
} // namespace behavior
|
||||
} // namespace test
|
||||
} // namespace ov
|
||||
@@ -0,0 +1,137 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <ngraph_functions/subgraph_builders.hpp>
|
||||
#include <base/behavior_test_utils.hpp>
|
||||
#include "behavior/ov_plugin/life_time.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
namespace behavior {
|
||||
std::string OVHoldersTest::getTestCaseName(testing::TestParamInfo<std::string> obj) {
|
||||
return "targetDevice=" + obj.param;
|
||||
}
|
||||
|
||||
void OVHoldersTest::SetUp() {
|
||||
SKIP_IF_CURRENT_TEST_IS_DISABLED();
|
||||
targetDevice = this->GetParam();
|
||||
deathTestStyle = ::testing::GTEST_FLAG(death_test_style);
|
||||
if (deathTestStyle == "fast") {
|
||||
::testing::GTEST_FLAG(death_test_style) = "threadsafe";
|
||||
}
|
||||
function = ngraph::builder::subgraph::makeConvPoolRelu();
|
||||
}
|
||||
|
||||
void OVHoldersTest::TearDown() {
|
||||
::testing::GTEST_FLAG(death_test_style) = deathTestStyle;
|
||||
}
|
||||
|
||||
#define EXPECT_NO_CRASH(_statement) \
|
||||
EXPECT_EXIT(_statement; exit(0), testing::ExitedWithCode(0), "")
|
||||
|
||||
static void release_order_test(std::vector<std::size_t> order, const std::string &deviceName,
|
||||
std::shared_ptr<ngraph::Function> function) {
|
||||
ov::AnyVector objects;
|
||||
{
|
||||
runtime::Core core = createCoreWithTemplate();
|
||||
auto compiled_model = core.compile_model(function, deviceName);
|
||||
auto request = compiled_model.create_infer_request();
|
||||
|
||||
objects = {core, compiled_model, request};
|
||||
}
|
||||
for (auto&& i : order) {
|
||||
objects.at(i) = {};
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(OVHoldersTest, Orders) {
|
||||
std::vector<std::string> objects{ "core", "compiled_model", "request"};
|
||||
std::vector<std::size_t> order(objects.size());
|
||||
std::iota(order.begin(), order.end(), 0);
|
||||
do {
|
||||
std::stringstream order_str;
|
||||
for (auto&& i : order) {
|
||||
order_str << objects.at(i) << " ";
|
||||
}
|
||||
EXPECT_NO_CRASH(release_order_test(order, targetDevice, function)) << "for order: " << order_str.str();
|
||||
} while (std::next_permutation(order.begin(), order.end()));
|
||||
}
|
||||
|
||||
TEST_P(OVHoldersTest, LoadedState) {
|
||||
std::vector<runtime::VariableState> states;
|
||||
{
|
||||
runtime::Core core = createCoreWithTemplate();
|
||||
auto compiled_model = core.compile_model(function, targetDevice);
|
||||
auto request = compiled_model.create_infer_request();
|
||||
try {
|
||||
states = request.query_state();
|
||||
} catch(...) {}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(OVHoldersTest, LoadedTensor) {
|
||||
runtime::Tensor tensor;
|
||||
{
|
||||
runtime::Core core = createCoreWithTemplate();
|
||||
auto compiled_model = core.compile_model(function, targetDevice);
|
||||
auto request = compiled_model.create_infer_request();
|
||||
tensor = request.get_input_tensor();
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(OVHoldersTest, LoadedAny) {
|
||||
ov::Any any;
|
||||
{
|
||||
runtime::Core core = createCoreWithTemplate();
|
||||
auto compiled_model = core.compile_model(function, targetDevice);
|
||||
any = compiled_model.get_metric(METRIC_KEY(SUPPORTED_METRICS));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(OVHoldersTest, LoadedRemoteContext) {
|
||||
runtime::RemoteContext ctx;
|
||||
{
|
||||
runtime::Core core = createCoreWithTemplate();
|
||||
auto compiled_model = core.compile_model(function, targetDevice);
|
||||
try {
|
||||
ctx = compiled_model.get_context();
|
||||
} catch(...) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string OVHoldersTestOnImportedNetwork::getTestCaseName(testing::TestParamInfo<std::string> obj) {
|
||||
return "targetDevice=" + obj.param;
|
||||
}
|
||||
|
||||
void OVHoldersTestOnImportedNetwork::SetUp() {
|
||||
SKIP_IF_CURRENT_TEST_IS_DISABLED();
|
||||
targetDevice = this->GetParam();
|
||||
deathTestStyle = ::testing::GTEST_FLAG(death_test_style);
|
||||
if (deathTestStyle == "fast") {
|
||||
::testing::GTEST_FLAG(death_test_style) = "threadsafe";
|
||||
}
|
||||
function = ngraph::builder::subgraph::makeConvPoolRelu();
|
||||
}
|
||||
|
||||
void OVHoldersTestOnImportedNetwork::TearDown() {
|
||||
::testing::GTEST_FLAG(death_test_style) = deathTestStyle;
|
||||
}
|
||||
|
||||
TEST_P(OVHoldersTestOnImportedNetwork, CreateRequestWithCoreRemoved) {
|
||||
runtime::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);
|
||||
core = runtime::Core{};
|
||||
auto request = compiled_model.create_infer_request();
|
||||
}
|
||||
} // namespace behavior
|
||||
} // namespace test
|
||||
} // namespace ov
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
mockIExeNet = std::make_shared<MockIExecutableNetworkInternal>();
|
||||
auto mockIPluginPtr = std::make_shared<MockIInferencePlugin>();
|
||||
ON_CALL(*mockIPluginPtr, LoadNetwork(MatcherCast<const CNNNetwork&>(_), _)).WillByDefault(Return(mockIExeNet));
|
||||
mockPlugin = InferenceEngine::InferencePlugin{{}, mockIPluginPtr};
|
||||
mockPlugin = InferenceEngine::InferencePlugin{mockIPluginPtr, {}};
|
||||
// remove annoying ON CALL message
|
||||
EXPECT_CALL(*mockIPluginPtr, LoadNetwork(MatcherCast<const CNNNetwork&>(_), _)).Times(1);
|
||||
mockExeNetwork = mockPlugin.LoadNetwork(CNNNetwork{}, {});
|
||||
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
cpuMockIExeNet = std::make_shared<MockIExecutableNetworkInternal>();
|
||||
auto cpuMockIPluginPtr = std::make_shared<MockIInferencePlugin>();
|
||||
ON_CALL(*cpuMockIPluginPtr, LoadNetwork(MatcherCast<const CNNNetwork&>(_), _)).WillByDefault(Return(cpuMockIExeNet));
|
||||
cpuMockPlugin = InferenceEngine::InferencePlugin{{}, cpuMockIPluginPtr};
|
||||
cpuMockPlugin = InferenceEngine::InferencePlugin{cpuMockIPluginPtr, {}};
|
||||
// remove annoying ON CALL message
|
||||
EXPECT_CALL(*cpuMockIPluginPtr, LoadNetwork(MatcherCast<const CNNNetwork&>(_), _)).Times(1);
|
||||
cpuMockExeNetwork = cpuMockPlugin.LoadNetwork(CNNNetwork{}, {});
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
gpuMockIExeNet = std::make_shared<MockIExecutableNetworkInternal>();
|
||||
auto gpuMockIPluginPtr = std::make_shared<MockIInferencePlugin>();
|
||||
ON_CALL(*gpuMockIPluginPtr, LoadNetwork(MatcherCast<const CNNNetwork&>(_), _)).WillByDefault(Return(gpuMockIExeNet));
|
||||
gpuMockPlugin = InferenceEngine::InferencePlugin{{}, gpuMockIPluginPtr};
|
||||
gpuMockPlugin = InferenceEngine::InferencePlugin{gpuMockIPluginPtr, {}};
|
||||
// remove annoying ON CALL message
|
||||
EXPECT_CALL(*gpuMockIPluginPtr, LoadNetwork(MatcherCast<const CNNNetwork&>(_), _)).Times(1);
|
||||
gpuMockExeNetwork = gpuMockPlugin.LoadNetwork(CNNNetwork{}, {});
|
||||
|
||||
@@ -196,7 +196,7 @@ protected:
|
||||
ON_CALL(*mockIExeNet, CreateInferRequest()).WillByDefault(Return(mock_request));
|
||||
auto mockIPluginPtr = std::make_shared<MockIInferencePlugin>();
|
||||
ON_CALL(*mockIPluginPtr, LoadNetwork(MatcherCast<const CNNNetwork&>(_), _)).WillByDefault(Return(mockIExeNet));
|
||||
plugin = InferenceEngine::InferencePlugin{{}, mockIPluginPtr};
|
||||
plugin = InferenceEngine::InferencePlugin{mockIPluginPtr, {}};
|
||||
exeNetwork = plugin.LoadNetwork(CNNNetwork{}, {});
|
||||
request = exeNetwork->CreateInferRequest();
|
||||
_incorrectName = "incorrect_name";
|
||||
@@ -220,7 +220,7 @@ protected:
|
||||
ON_CALL(*mockIExeNet, CreateInferRequest()).WillByDefault(Return(mockInferRequestInternal));
|
||||
auto mockIPluginPtr = std::make_shared<MockIInferencePlugin>();
|
||||
ON_CALL(*mockIPluginPtr, LoadNetwork(MatcherCast<const CNNNetwork&>(_), _)).WillByDefault(Return(mockIExeNet));
|
||||
auto plugin = InferenceEngine::InferencePlugin{{}, mockIPluginPtr};
|
||||
auto plugin = InferenceEngine::InferencePlugin{mockIPluginPtr, {}};
|
||||
auto exeNetwork = plugin.LoadNetwork(CNNNetwork{}, {});
|
||||
return exeNetwork->CreateInferRequest();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class InferRequestVariableStateTests : public ::testing::Test {
|
||||
ON_CALL(*mockExeNetworkInternal, CreateInferRequest()).WillByDefault(Return(mockInferRequestInternal));
|
||||
auto mockIPluginPtr = std::make_shared<MockIInferencePlugin>();
|
||||
ON_CALL(*mockIPluginPtr, LoadNetwork(MatcherCast<const CNNNetwork&>(_), _)).WillByDefault(Return(mockExeNetworkInternal));
|
||||
plugin = InferenceEngine::InferencePlugin{{}, mockIPluginPtr};
|
||||
plugin = InferenceEngine::InferencePlugin{mockIPluginPtr, {}};
|
||||
net = plugin.LoadNetwork(CNNNetwork{}, {});
|
||||
req = net->CreateInferRequest();
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ protected:
|
||||
mockIExeNet = std::make_shared<MockIExecutableNetworkInternal>();
|
||||
auto mockIPluginPtr = std::make_shared<MockIInferencePlugin>();
|
||||
ON_CALL(*mockIPluginPtr, LoadNetwork(MatcherCast<const CNNNetwork&>(_), _)).WillByDefault(Return(mockIExeNet));
|
||||
plugin = InferenceEngine::InferencePlugin{{}, mockIPluginPtr};
|
||||
plugin = InferenceEngine::InferencePlugin{mockIPluginPtr, {}};
|
||||
exeNetwork = plugin.LoadNetwork(CNNNetwork{}, {});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user