24 class ICompletionCallbackWrapper {
26 virtual ~ICompletionCallbackWrapper() =
default;
32 class CompletionCallbackWrapper :
public ICompletionCallbackWrapper {
36 explicit CompletionCallbackWrapper(
const T& lambda): lambda(lambda) {}
45 class CompletionCallbackWrapper<IInferRequest::CompletionCallback> :
public ICompletionCallbackWrapper {
52 callBack(request, code);
67 std::shared_ptr<details::ICompletionCallbackWrapper> callback;
70 details::ICompletionCallbackWrapper* pWrapper =
nullptr;
72 request->GetUserData(reinterpret_cast<void**>(&pWrapper), &dsc);
73 pWrapper->call(request, code);
98 CALL_STATUS_FNC(SetBlob, name.c_str(), data);
108 CALL_STATUS_FNC(GetBlob, name.c_str(), data);
109 std::string error =
"Internal error: blob with name `" + name +
"` is not allocated!";
110 auto blobPtr = data.get();
124 CALL_STATUS_FNC(SetBlob, name.c_str(), data, info);
134 CALL_STATUS_FNC(GetPreProcess, name.c_str(), &info);
144 CALL_STATUS_FNC_NO_ARGS(Infer);
153 std::map<std::string, InferenceEngineProfileInfo> perfMap;
154 CALL_STATUS_FNC(GetPerformanceCounts, perfMap);
166 for (
auto&& input : inputs) {
167 CALL_STATUS_FNC(SetBlob, input.first.c_str(), input.second);
179 for (
auto&& result : results) {
180 CALL_STATUS_FNC(SetBlob, result.first.c_str(), result.second);
190 CALL_STATUS_FNC(SetBatch, batch);
206 CALL_STATUS_FNC_NO_ARGS(StartAsync);
216 auto res = actual->Wait(millis_timeout, &resp);
217 if (res != OK && res != RESULT_NOT_READY && res != INFER_NOT_STARTED) {
218 InferenceEngine::details::extract_exception(res, resp.
msg);
232 callback.reset(
new details::CompletionCallbackWrapper<T>(callbackToSet));
233 CALL_STATUS_FNC(SetUserData, callback.get());
234 actual->SetCompletionCallback(callWrapper);
258 explicit operator bool() const noexcept {
265 using Ptr = std::shared_ptr<InferRequest>;
271 class CompletionCallbackWrapper<std::function<void(InferRequest, StatusCode)>> :
public ICompletionCallbackWrapper {
272 std::function<void(InferRequest, StatusCode)> lambda;
InferRequest(IInferRequest::Ptr request, InferenceEnginePluginPtr plg={})
Definition: ie_infer_request.hpp:198
#define THROW_IE_EXCEPTION
A macro used to throw the exception with a notable description.
Definition: ie_exception.hpp:25
void StartAsync()
Start inference of specified input(s) in asynchronous mode.
Definition: ie_infer_request.hpp:205
bool operator!() const noexcept
Checks if current InferRequest object is not initialized.
Definition: ie_infer_request.hpp:249
InferenceEngine::details::SOPointer< IInferencePlugin > InferenceEnginePluginPtr
A C++ helper to work with objects created by the plugin.
Definition: ie_plugin_ptr.hpp:43
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:463
Inference Engine API.
Definition: ie_argmax_layer.hpp:15
Blob::Ptr GetBlob(const std::string &name)
Definition: ie_infer_request.hpp:106
StatusCode Wait(int64_t millis_timeout)
Definition: ie_infer_request.hpp:214
A header file that provides macros to handle no exception methods.
void SetInput(const BlobMap &inputs)
Sets input data to infer.
Definition: ie_infer_request.hpp:165
A header file contains a wrapper class for handling plugin instantiation and releasing resources...
void SetOutput(const BlobMap &results)
Sets data that will contain result of the inference.
Definition: ie_infer_request.hpp:178
This class stores pre-process information for the input.
Definition: ie_preprocess.hpp:55
void SetBlob(const std::string &name, const Blob::Ptr &data)
Sets input/output data to infer.
Definition: ie_infer_request.hpp:97
a header file for IInferRequest interface
Definition: ie_infer_request.hpp:64
void SetCompletionCallback(const T &callbackToSet)
Definition: ie_infer_request.hpp:231
std::shared_ptr< InferRequest > Ptr
A smart pointer to the InferRequest object.
Definition: ie_infer_request.hpp:265
Represents detailed information for an error.
Definition: ie_common.h:239
StatusCode
This enum contains codes for all possible return values of the interface functions.
Definition: ie_common.h:216
char msg[4096]
A character buffer that holds the detailed information for an error.
Definition: ie_common.h:243
std::shared_ptr< Blob > Ptr
A smart pointer containing Blob object.
Definition: ie_blob.h:42
const PreProcessInfo & GetPreProcess(const std::string &name) const
Gets pre-process for input data.
Definition: ie_infer_request.hpp:132
void(* CompletionCallback)(InferenceEngine::IInferRequest::Ptr context, InferenceEngine::StatusCode code)
Completion callback definition as pointer to a function.
Definition: ie_iinfer_request.hpp:141
std::map< std::string, InferenceEngineProfileInfo > GetPerformanceCounts() const
Definition: ie_infer_request.hpp:152
void Infer()
Definition: ie_infer_request.hpp:143
void SetBlob(const std::string &name, const Blob::Ptr &data, const PreProcessInfo &info)
Sets pre-process for input data.
Definition: ie_infer_request.hpp:123
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:189
~InferRequest()
Destructor.
Definition: ie_infer_request.hpp:85
std::shared_ptr< IInferRequest > Ptr
A shared pointer to the IInferRequest object.
Definition: ie_iinfer_request.hpp:44