26 class ICompletionCallbackWrapper {
28 virtual ~ICompletionCallbackWrapper() =
default;
34 class CompletionCallbackWrapper :
public ICompletionCallbackWrapper {
38 explicit CompletionCallbackWrapper(
const T& lambda): lambda(lambda) {}
47 class CompletionCallbackWrapper<IInferRequest::CompletionCallback> :
public ICompletionCallbackWrapper {
54 callBack(request, code);
68 InferenceEngine::details::SharedObjectLoader::Ptr plg;
69 std::shared_ptr<details::ICompletionCallbackWrapper> callback;
72 details::ICompletionCallbackWrapper* pWrapper =
nullptr;
74 request->GetUserData(
reinterpret_cast<void**
>(&pWrapper), &dsc);
75 pWrapper->call(request, code);
90 InferenceEngine::details::SharedObjectLoader::Ptr splg = {}):
91 actual(request), plg(splg) {
112 CALL_STATUS_FNC(
SetBlob, name.c_str(), data);
124 CALL_STATUS_FNC(
GetBlob, name.c_str(), data);
125 std::string error =
"Internal error: blob with name `" + name +
"` is not allocated!";
126 auto blobPtr = data.get();
127 const bool remoteBlobPassed = blobPtr->is<
RemoteBlob>();
141 CALL_STATUS_FNC(
SetBlob, name.c_str(), data, info);
162 CALL_STATUS_FNC_NO_ARGS(
Infer);
171 CALL_STATUS_FNC_NO_ARGS(
Cancel);
181 std::map<std::string, InferenceEngineProfileInfo> perfMap;
194 for (
auto&& input : inputs) {
195 CALL_STATUS_FNC(
SetBlob, input.first.c_str(), input.second);
207 for (
auto&&
result : results) {
244 auto res = actual->Wait(millis_timeout, &resp);
245 if (res != OK && res != RESULT_NOT_READY &&
246 res != INFER_NOT_STARTED && res != INFER_CANCELLED) {
261 callback.reset(
new details::CompletionCallbackWrapper<T>(callbackToSet));
262 CALL_STATUS_FNC(SetUserData, callback.get());
263 actual->SetCompletionCallback(callWrapper);
273 IE_SUPPRESS_DEPRECATED_START
274 if (actual ==
nullptr)
THROW_IE_EXCEPTION <<
"ExecutableNetwork was not initialized.";
277 std::vector<VariableState> controller;
278 for (
size_t idx = 0; res == OK; ++idx) {
280 res = actual->QueryState(pState, idx, &resp);
281 if (res != OK && res != OUT_OF_BOUNDS) {
284 if (res != OUT_OF_BOUNDS) {
288 IE_SUPPRESS_DEPRECATED_END
314 explicit operator bool() const noexcept {
321 using Ptr = std::shared_ptr<InferRequest>;
327 class CompletionCallbackWrapper<
std::function<void(InferRequest, StatusCode)>> :
public ICompletionCallbackWrapper {
std::shared_ptr< Blob > Ptr
A smart pointer containing Blob object.
Definition: ie_blob.h:43
void(* CompletionCallback)(InferenceEngine::IInferRequest::Ptr context, InferenceEngine::StatusCode code)
Completion callback definition as pointer to a function.
Definition: ie_iinfer_request.hpp:148
std::shared_ptr< IInferRequest > Ptr
A shared pointer to the IInferRequest object.
Definition: ie_iinfer_request.hpp:44
std::shared_ptr< IVariableState > Ptr
A shared pointer to the IVariableState interface.
Definition: ie_imemory_state.hpp:32
This is an interface of asynchronous infer request.
Definition: ie_infer_request.hpp:66
InferRequest(IInferRequest::Ptr request, InferenceEngine::details::SharedObjectLoader::Ptr splg={})
Definition: ie_infer_request.hpp:89
std::vector< VariableState > QueryState()
Gets state control interface for given executable network.
Definition: ie_infer_request.hpp:272
std::map< std::string, InferenceEngineProfileInfo > GetPerformanceCounts() const
Queries performance measures per layer to get feedback of what is the most time consuming layer.
Definition: ie_infer_request.hpp:180
void SetInput(const BlobMap &inputs)
Sets input data to infer.
Definition: ie_infer_request.hpp:193
void SetBlob(const std::string &name, const Blob::Ptr &data, const PreProcessInfo &info)
Sets blob with a pre-process information.
Definition: ie_infer_request.hpp:140
void SetBlob(const std::string &name, const Blob::Ptr &data)
Sets input/output data to infer.
Definition: ie_infer_request.hpp:111
void SetBatch(const int batch)
Sets new batch size when dynamic batching is enabled in executable network that created this request.
Definition: ie_infer_request.hpp:217
void Infer()
Infers specified input(s) in synchronous mode.
Definition: ie_infer_request.hpp:161
const PreProcessInfo & GetPreProcess(const std::string &name) const
Gets pre-process for input data.
Definition: ie_infer_request.hpp:149
void StartAsync()
Start inference of specified input(s) in asynchronous mode.
Definition: ie_infer_request.hpp:226
InferRequest()=default
Default constructor.
void SetCompletionCallback(const T &callbackToSet)
Sets a callback function that will be called on success or failure of asynchronous request.
Definition: ie_infer_request.hpp:260
bool operator!() const noexcept
Checks if current InferRequest object is not initialized.
Definition: ie_infer_request.hpp:306
void SetOutput(const BlobMap &results)
Sets data that will contain result of the inference.
Definition: ie_infer_request.hpp:206
Blob::Ptr GetBlob(const std::string &name)
Gets input/output data for inference.
Definition: ie_infer_request.hpp:122
std::shared_ptr< InferRequest > Ptr
A smart pointer to the InferRequest object.
Definition: ie_infer_request.hpp:321
StatusCode Wait(int64_t millis_timeout)
Waits for the result to become available. Blocks until specified millis_timeout has elapsed or the re...
Definition: ie_infer_request.hpp:241
void Cancel()
Cancels current async inference request.
Definition: ie_infer_request.hpp:170
~InferRequest()
Destructor.
Definition: ie_infer_request.hpp:99
This class stores pre-process information for the input.
Definition: ie_preprocess.hpp:55
This class represents an Inference Engine abstraction to the memory allocated on the remote (non-CPU)...
Definition: ie_remote_context.hpp:31
C++ exception based error reporting wrapper of API class IVariableState.
Definition: ie_memory_state.hpp:28
#define THROW_IE_EXCEPTION
A macro used to throw general exception with a description.
Definition: ie_exception.hpp:25
A header file that provides macros to handle no exception methods.
a header file for IInferRequest interface
A header file that provides wrapper classes for IVariableState.
This is a header file for the IE RemoteContext and RemoteBlob classes.
A header file for definition of abstraction over platform specific shared objects.
Inference Engine C++ API.
Definition: cldnn_config.hpp:15
StatusCode
This enum contains codes for all possible return values of the interface functions.
Definition: ie_common.h:224
std::map< std::string, Blob::Ptr > BlobMap
This is a convenient type for working with a map containing pairs(string, pointer to a Blob instance)...
Definition: ie_blob.h:486
Node result(NodeInput data, Optional[str] name=None)
Represents detailed information for an error.
Definition: ie_common.h:248
char msg[4096]
A character buffer that holds the detailed information for an error.
Definition: ie_common.h:252