Remove deprecated api (#6256)
* Revert "Fixed creation of C++ wrappers from old API (#5805)"
This reverts commit ffe03b6ed3
.
* Removed deprecated API
* Fixes 2
This commit is contained in:
parent
72c8743a71
commit
7e66411928
@ -32,9 +32,6 @@ class IExecutableNetworkInternal;
|
||||
class INFERENCE_ENGINE_API_CLASS(ExecutableNetwork) {
|
||||
details::SharedObjectLoader _so;
|
||||
std::shared_ptr<IExecutableNetworkInternal> _impl;
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
std::shared_ptr<IExecutableNetwork> actual;
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
||||
/**
|
||||
* @brief Constructs ExecutableNetwork from the initialized std::shared_ptr
|
||||
@ -51,18 +48,6 @@ public:
|
||||
*/
|
||||
ExecutableNetwork() = default;
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
/**
|
||||
* @deprecated This ctor will be removed in 2022.1
|
||||
* @brief Constructs ExecutableNetwork from the initialized std::shared_ptr
|
||||
* @param exec Initialized shared pointer
|
||||
* @param splg Plugin to use. This is required to ensure that ExecutableNetwork can work properly even if plugin object is destroyed.
|
||||
*/
|
||||
INFERENCE_ENGINE_DEPRECATED("This ctor will be removed in 2022.1")
|
||||
explicit ExecutableNetwork(std::shared_ptr<IExecutableNetwork> exec,
|
||||
std::shared_ptr<details::SharedObjectLoader> splg = {});
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
||||
/**
|
||||
* @brief Gets the Executable network output Data node information.
|
||||
*
|
||||
|
@ -35,10 +35,6 @@ class ICompletionCallbackWrapper;
|
||||
class INFERENCE_ENGINE_API_CLASS(InferRequest) {
|
||||
details::SharedObjectLoader _so;
|
||||
std::shared_ptr<IInferRequestInternal> _impl;
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
IInferRequest::Ptr actual;
|
||||
std::shared_ptr<details::ICompletionCallbackWrapper> callback;
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
||||
/**
|
||||
* @brief Constructs InferRequest from the initialized std::shared_ptr
|
||||
@ -71,18 +67,6 @@ public:
|
||||
*/
|
||||
InferRequest() = default;
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
/**
|
||||
* @deprecated This ctor will be removed in 2022.1
|
||||
* @brief Constructs InferRequest from the initialized std::shared_ptr
|
||||
* @param request Initialized shared pointer
|
||||
* @param splg Plugin to use. This is required to ensure that InferRequest can work properly even if plugin object is destroyed.
|
||||
*/
|
||||
INFERENCE_ENGINE_DEPRECATED("This ctor will be removed in 2022.1")
|
||||
explicit InferRequest(IInferRequest::Ptr request,
|
||||
std::shared_ptr<details::SharedObjectLoader> splg = {});
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
||||
/**
|
||||
* @brief Sets input/output data to infer
|
||||
*
|
||||
|
@ -3,7 +3,7 @@
|
||||
//
|
||||
|
||||
/**
|
||||
* @brief A header file that provides wrapper classes for IVariableState
|
||||
* @brief A header file that provides VariableState
|
||||
*
|
||||
* @file ie_memory_state.hpp
|
||||
*/
|
||||
@ -16,21 +16,17 @@
|
||||
#include "ie_api.h"
|
||||
#include "ie_blob.h"
|
||||
#include "details/ie_so_loader.h"
|
||||
#include "ie_imemory_state.hpp"
|
||||
|
||||
namespace InferenceEngine {
|
||||
|
||||
class IVariableStateInternal;
|
||||
|
||||
/**
|
||||
* @brief C++ exception based error reporting wrapper of API class IVariableState
|
||||
* @brief VariableState class
|
||||
*/
|
||||
class INFERENCE_ENGINE_API_CLASS(VariableState) {
|
||||
details::SharedObjectLoader _so;
|
||||
std::shared_ptr<IVariableStateInternal> _impl;
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
std::shared_ptr<IVariableState> actual;
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
||||
/**
|
||||
* @brief Constructs VariableState from the initialized std::shared_ptr
|
||||
@ -48,55 +44,27 @@ public:
|
||||
*/
|
||||
VariableState() = default;
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
/**
|
||||
* @deprecated This ctor will be removed in 2022.1
|
||||
* @brief constructs VariableState from the initialized std::shared_ptr
|
||||
* @param pState Initialized shared pointer
|
||||
* @param plg Optional: Plugin to use. This is required to ensure that VariableState can work properly even if plugin object is destroyed.
|
||||
*/
|
||||
INFERENCE_ENGINE_DEPRECATED("This ctor will be removed in 2022.1")
|
||||
explicit VariableState(std::shared_ptr<IVariableState> pState,
|
||||
std::shared_ptr<details::SharedObjectLoader> plg = {});
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
||||
/**
|
||||
* @copybrief IVariableState::Reset
|
||||
*
|
||||
* Wraps IVariableState::Reset
|
||||
* @brief Reset internal variable state for relevant infer request,
|
||||
* to a value specified as default for according ReadValue node
|
||||
*/
|
||||
void Reset();
|
||||
|
||||
/**
|
||||
* @copybrief IVariableState::GetName
|
||||
*
|
||||
* Wraps IVariableState::GetName
|
||||
* @brief Gets name of current variable state, if length of array is not enough name is truncated by len, null
|
||||
* terminator is inserted as well. As variable state name `variable_id` from according `ReadValue` used.
|
||||
* @return A string representing a state name
|
||||
*/
|
||||
std::string GetName() const;
|
||||
|
||||
/**
|
||||
* @copybrief IVariableState::GetState
|
||||
*
|
||||
* Wraps IVariableState::GetState
|
||||
* @brief Returns the value of the variable state.
|
||||
* @return A blob representing a state
|
||||
*/
|
||||
Blob::CPtr GetState() const;
|
||||
|
||||
/**
|
||||
* @copybrief IVariableState::GetLastState
|
||||
* @deprecated Use IVariableState::SetState instead
|
||||
*
|
||||
* Wraps IVariableState::GetLastState
|
||||
* @return A blob representing a last state
|
||||
*/
|
||||
INFERENCE_ENGINE_DEPRECATED("Use VariableState::GetState function instead")
|
||||
Blob::CPtr GetLastState() const;
|
||||
|
||||
/**
|
||||
* @copybrief IVariableState::SetState
|
||||
*
|
||||
* Wraps IVariableState::SetState
|
||||
* @brief Sets the new state for the next inference.
|
||||
* @param state The current state to set
|
||||
*/
|
||||
void SetState(Blob::Ptr state);
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "ie_common.h"
|
||||
#include "ie_icnn_network.hpp"
|
||||
#include "ie_iinfer_request.hpp"
|
||||
#include "ie_imemory_state.hpp"
|
||||
#include "ie_input_info.hpp"
|
||||
#include "ie_parameter.hpp"
|
||||
#include "ie_remote_context.hpp"
|
||||
@ -113,22 +112,6 @@ public:
|
||||
INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::ExecutableNetwork::GetExecGraphInfo instead")
|
||||
virtual StatusCode GetExecGraphInfo(ICNNNetwork::Ptr& graphPtr, ResponseDesc* resp) noexcept = 0;
|
||||
|
||||
/**
|
||||
* @deprecated Use InferRequest::QueryState instead
|
||||
* @brief Gets state control interface for given executable network.
|
||||
*
|
||||
* State control essential for recurrent networks
|
||||
*
|
||||
* @param pState reference to a pointer that receives internal states
|
||||
* @param idx requested index for receiving memory state
|
||||
* @param resp Optional: pointer to an already allocated object to contain information in case of failure
|
||||
* @return Status code of the operation: InferenceEngine::OK (0) for success, OUT_OF_BOUNDS (-6) no memory state for
|
||||
* given index
|
||||
*/
|
||||
INFERENCE_ENGINE_DEPRECATED("Use InferRequest::QueryState instead")
|
||||
virtual StatusCode QueryState(IVariableState::Ptr& pState, size_t idx, ResponseDesc* resp) noexcept = 0;
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
||||
/**
|
||||
* @brief Sets configuration for current executable network
|
||||
*
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "ie_blob.h"
|
||||
#include "ie_common.h"
|
||||
#include "ie_preprocess.hpp"
|
||||
#include "ie_imemory_state.hpp"
|
||||
|
||||
namespace InferenceEngine {
|
||||
|
||||
@ -195,21 +194,6 @@ public:
|
||||
*/
|
||||
virtual InferenceEngine::StatusCode SetBatch(int batch_size, ResponseDesc* resp) noexcept = 0;
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
/**
|
||||
* @brief Gets state control interface for given infer request.
|
||||
*
|
||||
* State control essential for recurrent networks
|
||||
*
|
||||
* @param pState reference to a pointer that receives internal states
|
||||
* @param idx requested index for receiving memory state
|
||||
* @param resp Optional: pointer to an already allocated object to contain information in case of failure
|
||||
* @return Status code of the operation: InferenceEngine::OK (0) for success, OUT_OF_BOUNDS (-6) no memory state for
|
||||
* given index
|
||||
*/
|
||||
virtual StatusCode QueryState(IVariableState::Ptr& pState, size_t idx, ResponseDesc* resp) noexcept = 0;
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
||||
protected:
|
||||
~IInferRequest() = default;
|
||||
};
|
||||
|
@ -1,95 +0,0 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
/**
|
||||
* @brief a header file for IVariableState interface
|
||||
*
|
||||
* @file ie_imemory_state.hpp
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "ie_blob.h"
|
||||
#include "ie_common.h"
|
||||
|
||||
namespace InferenceEngine {
|
||||
|
||||
/**
|
||||
* @deprecated Use InferenceEngine::VariableState C++ wrapper instead
|
||||
* @interface IVariableState
|
||||
* @brief Manages data for reset operations
|
||||
*/
|
||||
class INFERENCE_ENGINE_DEPRECATED("InferenceEngine::") IVariableState {
|
||||
public:
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
/**
|
||||
* @brief A shared pointer to the IVariableState interface
|
||||
*/
|
||||
using Ptr = std::shared_ptr<IVariableState>;
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
||||
/**
|
||||
* @brief Gets name of current variable state, if length of array is not enough name is truncated by len, null
|
||||
* terminator is inserted as well. As variable state name `variable_id` from according `ReadValue` used.
|
||||
*
|
||||
* @param name preallocated buffer for receiving name
|
||||
* @param len Length of the buffer
|
||||
* @param resp Optional: pointer to an already allocated object to contain information in case of failure
|
||||
* @return Status code of the operation: InferenceEngine::OK (0) for success
|
||||
*/
|
||||
virtual StatusCode GetName(char* name, size_t len, ResponseDesc* resp) const noexcept = 0;
|
||||
|
||||
/**
|
||||
* @brief Reset internal variable state for relevant infer request, to a value specified as default for according ReadValue node
|
||||
*
|
||||
* @param resp Optional: pointer to an already allocated object to contain information in case of failure
|
||||
* @return Status code of the operation: InferenceEngine::OK (0) for success*
|
||||
*/
|
||||
virtual StatusCode Reset(ResponseDesc* resp) noexcept = 0;
|
||||
|
||||
/**
|
||||
* @brief Sets the new state for the next inference.
|
||||
*
|
||||
* This method can fail if Blob size does not match the internal state size or precision
|
||||
*
|
||||
* @param newState The data to use as new state
|
||||
* @param resp Optional: pointer to an already allocated object to contain information in case of failure
|
||||
* @return Status code of the operation: InferenceEngine::OK (0) for success
|
||||
*/
|
||||
virtual StatusCode SetState(Blob::Ptr newState, ResponseDesc* resp) noexcept = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the value of the variable state.
|
||||
*
|
||||
* @param state A reference to a blob containing a variable state
|
||||
* @param resp Optional: pointer to an already allocated object to contain information in case of failure
|
||||
* @return Status code of the operation: InferenceEngine::OK (0) for success
|
||||
*/
|
||||
INFERENCE_ENGINE_DEPRECATED("Use GetState function instead")
|
||||
virtual StatusCode GetLastState(Blob::CPtr& state, ResponseDesc* resp) const noexcept {
|
||||
return GetState(state, resp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the value of the variable state.
|
||||
*
|
||||
* @param state A reference to a blob containing a variable state
|
||||
* @param resp Optional: pointer to an already allocated object to contain information in case of failure
|
||||
* @return Status code of the operation: InferenceEngine::OK (0) for success
|
||||
*/
|
||||
virtual StatusCode GetState(Blob::CPtr& state, ResponseDesc* resp) const noexcept = 0;
|
||||
};
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
|
||||
/**
|
||||
* @brief For compatibility reasons.
|
||||
*/
|
||||
using IMemoryState = IVariableState;
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
||||
} // namespace InferenceEngine
|
@ -49,26 +49,6 @@ public:
|
||||
std::swap(ptr, parameter.ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use ngraph::Variant directly
|
||||
* @brief Creates parameter from variant.
|
||||
* This method creates empty parameter if variant doesn't contain Parameter
|
||||
*
|
||||
* @param var ngraph variant
|
||||
*/
|
||||
INFERENCE_ENGINE_DEPRECATED("Use ngraph::Variant directly")
|
||||
Parameter(const std::shared_ptr<ngraph::Variant>& var);
|
||||
|
||||
/**
|
||||
* @deprecated Use ngraph::Variant directly
|
||||
* @brief Creates parameter from variant.
|
||||
* This method creates empty parameter if variant doesn't contain Parameter
|
||||
*
|
||||
* @param var ngraph variant
|
||||
*/
|
||||
INFERENCE_ENGINE_DEPRECATED("Use ngraph::Variant directly")
|
||||
Parameter(std::shared_ptr<ngraph::Variant>& var);
|
||||
|
||||
/**
|
||||
* @brief Copy constructor
|
||||
*
|
||||
@ -204,28 +184,6 @@ public:
|
||||
return dyn_cast<typename std::remove_cv<T>::type>(ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use ngraph::Variant directly
|
||||
* @brief Converts parameter to shared pointer on ngraph::Variant
|
||||
*
|
||||
* @return shared pointer on ngraph::Variant
|
||||
*/
|
||||
INFERENCE_ENGINE_DEPRECATED("Use ngraph::Variant directly")
|
||||
std::shared_ptr<ngraph::Variant> asVariant() const;
|
||||
|
||||
/**
|
||||
* @deprecated Use ngraph::Variant directly
|
||||
* @brief Casts to shared pointer on ngraph::Variant
|
||||
*
|
||||
* @return shared pointer on ngraph::Variant
|
||||
*/
|
||||
INFERENCE_ENGINE_DEPRECATED("Use ngraph::Variant directly")
|
||||
operator std::shared_ptr<ngraph::Variant>() const {
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
return asVariant();
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamic cast to specified type
|
||||
* @tparam T type
|
||||
|
@ -1,69 +0,0 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
/**
|
||||
* @brief This is a header file with common inference engine definitions
|
||||
*
|
||||
* @file ie_unicode.hpp
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifdef UNICODE
|
||||
typedef wchar_t tchar;
|
||||
typedef std::wstring file_name_t;
|
||||
#else
|
||||
typedef char tchar;
|
||||
typedef std::string file_name_t;
|
||||
#endif
|
||||
|
||||
namespace InferenceEngine {
|
||||
|
||||
/**
|
||||
* @deprecated Use OS-native conversion utilities
|
||||
* @brief Conversion from possibly-wide character string to a single-byte chain.
|
||||
* @param str A possibly-wide character string
|
||||
* @return A single-byte character string
|
||||
*/
|
||||
INFERENCE_ENGINE_DEPRECATED("Use OS-native conversion utilities")
|
||||
inline std::string fileNameToString(const file_name_t& str) {
|
||||
#ifdef UNICODE
|
||||
size_t maxlen = (str.length() + 1) * sizeof(wchar_t) / sizeof(char);
|
||||
std::vector<char> mbstr(maxlen);
|
||||
mbstr[0] = 0;
|
||||
std::wcstombs(&mbstr[0], str.c_str(), maxlen);
|
||||
std::string res = std::string(&mbstr[0]);
|
||||
return res;
|
||||
#else
|
||||
return str;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use OS-native conversion utilities
|
||||
* @brief Conversion from single-byte character string to a possibly-wide one
|
||||
* @param str A single-byte character string
|
||||
* @return A possibly-wide character string
|
||||
*/
|
||||
INFERENCE_ENGINE_DEPRECATED("Use OS-native conversion utilities")
|
||||
inline file_name_t stringToFileName(const std::string& str) {
|
||||
#ifdef UNICODE
|
||||
size_t maxlen = str.length() + 1;
|
||||
std::vector<wchar_t> wcstr(maxlen);
|
||||
wcstr[0] = 0;
|
||||
std::mbstowcs(&wcstr[0], str.c_str(), maxlen);
|
||||
file_name_t res = file_name_t(&wcstr[0]);
|
||||
return res;
|
||||
#else
|
||||
return str;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace InferenceEngine
|
@ -25,47 +25,15 @@ ExecutableNetwork::ExecutableNetwork(const details::SharedObjectLoader& so,
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
|
||||
ExecutableNetwork::ExecutableNetwork(IExecutableNetwork::Ptr exec,
|
||||
std::shared_ptr<details::SharedObjectLoader> splg)
|
||||
: _so(), _impl(), actual(exec) {
|
||||
if (splg) {
|
||||
_so = *splg;
|
||||
}
|
||||
|
||||
// plg can be null, but not the actual
|
||||
if (actual == nullptr)
|
||||
IE_THROW(NotAllocated) << "ExecutableNetwork was not initialized.";
|
||||
}
|
||||
|
||||
ConstOutputsDataMap ExecutableNetwork::GetOutputsInfo() const {
|
||||
if (actual) {
|
||||
ConstOutputsDataMap data;
|
||||
CALL_STATUS_FNC(GetOutputsInfo, data);
|
||||
return data;
|
||||
}
|
||||
|
||||
EXEC_NET_CALL_STATEMENT(return _impl->GetOutputsInfo());
|
||||
}
|
||||
|
||||
ConstInputsDataMap ExecutableNetwork::GetInputsInfo() const {
|
||||
if (actual) {
|
||||
ConstInputsDataMap info;
|
||||
CALL_STATUS_FNC(GetInputsInfo, info);
|
||||
return info;
|
||||
}
|
||||
|
||||
EXEC_NET_CALL_STATEMENT(return _impl->GetInputsInfo());
|
||||
}
|
||||
|
||||
void ExecutableNetwork::reset(IExecutableNetwork::Ptr newActual) {
|
||||
if (actual) {
|
||||
if (newActual == nullptr) {
|
||||
THROW_IE_EXCEPTION << "ExecutableNetwork wrapper used for reset was not initialized.";
|
||||
}
|
||||
this->actual.swap(newActual);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_impl == nullptr) IE_THROW() << "ExecutableNetwork was not initialized.";
|
||||
if (newActual == nullptr) IE_THROW() << "ExecutableNetwork wrapper used for reset was not initialized.";
|
||||
auto newBase = std::dynamic_pointer_cast<ExecutableNetworkBase>(newActual);
|
||||
@ -76,36 +44,10 @@ void ExecutableNetwork::reset(IExecutableNetwork::Ptr newActual) {
|
||||
}
|
||||
|
||||
ExecutableNetwork::operator IExecutableNetwork::Ptr() {
|
||||
if (actual) {
|
||||
return actual;
|
||||
}
|
||||
|
||||
return std::make_shared<ExecutableNetworkBase>(_impl);
|
||||
}
|
||||
|
||||
std::vector<VariableState> ExecutableNetwork::QueryState() {
|
||||
if (actual) {
|
||||
if (actual == nullptr) THROW_IE_EXCEPTION << "ExecutableNetwork was not initialized.";
|
||||
IVariableState::Ptr pState = nullptr;
|
||||
auto res = OK;
|
||||
std::vector<VariableState> controller;
|
||||
for (size_t idx = 0; res == OK; ++idx) {
|
||||
ResponseDesc resp;
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
res = actual->QueryState(pState, idx, &resp);
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
if (res != OK && res != OUT_OF_BOUNDS) {
|
||||
THROW_IE_EXCEPTION << resp.msg;
|
||||
}
|
||||
if (res != OUT_OF_BOUNDS) {
|
||||
controller.push_back(VariableState(pState,
|
||||
std::make_shared<details::SharedObjectLoader>(_so)));
|
||||
}
|
||||
}
|
||||
|
||||
return controller;
|
||||
}
|
||||
|
||||
std::vector<VariableState> controller;
|
||||
EXEC_NET_CALL_STATEMENT(
|
||||
for (auto&& state : _impl->QueryState()) {
|
||||
@ -115,13 +57,6 @@ std::vector<VariableState> ExecutableNetwork::QueryState() {
|
||||
}
|
||||
|
||||
InferRequest ExecutableNetwork::CreateInferRequest() {
|
||||
if (actual) {
|
||||
IInferRequest::Ptr req;
|
||||
CALL_STATUS_FNC(CreateInferRequest, req);
|
||||
if (req.get() == nullptr) THROW_IE_EXCEPTION << "Internal error: pointer to infer request is null";
|
||||
return InferRequest(req, std::make_shared<details::SharedObjectLoader>(_so));
|
||||
}
|
||||
|
||||
EXEC_NET_CALL_STATEMENT(return {_so, _impl->CreateInferRequest()});
|
||||
}
|
||||
|
||||
@ -130,72 +65,38 @@ InferRequest::Ptr ExecutableNetwork::CreateInferRequestPtr() {
|
||||
}
|
||||
|
||||
void ExecutableNetwork::Export(const std::string& modelFileName) {
|
||||
if (actual) {
|
||||
CALL_STATUS_FNC(Export, modelFileName);
|
||||
return;
|
||||
}
|
||||
EXEC_NET_CALL_STATEMENT(_impl->Export(modelFileName));
|
||||
}
|
||||
|
||||
void ExecutableNetwork::Export(std::ostream& networkModel) {
|
||||
if (actual) {
|
||||
CALL_STATUS_FNC(Export, networkModel);
|
||||
return;
|
||||
}
|
||||
EXEC_NET_CALL_STATEMENT(_impl->Export(networkModel));
|
||||
}
|
||||
|
||||
CNNNetwork ExecutableNetwork::GetExecGraphInfo() {
|
||||
if (actual) {
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
ICNNNetwork::Ptr ptr = nullptr;
|
||||
CALL_STATUS_FNC(GetExecGraphInfo, ptr);
|
||||
return CNNNetwork(ptr);
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
EXEC_NET_CALL_STATEMENT(return _impl->GetExecGraphInfo());
|
||||
}
|
||||
|
||||
void ExecutableNetwork::SetConfig(const std::map<std::string, Parameter>& config) {
|
||||
if (actual) {
|
||||
CALL_STATUS_FNC(SetConfig, config);
|
||||
return;
|
||||
}
|
||||
EXEC_NET_CALL_STATEMENT(_impl->SetConfig(config));
|
||||
}
|
||||
|
||||
Parameter ExecutableNetwork::GetConfig(const std::string& name) const {
|
||||
if (actual) {
|
||||
Parameter configValue;
|
||||
CALL_STATUS_FNC(GetConfig, name, configValue);
|
||||
return configValue;
|
||||
}
|
||||
EXEC_NET_CALL_STATEMENT(return _impl->GetConfig(name));
|
||||
}
|
||||
|
||||
Parameter ExecutableNetwork::GetMetric(const std::string& name) const {
|
||||
if (actual) {
|
||||
Parameter metricValue;
|
||||
CALL_STATUS_FNC(GetMetric, name, metricValue);
|
||||
return metricValue;
|
||||
}
|
||||
EXEC_NET_CALL_STATEMENT(return _impl->GetMetric(name));
|
||||
}
|
||||
|
||||
RemoteContext::Ptr ExecutableNetwork::GetContext() const {
|
||||
if (actual) {
|
||||
RemoteContext::Ptr pContext;
|
||||
CALL_STATUS_FNC(GetContext, pContext);
|
||||
return pContext;
|
||||
}
|
||||
EXEC_NET_CALL_STATEMENT(return _impl->GetContext());
|
||||
}
|
||||
|
||||
bool ExecutableNetwork::operator!() const noexcept {
|
||||
return !_impl || !actual;
|
||||
return !_impl;
|
||||
}
|
||||
|
||||
ExecutableNetwork::operator bool() const noexcept {
|
||||
return !!_impl || !!actual;
|
||||
return !!_impl;
|
||||
}
|
||||
} // namespace InferenceEngine
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include <cpp_interfaces/interface/ie_ivariable_state_internal.hpp>
|
||||
#include <cpp_interfaces/interface/ie_iexecutable_network_internal.hpp>
|
||||
#include "cpp/exception2status.hpp"
|
||||
#include "ie_variable_state_base.hpp"
|
||||
#include "ie_infer_async_request_base.hpp"
|
||||
|
||||
namespace InferenceEngine {
|
||||
@ -64,29 +63,10 @@ public:
|
||||
TO_STATUS(_impl->Export(networkModel));
|
||||
}
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
StatusCode GetExecGraphInfo(ICNNNetwork::Ptr& graphPtr, ResponseDesc* resp) noexcept override {
|
||||
// should be refactored together with ExecutableNetwork interface
|
||||
TO_STATUS(graphPtr = _impl->GetExecGraphInfo());
|
||||
}
|
||||
|
||||
INFERENCE_ENGINE_DEPRECATED("Use InferRequest::QueryState instead")
|
||||
StatusCode QueryState(IVariableState::Ptr& pState, size_t idx, ResponseDesc* resp) noexcept override {
|
||||
try {
|
||||
auto v = _impl->QueryState();
|
||||
if (idx >= v.size()) {
|
||||
return OUT_OF_BOUNDS;
|
||||
}
|
||||
pState = std::make_shared<VariableStateBase>(v[idx]);
|
||||
return OK;
|
||||
} catch (const std::exception& ex) {
|
||||
return InferenceEngine::DescriptionBuffer(GENERAL_ERROR, resp) << ex.what();
|
||||
} catch (...) {
|
||||
return InferenceEngine::DescriptionBuffer(UNEXPECTED);
|
||||
}
|
||||
}
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
||||
StatusCode SetConfig(const std::map<std::string, Parameter>& config, ResponseDesc* resp) noexcept override {
|
||||
TO_STATUS(_impl->SetConfig(config));
|
||||
}
|
||||
|
@ -10,10 +10,10 @@
|
||||
|
||||
#include "cpp/exception2status.hpp"
|
||||
#include "cpp_interfaces/plugin_itt.hpp"
|
||||
#include "ie_variable_state_base.hpp"
|
||||
#include <cpp_interfaces/interface/ie_iinfer_request_internal.hpp>
|
||||
#include "ie_iinfer_request.hpp"
|
||||
#include "ie_preprocess.hpp"
|
||||
|
||||
namespace InferenceEngine {
|
||||
|
||||
#define CATCH_IE_EXCEPTION_TO_STATUS_NO_RESP(StatusCode, ExceptionType) catch (const ExceptionType& ex) { \
|
||||
@ -169,23 +169,6 @@ public:
|
||||
StatusCode SetBatch(int batch_size, ResponseDesc* resp) noexcept override {
|
||||
TO_STATUS(_impl->SetBatch(batch_size));
|
||||
}
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
StatusCode QueryState(IVariableState::Ptr& pState, size_t idx, ResponseDesc* resp) noexcept override {
|
||||
try {
|
||||
auto v = _impl->QueryState();
|
||||
if (idx >= v.size()) {
|
||||
return OUT_OF_BOUNDS;
|
||||
}
|
||||
pState = std::make_shared<VariableStateBase>(v[idx]);
|
||||
return OK;
|
||||
} catch (const std::exception& ex) {
|
||||
return InferenceEngine::DescriptionBuffer(GENERAL_ERROR, resp) << ex.what();
|
||||
} catch (...) {
|
||||
return InferenceEngine::DescriptionBuffer(UNEXPECTED);
|
||||
}
|
||||
}
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
};
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
@ -23,44 +23,17 @@ namespace InferenceEngine {
|
||||
|
||||
InferRequest::InferRequest(const details::SharedObjectLoader& so,
|
||||
const IInferRequestInternal::Ptr& impl)
|
||||
: _so(so), _impl(impl), actual() {
|
||||
: _so(so), _impl(impl) {
|
||||
IE_ASSERT(_impl != nullptr);
|
||||
}
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
|
||||
InferRequest::InferRequest(IInferRequest::Ptr request,
|
||||
std::shared_ptr<details::SharedObjectLoader> splg)
|
||||
: _so(), _impl(), actual(request) {
|
||||
if (splg) {
|
||||
_so = *splg;
|
||||
}
|
||||
|
||||
// plg can be null, but not the actual
|
||||
if (actual == nullptr)
|
||||
IE_THROW(NotAllocated) << "InferRequest was not initialized.";
|
||||
}
|
||||
|
||||
void InferRequest::SetBlob(const std::string& name, const Blob::Ptr& data) {
|
||||
if (actual) {
|
||||
CALL_STATUS_FNC(SetBlob, name.c_str(), data);
|
||||
return;
|
||||
}
|
||||
INFER_REQ_CALL_STATEMENT(_impl->SetBlob(name, data);)
|
||||
}
|
||||
|
||||
Blob::Ptr InferRequest::GetBlob(const std::string& name) {
|
||||
if (actual) {
|
||||
Blob::Ptr data;
|
||||
CALL_STATUS_FNC(GetBlob, name.c_str(), data);
|
||||
std::string error = "Internal error: blob with name `" + name + "` is not allocated!";
|
||||
auto blobPtr = data.get();
|
||||
const bool remoteBlobPassed = blobPtr->is<RemoteBlob>();
|
||||
if (blobPtr == nullptr) IE_THROW() << error;
|
||||
if (!remoteBlobPassed && blobPtr->buffer() == nullptr) IE_THROW() << error;
|
||||
return data;
|
||||
}
|
||||
|
||||
Blob::Ptr blobPtr;
|
||||
INFER_REQ_CALL_STATEMENT(blobPtr = _impl->GetBlob(name);)
|
||||
std::string error = "Internal error: blob with name `" + name + "` is not allocated!";
|
||||
@ -71,60 +44,26 @@ Blob::Ptr InferRequest::GetBlob(const std::string& name) {
|
||||
}
|
||||
|
||||
void InferRequest::SetBlob(const std::string &name, const Blob::Ptr &data, const PreProcessInfo& info) {
|
||||
if (actual) {
|
||||
CALL_STATUS_FNC(SetBlob, name.c_str(), data, info);
|
||||
return;
|
||||
}
|
||||
|
||||
INFER_REQ_CALL_STATEMENT(_impl->SetBlob(name, data, info);)
|
||||
}
|
||||
|
||||
const PreProcessInfo& InferRequest::GetPreProcess(const std::string& name) const {
|
||||
if (actual) {
|
||||
const PreProcessInfo* info = nullptr;
|
||||
CALL_STATUS_FNC(GetPreProcess, name.c_str(), &info);
|
||||
return *info;
|
||||
}
|
||||
|
||||
INFER_REQ_CALL_STATEMENT(return _impl->GetPreProcess(name);)
|
||||
}
|
||||
|
||||
void InferRequest::Infer() {
|
||||
if (actual) {
|
||||
CALL_STATUS_FNC_NO_ARGS(Infer);
|
||||
return;
|
||||
}
|
||||
|
||||
INFER_REQ_CALL_STATEMENT(_impl->Infer();)
|
||||
}
|
||||
|
||||
void InferRequest::Cancel() {
|
||||
if (actual) {
|
||||
CALL_STATUS_FNC_NO_ARGS(Cancel);
|
||||
return;
|
||||
}
|
||||
|
||||
INFER_REQ_CALL_STATEMENT(_impl->Cancel();)
|
||||
}
|
||||
|
||||
std::map<std::string, InferenceEngineProfileInfo> InferRequest::GetPerformanceCounts() const {
|
||||
if (actual) {
|
||||
std::map<std::string, InferenceEngineProfileInfo> perfMap;
|
||||
CALL_STATUS_FNC(GetPerformanceCounts, perfMap);
|
||||
return perfMap;
|
||||
}
|
||||
|
||||
INFER_REQ_CALL_STATEMENT(return _impl->GetPerformanceCounts();)
|
||||
}
|
||||
|
||||
void InferRequest::SetInput(const BlobMap& inputs) {
|
||||
if (actual) {
|
||||
for (auto&& input : inputs) {
|
||||
CALL_STATUS_FNC(SetBlob, input.first.c_str(), input.second);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
INFER_REQ_CALL_STATEMENT(
|
||||
for (auto&& input : inputs) {
|
||||
_impl->SetBlob(input.first, input.second);
|
||||
@ -133,13 +72,6 @@ void InferRequest::SetInput(const BlobMap& inputs) {
|
||||
}
|
||||
|
||||
void InferRequest::SetOutput(const BlobMap& results) {
|
||||
if (actual) {
|
||||
for (auto&& result : results) {
|
||||
CALL_STATUS_FNC(SetBlob, result.first.c_str(), result.second);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
INFER_REQ_CALL_STATEMENT(
|
||||
for (auto&& result : results) {
|
||||
_impl->SetBlob(result.first, result.second);
|
||||
@ -148,106 +80,19 @@ void InferRequest::SetOutput(const BlobMap& results) {
|
||||
}
|
||||
|
||||
void InferRequest::SetBatch(const int batch) {
|
||||
if (actual) {
|
||||
CALL_STATUS_FNC(SetBatch, batch);
|
||||
return;
|
||||
}
|
||||
|
||||
INFER_REQ_CALL_STATEMENT(_impl->SetBatch(batch);)
|
||||
}
|
||||
|
||||
void InferRequest::StartAsync() {
|
||||
if (actual) {
|
||||
CALL_STATUS_FNC_NO_ARGS(StartAsync);
|
||||
return;
|
||||
}
|
||||
|
||||
INFER_REQ_CALL_STATEMENT(_impl->StartAsync();)
|
||||
}
|
||||
|
||||
|
||||
StatusCode InferRequest::Wait(int64_t millis_timeout) {
|
||||
if (actual) {
|
||||
ResponseDesc resp;
|
||||
if (actual == nullptr) IE_THROW() << "InferRequest was not initialized.";
|
||||
auto res = actual->Wait(millis_timeout, &resp);
|
||||
if (res != OK && res != RESULT_NOT_READY &&
|
||||
res != INFER_NOT_STARTED && res != INFER_CANCELLED) {
|
||||
IE_EXCEPTION_SWITCH(res, ExceptionType,
|
||||
InferenceEngine::details::ThrowNow<ExceptionType>{}
|
||||
<<= std::stringstream{} << IE_LOCATION << resp.msg)
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
INFER_REQ_CALL_STATEMENT(return _impl->Wait(millis_timeout);)
|
||||
}
|
||||
|
||||
namespace details {
|
||||
|
||||
class ICompletionCallbackWrapper {
|
||||
public:
|
||||
virtual ~ICompletionCallbackWrapper() = default;
|
||||
|
||||
virtual void call(InferenceEngine::IInferRequest::Ptr request, InferenceEngine::StatusCode code) const noexcept = 0;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class CompletionCallbackWrapper : public ICompletionCallbackWrapper {
|
||||
T lambda;
|
||||
|
||||
public:
|
||||
explicit CompletionCallbackWrapper(const T& lambda): lambda(lambda) {}
|
||||
|
||||
void call(InferenceEngine::IInferRequest::Ptr /*request*/, InferenceEngine::StatusCode /*code*/) const
|
||||
noexcept override {
|
||||
lambda();
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class CompletionCallbackWrapper<IInferRequest::CompletionCallback> : public ICompletionCallbackWrapper {
|
||||
IInferRequest::CompletionCallback callBack;
|
||||
|
||||
public:
|
||||
explicit CompletionCallbackWrapper(const IInferRequest::CompletionCallback& callBack): callBack(callBack) {}
|
||||
|
||||
void call(InferenceEngine::IInferRequest::Ptr request, InferenceEngine::StatusCode code) const noexcept override {
|
||||
callBack(request, code);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class CompletionCallbackWrapper<std::function<void(InferRequest, StatusCode)>> : public ICompletionCallbackWrapper {
|
||||
std::function<void(InferRequest, StatusCode)> lambda;
|
||||
|
||||
public:
|
||||
explicit CompletionCallbackWrapper(const std::function<void(InferRequest, InferenceEngine::StatusCode)>& lambda)
|
||||
: lambda(lambda) {}
|
||||
|
||||
void call(InferenceEngine::IInferRequest::Ptr request, InferenceEngine::StatusCode code) const noexcept override {
|
||||
lambda(InferRequest(request), code);
|
||||
}
|
||||
};
|
||||
|
||||
void callWrapper(InferenceEngine::IInferRequest::Ptr request, InferenceEngine::StatusCode code) {
|
||||
details::ICompletionCallbackWrapper* pWrapper = nullptr;
|
||||
ResponseDesc dsc;
|
||||
request->GetUserData(reinterpret_cast<void**>(&pWrapper), &dsc);
|
||||
pWrapper->call(request, code);
|
||||
}
|
||||
|
||||
} // namespace details
|
||||
|
||||
void InferRequest::SetCompletionCallbackImpl(std::function<void()> callbackToSet) {
|
||||
if (actual) {
|
||||
using T = std::function<void()>;
|
||||
callback.reset(new details::CompletionCallbackWrapper<T>(callbackToSet));
|
||||
CALL_STATUS_FNC(SetUserData, callback.get());
|
||||
actual->SetCompletionCallback(InferenceEngine::details::callWrapper);
|
||||
return;
|
||||
}
|
||||
|
||||
INFER_REQ_CALL_STATEMENT(
|
||||
_impl->SetCallback([callbackToSet] (std::exception_ptr) {
|
||||
callbackToSet();
|
||||
@ -274,14 +119,6 @@ void InferRequest::SetCompletionCallbackImpl(std::function<void()> callbackToSet
|
||||
|
||||
|
||||
void InferRequest::SetCompletionCallbackImpl(std::function<void(InferRequest, StatusCode)> callbackToSet) {
|
||||
if (actual) {
|
||||
using T = std::function<void(InferRequest, StatusCode)>;
|
||||
callback.reset(new details::CompletionCallbackWrapper<T>(callbackToSet));
|
||||
CALL_STATUS_FNC(SetUserData, callback.get());
|
||||
actual->SetCompletionCallback(InferenceEngine::details::callWrapper);
|
||||
return;
|
||||
}
|
||||
|
||||
INFER_REQ_CALL_STATEMENT(
|
||||
auto weakThis = InferRequest{_so, std::shared_ptr<IInferRequestInternal>{_impl.get(), [](IInferRequestInternal*){}}};
|
||||
_impl->SetCallback([callbackToSet, weakThis] (std::exception_ptr exceptionPtr) {
|
||||
@ -303,14 +140,6 @@ void InferRequest::SetCompletionCallbackImpl(std::function<void(InferRequest, St
|
||||
}
|
||||
|
||||
void InferRequest::SetCompletionCallbackImpl(IInferRequest::CompletionCallback callbackToSet) {
|
||||
if (actual) {
|
||||
using T = IInferRequest::CompletionCallback;
|
||||
callback.reset(new details::CompletionCallbackWrapper<T>(callbackToSet));
|
||||
CALL_STATUS_FNC(SetUserData, callback.get());
|
||||
actual->SetCompletionCallback(InferenceEngine::details::callWrapper);
|
||||
return;
|
||||
}
|
||||
|
||||
INFER_REQ_CALL_STATEMENT(
|
||||
IInferRequest::Ptr weakThis = InferRequest{_so, std::shared_ptr<IInferRequestInternal>{_impl.get(), [](IInferRequestInternal*){}}};
|
||||
_impl->SetCallback([callbackToSet, weakThis] (std::exception_ptr exceptionPtr) {
|
||||
@ -332,38 +161,12 @@ void InferRequest::SetCompletionCallbackImpl(IInferRequest::CompletionCallback c
|
||||
}
|
||||
|
||||
InferRequest::operator IInferRequest::Ptr () {
|
||||
if (actual) {
|
||||
return actual;
|
||||
}
|
||||
|
||||
INFER_REQ_CALL_STATEMENT(
|
||||
return std::make_shared<InferRequestBase>(_impl);
|
||||
)
|
||||
}
|
||||
|
||||
std::vector<VariableState> InferRequest::QueryState() {
|
||||
if (actual) {
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
if (actual == nullptr) IE_THROW() << "ExecutableNetwork was not initialized.";
|
||||
IVariableState::Ptr pState = nullptr;
|
||||
auto res = OK;
|
||||
std::vector<VariableState> controller;
|
||||
for (size_t idx = 0; res == OK; ++idx) {
|
||||
ResponseDesc resp;
|
||||
res = actual->QueryState(pState, idx, &resp);
|
||||
if (res != OK && res != OUT_OF_BOUNDS) {
|
||||
IE_THROW() << resp.msg;
|
||||
}
|
||||
if (res != OUT_OF_BOUNDS) {
|
||||
controller.push_back(VariableState(pState,
|
||||
std::make_shared<details::SharedObjectLoader>(_so)));
|
||||
}
|
||||
}
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
||||
return controller;
|
||||
}
|
||||
|
||||
std::vector<VariableState> controller;
|
||||
INFER_REQ_CALL_STATEMENT(
|
||||
for (auto&& state : _impl->QueryState()) {
|
||||
@ -374,11 +177,11 @@ std::vector<VariableState> InferRequest::QueryState() {
|
||||
}
|
||||
|
||||
bool InferRequest::operator!() const noexcept {
|
||||
return !_impl || !actual;
|
||||
return !_impl;
|
||||
}
|
||||
|
||||
InferRequest::operator bool() const noexcept {
|
||||
return (!!_impl) || (!!actual);
|
||||
return (!!_impl);
|
||||
}
|
||||
|
||||
bool InferRequest::operator!=(const InferRequest& r) const noexcept {
|
||||
@ -386,7 +189,7 @@ bool InferRequest::operator!=(const InferRequest& r) const noexcept {
|
||||
}
|
||||
|
||||
bool InferRequest::operator==(const InferRequest& r) const noexcept {
|
||||
return r._impl == _impl && r.actual == actual;
|
||||
return r._impl == _impl;
|
||||
}
|
||||
|
||||
} // namespace InferenceEngine
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
#include "details/ie_so_loader.h"
|
||||
#include "cpp/ie_memory_state.hpp"
|
||||
#include "ie_imemory_state.hpp"
|
||||
#include "cpp_interfaces/interface/ie_ivariable_state_internal.hpp"
|
||||
#include "exception2status.hpp"
|
||||
|
||||
@ -24,57 +23,19 @@ VariableState::VariableState(const details::SharedObjectLoader& so,
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
|
||||
VariableState::VariableState(std::shared_ptr<IVariableState> state,
|
||||
std::shared_ptr<details::SharedObjectLoader> splg)
|
||||
: _so(), _impl(), actual(state) {
|
||||
if (splg) {
|
||||
_so = *splg;
|
||||
}
|
||||
|
||||
// plg can be null, but not the actual
|
||||
if (actual == nullptr)
|
||||
IE_THROW(NotAllocated) << "VariableState was not initialized.";
|
||||
}
|
||||
|
||||
Blob::CPtr VariableState::GetLastState() const {
|
||||
return GetState();
|
||||
}
|
||||
|
||||
void VariableState::Reset() {
|
||||
if (actual) {
|
||||
CALL_STATUS_FNC_NO_ARGS(Reset);
|
||||
return;
|
||||
}
|
||||
|
||||
VARIABLE_CALL_STATEMENT(_impl->Reset());
|
||||
}
|
||||
|
||||
std::string VariableState::GetName() const {
|
||||
if (actual) {
|
||||
char name[256];
|
||||
CALL_STATUS_FNC(GetName, name, sizeof(name));
|
||||
return name;
|
||||
}
|
||||
|
||||
VARIABLE_CALL_STATEMENT(return _impl->GetName());
|
||||
}
|
||||
|
||||
Blob::CPtr VariableState::GetState() const {
|
||||
if (actual) {
|
||||
Blob::CPtr stateBlob;
|
||||
CALL_STATUS_FNC(GetState, stateBlob);
|
||||
return stateBlob;
|
||||
}
|
||||
|
||||
VARIABLE_CALL_STATEMENT(return _impl->GetState());
|
||||
}
|
||||
|
||||
void VariableState::SetState(Blob::Ptr state) {
|
||||
if (actual) {
|
||||
CALL_STATUS_FNC(SetState, state);
|
||||
return;
|
||||
}
|
||||
|
||||
VARIABLE_CALL_STATEMENT(_impl->SetState(state));
|
||||
}
|
||||
|
||||
|
@ -1,59 +0,0 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "cpp/exception2status.hpp"
|
||||
#include "cpp_interfaces/interface/ie_ivariable_state_internal.hpp"
|
||||
#include "ie_imemory_state.hpp"
|
||||
|
||||
namespace InferenceEngine {
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
|
||||
/**
|
||||
* @brief Default implementation for IVariableState
|
||||
* @ingroup ie_dev_api_variable_state_api
|
||||
*/
|
||||
class VariableStateBase : public IVariableState {
|
||||
std::shared_ptr<IVariableStateInternal> impl;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor with actual underlying implementation.
|
||||
* @param impl Underlying implementation of type IVariableStateInternal
|
||||
*/
|
||||
explicit VariableStateBase(std::shared_ptr<IVariableStateInternal> impl): impl(impl) {
|
||||
if (impl == nullptr) {
|
||||
IE_THROW() << "VariableStateBase implementation is not defined";
|
||||
}
|
||||
}
|
||||
|
||||
StatusCode GetName(char* name, size_t len, ResponseDesc* resp) const noexcept override {
|
||||
for (size_t i = 0; i != len; i++) {
|
||||
name[i] = 0;
|
||||
}
|
||||
DescriptionBuffer buf(name, len);
|
||||
TO_STATUS(buf << impl->GetName());
|
||||
return OK;
|
||||
}
|
||||
|
||||
StatusCode Reset(ResponseDesc* resp) noexcept override {
|
||||
TO_STATUS(impl->Reset());
|
||||
}
|
||||
|
||||
StatusCode SetState(Blob::Ptr newState, ResponseDesc* resp) noexcept override {
|
||||
TO_STATUS(impl->SetState(newState));
|
||||
}
|
||||
|
||||
StatusCode GetState(Blob::CPtr& state, ResponseDesc* resp) const noexcept override {
|
||||
TO_STATUS(state = impl->GetState());
|
||||
}
|
||||
};
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
||||
} // namespace InferenceEngine
|
@ -23,7 +23,4 @@ Blob::CPtr IVariableStateInternal::GetState() const {
|
||||
return state;
|
||||
}
|
||||
|
||||
Blob::CPtr IVariableStateInternal::GetLastState() const {
|
||||
return GetState();
|
||||
}
|
||||
} // namespace InferenceEngine
|
||||
|
@ -1,45 +0,0 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include <ie_parameter.hpp>
|
||||
#include <memory>
|
||||
|
||||
#include <ngraph/variant.hpp>
|
||||
|
||||
namespace ngraph {
|
||||
|
||||
template class INFERENCE_ENGINE_API_CLASS(VariantImpl<InferenceEngine::Parameter>);
|
||||
|
||||
template <>
|
||||
class INFERENCE_ENGINE_API_CLASS(VariantWrapper<InferenceEngine::Parameter>) : public VariantImpl<InferenceEngine::Parameter> {
|
||||
public:
|
||||
static constexpr VariantTypeInfo type_info {"Variant::InferenceEngine::Parameter", 0};
|
||||
const VariantTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
VariantWrapper(const value_type& value): VariantImpl<value_type>(value) {} // NOLINT
|
||||
};
|
||||
|
||||
} // namespace ngraph
|
||||
|
||||
constexpr ngraph::VariantTypeInfo ngraph::VariantWrapper<InferenceEngine::Parameter>::type_info;
|
||||
|
||||
InferenceEngine::Parameter::Parameter(const std::shared_ptr<ngraph::Variant>& var) {
|
||||
if (auto paramWrapper = std::dynamic_pointer_cast<ngraph::VariantWrapper<InferenceEngine::Parameter>>(var)) {
|
||||
auto param = paramWrapper->get();
|
||||
if (!param.empty()) ptr = param.ptr->copy();
|
||||
}
|
||||
}
|
||||
|
||||
InferenceEngine::Parameter::Parameter(std::shared_ptr<ngraph::Variant>& var) {
|
||||
if (auto paramWrapper = std::dynamic_pointer_cast<ngraph::VariantWrapper<InferenceEngine::Parameter>>(var)) {
|
||||
auto param = paramWrapper->get();
|
||||
if (!param.empty()) ptr = param.ptr->copy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<ngraph::Variant> InferenceEngine::Parameter::asVariant() const {
|
||||
return std::make_shared<ngraph::VariantWrapper<InferenceEngine::Parameter>>(*this);
|
||||
}
|
@ -50,14 +50,6 @@ public:
|
||||
*/
|
||||
virtual Blob::CPtr GetState() const;
|
||||
|
||||
/**
|
||||
* @deprecated Use IVariableStateInternal::GetState method instead
|
||||
* @brief Returns the value of the variable state.
|
||||
* @return The value of the variable state
|
||||
*/
|
||||
INFERENCE_ENGINE_DEPRECATED("Use IVariableStateInternal::GetState method instead")
|
||||
virtual Blob::CPtr GetLastState() const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief A default dtor
|
||||
|
@ -5,26 +5,12 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cpp/ie_infer_request.hpp>
|
||||
#include "unit_test_utils/mocks/mock_iinfer_request.hpp"
|
||||
|
||||
using namespace ::testing;
|
||||
using namespace std;
|
||||
using namespace InferenceEngine;
|
||||
using namespace InferenceEngine::details;
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
|
||||
TEST(InferRequestCPPTests, throwsOnUninitialized) {
|
||||
std::shared_ptr<IInferRequest> ptr;
|
||||
ASSERT_THROW(InferRequest req(ptr), InferenceEngine::NotAllocated);
|
||||
}
|
||||
|
||||
TEST(InferRequestCPPTests, nothrowOnInitialized) {
|
||||
std::shared_ptr<IInferRequest> ptr = std::make_shared<MockIInferRequest>();
|
||||
ASSERT_NO_THROW(InferRequest req(ptr));
|
||||
}
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
||||
TEST(InferRequestCPPTests, throwsOnUninitializedSetBlob) {
|
||||
InferRequest req;
|
||||
|
@ -4,75 +4,60 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <cpp/ie_executable_network.hpp>
|
||||
#include "unit_test_utils/mocks/mock_iexecutable_network.hpp"
|
||||
|
||||
using namespace ::testing;
|
||||
using namespace std;
|
||||
using namespace InferenceEngine;
|
||||
using namespace InferenceEngine::details;
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
|
||||
TEST(ExecutableNetworkTests, throwsOnUninitialized) {
|
||||
std::shared_ptr<IExecutableNetwork> ptr;
|
||||
ASSERT_THROW(ExecutableNetwork req(ptr), InferenceEngine::NotAllocated);
|
||||
}
|
||||
|
||||
TEST(ExecutableNetworkTests, nothrowOnInitialized) {
|
||||
std::shared_ptr<IExecutableNetwork> ptr = std::make_shared<MockIExecutableNetwork>();
|
||||
ASSERT_NO_THROW(ExecutableNetwork req(ptr));
|
||||
}
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
||||
TEST(ExecutableNetworkTests, throwsOnUninitializedGetOutputsInfo) {
|
||||
ExecutableNetwork exec;
|
||||
ASSERT_THROW(exec.GetOutputsInfo(), InferenceEngine::Exception);
|
||||
ASSERT_THROW(exec.GetOutputsInfo(), InferenceEngine::NotAllocated);
|
||||
}
|
||||
|
||||
TEST(ExecutableNetworkTests, throwsOnUninitializedGetInputsInfo) {
|
||||
ExecutableNetwork exec;
|
||||
ASSERT_THROW(exec.GetInputsInfo(), InferenceEngine::Exception);
|
||||
ASSERT_THROW(exec.GetInputsInfo(), InferenceEngine::NotAllocated);
|
||||
}
|
||||
|
||||
TEST(ExecutableNetworkTests, throwsOnUninitializedExport) {
|
||||
ExecutableNetwork exec;
|
||||
ASSERT_THROW(exec.Export(std::string()), InferenceEngine::Exception);
|
||||
ASSERT_THROW(exec.Export(std::string()), InferenceEngine::NotAllocated);
|
||||
}
|
||||
|
||||
TEST(ExecutableNetworkTests, throwsOnUninitializedExportStream) {
|
||||
ExecutableNetwork exec;
|
||||
ASSERT_THROW(exec.Export(std::cout), InferenceEngine::Exception);
|
||||
ASSERT_THROW(exec.Export(std::cout), InferenceEngine::NotAllocated);
|
||||
}
|
||||
|
||||
TEST(ExecutableNetworkTests, throwsOnUninitializedGetExecGraphInfo) {
|
||||
ExecutableNetwork exec;
|
||||
ASSERT_THROW(exec.GetExecGraphInfo(), InferenceEngine::Exception);
|
||||
ASSERT_THROW(exec.GetExecGraphInfo(), InferenceEngine::NotAllocated);
|
||||
}
|
||||
|
||||
TEST(ExecutableNetworkTests, throwsOnUninitializedQueryState) {
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
ExecutableNetwork exec;
|
||||
ASSERT_THROW(exec.QueryState(), InferenceEngine::Exception);
|
||||
ASSERT_THROW(exec.QueryState(), InferenceEngine::NotAllocated);
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
|
||||
TEST(ExecutableNetworkTests, throwsOnUninitializedSetConfig) {
|
||||
ExecutableNetwork exec;
|
||||
ASSERT_THROW(exec.SetConfig({{}}), InferenceEngine::Exception);
|
||||
ASSERT_THROW(exec.SetConfig({{}}), InferenceEngine::NotAllocated);
|
||||
}
|
||||
|
||||
TEST(ExecutableNetworkTests, throwsOnUninitializedGetConfig) {
|
||||
ExecutableNetwork exec;
|
||||
ASSERT_THROW(exec.GetConfig({}), InferenceEngine::Exception);
|
||||
ASSERT_THROW(exec.GetConfig({}), InferenceEngine::NotAllocated);
|
||||
}
|
||||
|
||||
TEST(ExecutableNetworkTests, throwsOnUninitializedGetMetric) {
|
||||
ExecutableNetwork exec;
|
||||
ASSERT_THROW(exec.GetMetric({}), InferenceEngine::Exception);
|
||||
ASSERT_THROW(exec.GetMetric({}), InferenceEngine::NotAllocated);
|
||||
}
|
||||
|
||||
TEST(ExecutableNetworkTests, throwsOnUninitializedGetContext) {
|
||||
ExecutableNetwork exec;
|
||||
ASSERT_THROW(exec.GetContext(), InferenceEngine::Exception);
|
||||
ASSERT_THROW(exec.GetContext(), InferenceEngine::NotAllocated);
|
||||
}
|
@ -5,32 +5,12 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cpp/ie_infer_request.hpp>
|
||||
#include "unit_test_utils/mocks/mock_ie_ivariable_state.hpp"
|
||||
|
||||
using namespace ::testing;
|
||||
using namespace std;
|
||||
using namespace InferenceEngine;
|
||||
using namespace InferenceEngine::details;
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
|
||||
TEST(VariableStateCPPTests, throwsOnUninitialized) {
|
||||
std::shared_ptr<IVariableState> ptr;
|
||||
ASSERT_THROW(VariableState var(ptr), InferenceEngine::NotAllocated);
|
||||
}
|
||||
|
||||
TEST(VariableStateCPPTests, nothrowOnInitialized) {
|
||||
std::shared_ptr<IVariableState> ptr = std::make_shared<MockIVariableState>();
|
||||
ASSERT_NO_THROW(VariableState var(ptr));
|
||||
}
|
||||
|
||||
TEST(VariableStateCPPTests, throwsOnUninitializedGetLastState) {
|
||||
VariableState req;
|
||||
ASSERT_THROW(req.GetLastState(), InferenceEngine::NotAllocated);
|
||||
}
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
||||
TEST(VariableStateCPPTests, throwsOnUninitializedReset) {
|
||||
VariableState req;
|
||||
ASSERT_THROW(req.Reset(), InferenceEngine::NotAllocated);
|
||||
|
@ -104,11 +104,11 @@ namespace SubgraphTestsDefinitions {
|
||||
for (auto& state : states) {
|
||||
auto name = state.GetName();
|
||||
if (name == "memory_1") {
|
||||
auto blob = FuncTestUtils::createAndFillBlobWithFloatArray(state.GetLastState()->getTensorDesc(),
|
||||
auto blob = FuncTestUtils::createAndFillBlobWithFloatArray(state.GetState()->getTensorDesc(),
|
||||
memory_1_init.data(), memory_1_init.size());
|
||||
state.SetState(blob);
|
||||
} else if (name == "memory_2") {
|
||||
auto blob = FuncTestUtils::createAndFillBlobWithFloatArray(state.GetLastState()->getTensorDesc(),
|
||||
auto blob = FuncTestUtils::createAndFillBlobWithFloatArray(state.GetState()->getTensorDesc(),
|
||||
memory_2_init.data(), memory_2_init.size());
|
||||
state.SetState(blob);
|
||||
} else {
|
||||
|
@ -280,11 +280,11 @@ namespace SubgraphTestsDefinitions {
|
||||
for (auto& state : states) {
|
||||
auto name = state.GetName();
|
||||
if (name.find("cell_state_1") != std::string::npos) {
|
||||
auto blob = FuncTestUtils::createAndFillBlobWithFloatArray(state.GetLastState()->getTensorDesc(),
|
||||
auto blob = FuncTestUtils::createAndFillBlobWithFloatArray(state.GetState()->getTensorDesc(),
|
||||
cell_memory_init.data(), cell_memory_init.size());
|
||||
state.SetState(blob);
|
||||
} else if (name.find("hidden_state_1") != std::string::npos) {
|
||||
auto blob = FuncTestUtils::createAndFillBlobWithFloatArray(state.GetLastState()->getTensorDesc(),
|
||||
auto blob = FuncTestUtils::createAndFillBlobWithFloatArray(state.GetState()->getTensorDesc(),
|
||||
hidden_memory_init.data(), hidden_memory_init.size());
|
||||
state.SetState(blob);
|
||||
} else {
|
||||
|
@ -77,7 +77,7 @@ namespace SubgraphTestsDefinitions {
|
||||
for (auto& state : states) {
|
||||
auto name = state.GetName();
|
||||
if (name == "memory") {
|
||||
auto blob = FuncTestUtils::createAndFillBlobWithFloatArray(state.GetLastState()->getTensorDesc(),
|
||||
auto blob = FuncTestUtils::createAndFillBlobWithFloatArray(state.GetState()->getTensorDesc(),
|
||||
memory_init.data(), memory_init.size());
|
||||
state.SetState(blob);
|
||||
} else {
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
#include "unit_test_utils/mocks/mock_allocator.hpp"
|
||||
#include "unit_test_utils/mocks/mock_icnn_network.hpp"
|
||||
#include "unit_test_utils/mocks/mock_ie_ivariable_state.hpp"
|
||||
#include "unit_test_utils/mocks/mock_iexecutable_network.hpp"
|
||||
#include "unit_test_utils/mocks/mock_iinfer_request.hpp"
|
||||
#include "unit_test_utils/mocks/mock_not_empty_icnn_network.hpp"
|
||||
|
@ -1,25 +0,0 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "ie_imemory_state.hpp"
|
||||
|
||||
using namespace InferenceEngine;
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
|
||||
class MockIVariableState : public InferenceEngine::IVariableState {
|
||||
public:
|
||||
MOCK_QUALIFIED_METHOD3(GetName, const noexcept, StatusCode(char * , size_t, ResponseDesc *));
|
||||
MOCK_QUALIFIED_METHOD1(Reset, noexcept, StatusCode(ResponseDesc *));
|
||||
MOCK_QUALIFIED_METHOD2(SetState, noexcept, StatusCode(Blob::Ptr, ResponseDesc *));
|
||||
MOCK_QUALIFIED_METHOD2(GetState, const noexcept, StatusCode(Blob::CPtr &, ResponseDesc *));
|
||||
};
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_END
|
@ -32,7 +32,6 @@ public:
|
||||
MOCK_QUALIFIED_METHOD3(GetConfig, const noexcept, StatusCode(const std::string &name, Parameter &result, ResponseDesc *resp));
|
||||
MOCK_QUALIFIED_METHOD3(GetMetric, const noexcept, StatusCode(const std::string &name, Parameter &result, ResponseDesc *resp));
|
||||
MOCK_QUALIFIED_METHOD2(GetContext, const noexcept, StatusCode(RemoteContext::Ptr &pContext, ResponseDesc *resp));
|
||||
MOCK_QUALIFIED_METHOD3(QueryState, noexcept, StatusCode(IVariableState::Ptr &, size_t, ResponseDesc *));
|
||||
};
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
@ -35,7 +35,6 @@ public:
|
||||
MOCK_QUALIFIED_METHOD3(SetBlob, noexcept, StatusCode(const char*, const Blob::Ptr&, ResponseDesc*));
|
||||
MOCK_QUALIFIED_METHOD4(SetBlob, noexcept, StatusCode(const char*, const Blob::Ptr&, const PreProcessInfo&, ResponseDesc*));
|
||||
MOCK_QUALIFIED_METHOD2(SetBatch, noexcept, StatusCode(int batch, ResponseDesc*));
|
||||
MOCK_QUALIFIED_METHOD3(QueryState, noexcept, StatusCode(IVariableState::Ptr &, size_t, ResponseDesc *));
|
||||
MOCK_QUALIFIED_METHOD1(Cancel, noexcept, InferenceEngine::StatusCode(ResponseDesc*));
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
#include "unit_test_utils/mocks/mock_iexecutable_network.hpp"
|
||||
#include "unit_test_utils/mocks/mock_iinfer_request.hpp"
|
||||
#include "unit_test_utils/mocks/mock_ie_ivariable_state.hpp"
|
||||
#include "unit_test_utils/mocks/cpp_interfaces/impl/mock_inference_plugin_internal.hpp"
|
||||
#include "unit_test_utils/mocks/cpp_interfaces/interface/mock_iexecutable_network_internal.hpp"
|
||||
#include "unit_test_utils/mocks/cpp_interfaces/interface/mock_ivariable_state_internal.hpp"
|
||||
|
Loading…
Reference in New Issue
Block a user