Simplified throwing macro (#5753)
This commit is contained in:
@@ -134,7 +134,8 @@ std::map<IE::ColorFormat, colorformat_e> colorformat_map = {{IE::ColorFormat::RA
|
||||
CATCH_IE_EXCEPTION(NOT_ALLOCATED, NotAllocated) \
|
||||
CATCH_IE_EXCEPTION(INFER_NOT_STARTED, InferNotStarted) \
|
||||
CATCH_IE_EXCEPTION(NETWORK_NOT_READ, NetworkNotRead) \
|
||||
CATCH_IE_EXCEPTION(INFER_CANCELLED, InferCancelled)
|
||||
CATCH_IE_EXCEPTION(INFER_CANCELLED, InferCancelled) \
|
||||
catch (...) {return IEStatusCode::UNEXPECTED;}
|
||||
|
||||
/**
|
||||
*@brief convert the config type data to map type data.
|
||||
@@ -237,9 +238,7 @@ IEStatusCode ie_core_create(const char *xml_config_file, ie_core_t **core) {
|
||||
std::unique_ptr<ie_core_t> tmp(new ie_core_t);
|
||||
tmp->object = IE::Core(xml_config_file);
|
||||
*core = tmp.release();
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -283,9 +282,7 @@ IEStatusCode ie_core_get_versions(const ie_core_t *core, const char *device_name
|
||||
vers_ptrs[i].description = iter->second.description;
|
||||
}
|
||||
versions->versions = vers_ptrs.release();
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -316,9 +313,7 @@ IEStatusCode ie_core_read_network(ie_core_t *core, const char *xml, const char *
|
||||
}
|
||||
network_result->object = core->object.ReadNetwork(xml, bin);
|
||||
*network = network_result.release();
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -336,9 +331,7 @@ IEStatusCode ie_core_read_network_from_memory(ie_core_t *core, const uint8_t *xm
|
||||
network_result->object = core->object.ReadNetwork(std::string(reinterpret_cast<const char *>(xml_content),
|
||||
reinterpret_cast<const char *>(xml_content + xml_content_size)), weight_blob->object);
|
||||
*network = network_result.release();
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -360,9 +353,7 @@ IEStatusCode ie_core_load_network(ie_core_t *core, const ie_network_t *network,
|
||||
// create plugin in the registery and then create ExecutableNetwork.
|
||||
exe_net->object = core->object.LoadNetwork(network->object, device_name, conf_map);
|
||||
*exe_network = exe_net.release();
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -383,9 +374,7 @@ IEStatusCode ie_core_load_network_from_file(ie_core_t *core, const char *xml, co
|
||||
|
||||
exe_net->object = core->object.LoadNetwork(xml, device_name, conf_map);
|
||||
*exe_network = exe_net.release();
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -406,9 +395,7 @@ IEStatusCode ie_core_set_config(ie_core_t *core, const ie_config_t *ie_core_conf
|
||||
|
||||
try {
|
||||
core->object.SetConfig(conf_map, deviceName);
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -423,9 +410,7 @@ IEStatusCode ie_core_register_plugin(ie_core_t *core, const char *plugin_name, c
|
||||
|
||||
try {
|
||||
core->object.RegisterPlugin(plugin_name, device_name);
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -440,9 +425,7 @@ IEStatusCode ie_core_register_plugins(ie_core_t *core, const char *xml_config_fi
|
||||
|
||||
try {
|
||||
core->object.RegisterPlugins(xml_config_file);
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -457,9 +440,7 @@ IEStatusCode ie_core_unregister_plugin(ie_core_t *core, const char *device_name)
|
||||
|
||||
try {
|
||||
core->object.UnregisterPlugin(device_name);
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -476,9 +457,7 @@ IEStatusCode ie_core_add_extension(ie_core_t *core, const char *extension_path,
|
||||
auto extension_ptr = std::make_shared<InferenceEngine::Extension>(std::string{extension_path});
|
||||
auto extension = std::dynamic_pointer_cast<InferenceEngine::IExtension>(extension_ptr);
|
||||
core->object.AddExtension(extension, device_name);
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -494,9 +473,7 @@ IEStatusCode ie_core_get_metric(const ie_core_t *core, const char *device_name,
|
||||
try {
|
||||
IE::Parameter param = core->object.GetMetric(device_name, metric_name);
|
||||
parameter2IEparam(param, param_result);
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -514,9 +491,7 @@ IEStatusCode ie_core_get_config(const ie_core_t *core, const char *device_name,
|
||||
|
||||
// convert the parameter to ie_param_t
|
||||
parameter2IEparam(param, param_result);
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -538,9 +513,7 @@ IEStatusCode ie_core_get_available_devices(const ie_core_t *core, ie_available_d
|
||||
memcpy(dev_ptrs[i], _devices[i].c_str(), _devices[i].length() + 1);
|
||||
}
|
||||
avai_devices->devices = dev_ptrs.release();
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return IEStatusCode::OK;
|
||||
}
|
||||
@@ -577,9 +550,7 @@ IEStatusCode ie_exec_network_create_infer_request(ie_executable_network_t *ie_ex
|
||||
std::unique_ptr<ie_infer_request_t> req(new ie_infer_request_t);
|
||||
req->object = ie_exec_network->object.CreateInferRequest();
|
||||
*request = req.release();
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -595,9 +566,7 @@ IEStatusCode ie_exec_network_get_metric(const ie_executable_network_t *ie_exec_n
|
||||
try {
|
||||
InferenceEngine::Parameter parameter = ie_exec_network->object.GetMetric(metric_name);
|
||||
parameter2IEparam(parameter, param_result);
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -613,9 +582,7 @@ IEStatusCode ie_exec_network_set_config(ie_executable_network_t *ie_exec_network
|
||||
try {
|
||||
const std::map<std::string, IE::Parameter> conf_map = config2ParamMap(param_config);
|
||||
ie_exec_network->object.SetConfig(conf_map);
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -631,9 +598,7 @@ IEStatusCode ie_exec_network_get_config(const ie_executable_network_t *ie_exec_n
|
||||
try {
|
||||
InferenceEngine::Parameter parameter = ie_exec_network->object.GetConfig(metric_config);
|
||||
parameter2IEparam(parameter, param_result);
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -655,9 +620,7 @@ IEStatusCode ie_network_get_name(const ie_network_t *network, char **name) {
|
||||
std::unique_ptr<char[]> netName(new char[_name.length() + 1]);
|
||||
*name = netName.release();
|
||||
memcpy(*name, _name.c_str(), _name.length() + 1);
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return IEStatusCode::OK;
|
||||
}
|
||||
@@ -672,9 +635,7 @@ IEStatusCode ie_network_get_inputs_number(const ie_network_t *network, size_t *s
|
||||
try {
|
||||
IE::InputsDataMap inputs = network->object.getInputsInfo();
|
||||
*size_result = inputs.size();
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -701,9 +662,7 @@ IEStatusCode ie_network_get_input_name(const ie_network_t *network, size_t numbe
|
||||
*name = inputName.release();
|
||||
memcpy(*name, iter->first.c_str(), iter->first.length() + 1);
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -724,9 +683,7 @@ IEStatusCode ie_network_get_input_precision(const ie_network_t *network, const c
|
||||
IE::Precision p = inputs[input_name]->getPrecision();
|
||||
*prec_result = precision_map[p];
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -753,9 +710,7 @@ IEStatusCode ie_network_set_input_precision(ie_network_t *network, const char *i
|
||||
}
|
||||
inputs[input_name]->setPrecision(precision);
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -776,9 +731,7 @@ IEStatusCode ie_network_get_input_layout(const ie_network_t *network, const char
|
||||
IE::Layout l = inputs[input_name]->getLayout();
|
||||
*layout_result = layout_map[l];
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -805,9 +758,7 @@ IEStatusCode ie_network_set_input_layout(ie_network_t *network, const char *inpu
|
||||
}
|
||||
inputs[input_name]->setLayout(layout);
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -831,9 +782,7 @@ IEStatusCode ie_network_get_input_dims(const ie_network_t *network, const char *
|
||||
dims_result->dims[i] = dims[i];
|
||||
}
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -854,9 +803,7 @@ IEStatusCode ie_network_get_input_resize_algorithm(const ie_network_t *network,
|
||||
IE::ResizeAlgorithm resize = inputs[input_name]->getPreProcess().getResizeAlgorithm();
|
||||
*resize_alg_result = resize_alg_map[resize];
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -883,9 +830,7 @@ IEStatusCode ie_network_set_input_resize_algorithm(ie_network_t *network, const
|
||||
}
|
||||
inputs[input_name]->getPreProcess().setResizeAlgorithm(resize);
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -906,9 +851,7 @@ IEStatusCode ie_network_get_color_format(const ie_network_t *network, const char
|
||||
IE::ColorFormat color = inputs[input_name]->getPreProcess().getColorFormat();
|
||||
*colformat_result = colorformat_map[color];
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -935,9 +878,7 @@ IEStatusCode ie_network_set_color_format(ie_network_t *network, const char *inpu
|
||||
}
|
||||
inputs[input_name]->getPreProcess().setColorFormat(color);
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -973,9 +914,7 @@ IEStatusCode ie_network_get_input_shapes(ie_network *network, input_shapes_t *sh
|
||||
}
|
||||
shapes->shapes = shape_ptrs.release();
|
||||
status = IEStatusCode::OK;
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1000,9 +939,7 @@ IEStatusCode ie_network_reshape(ie_network_t *network, const input_shapes_t shap
|
||||
}
|
||||
|
||||
network->object.reshape(net_shapes);
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1018,9 +955,7 @@ IEStatusCode ie_network_get_outputs_number(const ie_network_t *network, size_t *
|
||||
try {
|
||||
IE::OutputsDataMap outputs = network->object.getOutputsInfo();
|
||||
*size_result = outputs.size();
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1047,9 +982,7 @@ IEStatusCode ie_network_get_output_name(const ie_network_t *network, const size_
|
||||
*name = outputName.release();
|
||||
memcpy(*name, iter->first.c_str(), iter->first.length() + 1);
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1070,9 +1003,7 @@ IEStatusCode ie_network_get_output_precision(const ie_network_t *network, const
|
||||
IE::Precision p = outputs[output_name]->getPrecision();
|
||||
*prec_result = precision_map[p];
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1099,9 +1030,7 @@ IEStatusCode ie_network_set_output_precision(ie_network_t *network, const char *
|
||||
}
|
||||
outputs[output_name]->setPrecision(precision);
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1122,9 +1051,7 @@ IEStatusCode ie_network_get_output_layout(const ie_network_t *network, const cha
|
||||
IE::Layout l = outputs[output_name]->getLayout();
|
||||
*layout_result = layout_map[l];
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1151,9 +1078,7 @@ IEStatusCode ie_network_set_output_layout(ie_network_t *network, const char *out
|
||||
}
|
||||
outputs[output_name]->setLayout(layout);
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1177,9 +1102,7 @@ IEStatusCode ie_network_get_output_dims(const ie_network_t *network, const char
|
||||
dims_result->dims[i] = dims[i];
|
||||
}
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1222,9 +1145,7 @@ IEStatusCode ie_infer_request_get_blob(ie_infer_request_t *infer_request, const
|
||||
std::unique_ptr<ie_blob_t> blob_result(new ie_blob_t);
|
||||
blob_result->object = blob_ptr;
|
||||
*blob = blob_result.release();
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1239,9 +1160,7 @@ IEStatusCode ie_infer_request_set_blob(ie_infer_request_t *infer_request, const
|
||||
|
||||
try {
|
||||
infer_request->object.SetBlob(name, blob->object);
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1256,9 +1175,7 @@ IEStatusCode ie_infer_request_infer(ie_infer_request_t *infer_request) {
|
||||
|
||||
try {
|
||||
infer_request->object.Infer();
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1273,9 +1190,7 @@ IEStatusCode ie_infer_request_infer_async(ie_infer_request_t *infer_request) {
|
||||
|
||||
try {
|
||||
infer_request->object.StartAsync();
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1293,9 +1208,7 @@ IEStatusCode ie_infer_set_completion_callback(ie_infer_request_t *infer_request,
|
||||
callback->completeCallBackFunc(callback->args);
|
||||
};
|
||||
infer_request->object.SetCompletionCallback(fun);
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1311,9 +1224,7 @@ IEStatusCode ie_infer_request_wait(ie_infer_request_t *infer_request, const int6
|
||||
try {
|
||||
IE::StatusCode status_code = infer_request->object.Wait(timeout);
|
||||
status = status_map[status_code];
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1328,9 +1239,7 @@ IEStatusCode ie_infer_request_set_batch(ie_infer_request_t *infer_request, const
|
||||
|
||||
try {
|
||||
infer_request->object.SetBatch(size);
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1392,9 +1301,7 @@ IEStatusCode ie_blob_make_memory(const tensor_desc_t *tensorDesc, ie_blob_t **bl
|
||||
|
||||
_blob->object->allocate();
|
||||
*blob = _blob.release();
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1464,9 +1371,7 @@ IEStatusCode ie_blob_make_memory_from_preallocated(const tensor_desc_t *tensorDe
|
||||
_blob->object = IE::make_shared_blob(tensor, p, size);
|
||||
}
|
||||
*blob = _blob.release();
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1482,9 +1387,7 @@ IEStatusCode ie_blob_make_memory_with_roi(const ie_blob_t *inputBlob, const roi_
|
||||
IE::ROI roi_d = {roi->id, roi->posX, roi->posY, roi->sizeX, roi->sizeY};
|
||||
_blob->object = IE::make_shared_blob(inputBlob->object, roi_d);
|
||||
*blob = _blob.release();
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1498,9 +1401,7 @@ IEStatusCode ie_blob_make_memory_nv12(const ie_blob_t *y, const ie_blob_t *uv, i
|
||||
std::unique_ptr<ie_blob_t> _blob(new ie_blob_t);
|
||||
_blob->object = IE::make_shared_blob<IE::NV12Blob>(y->object, uv->object);
|
||||
*nv12Blob = _blob.release();
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return IEStatusCode::OK;
|
||||
}
|
||||
@@ -1514,9 +1415,7 @@ IEStatusCode ie_blob_make_memory_i420(const ie_blob_t *y, const ie_blob_t *u, co
|
||||
std::unique_ptr<ie_blob_t> _blob(new ie_blob_t);
|
||||
_blob->object = IE::make_shared_blob<IE::I420Blob>(y->object, u->object, v->object);
|
||||
*i420Blob = _blob.release();
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return IEStatusCode::OK;
|
||||
}
|
||||
@@ -1589,9 +1488,7 @@ IEStatusCode ie_blob_get_dims(const ie_blob_t *blob, dimensions_t *dims_result)
|
||||
for (size_t i = 0; i< dims_result->ranks; ++i) {
|
||||
dims_result->dims[i] = size_vector[i];
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1607,9 +1504,7 @@ IEStatusCode ie_blob_get_layout(const ie_blob_t *blob, layout_e *layout_result)
|
||||
try {
|
||||
IE::Layout l = blob->object->getTensorDesc().getLayout();
|
||||
*layout_result = layout_map[l];
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1625,9 +1520,7 @@ IEStatusCode ie_blob_get_precision(const ie_blob_t *blob, precision_e *prec_resu
|
||||
try {
|
||||
IE::Precision p = blob->object->getTensorDesc().getPrecision();
|
||||
*prec_result = precision_map[p];
|
||||
} CATCH_IE_EXCEPTIONS catch (...) {
|
||||
return IEStatusCode::UNEXPECTED;
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -128,22 +128,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
#define CATCH_IE_EXCEPTION(ExceptionType) catch (const InferenceEngine::ExceptionType& e) {throw e;}
|
||||
#define CATCH_IE_EXCEPTIONS \
|
||||
CATCH_IE_EXCEPTION(GeneralError) \
|
||||
CATCH_IE_EXCEPTION(NotImplemented) \
|
||||
CATCH_IE_EXCEPTION(NetworkNotLoaded) \
|
||||
CATCH_IE_EXCEPTION(ParameterMismatch) \
|
||||
CATCH_IE_EXCEPTION(NotFound) \
|
||||
CATCH_IE_EXCEPTION(OutOfBounds) \
|
||||
CATCH_IE_EXCEPTION(Unexpected) \
|
||||
CATCH_IE_EXCEPTION(RequestBusy) \
|
||||
CATCH_IE_EXCEPTION(ResultNotReady) \
|
||||
CATCH_IE_EXCEPTION(NotAllocated) \
|
||||
CATCH_IE_EXCEPTION(InferNotStarted) \
|
||||
CATCH_IE_EXCEPTION(NetworkNotRead) \
|
||||
CATCH_IE_EXCEPTION(InferCancelled)
|
||||
|
||||
/**
|
||||
* @brief Implements load of object from library if Release method is presented
|
||||
*/
|
||||
@@ -170,11 +154,7 @@ protected:
|
||||
using CreateF = void(std::shared_ptr<T>&);
|
||||
reinterpret_cast<CreateF*>(create)(_ptr);
|
||||
}
|
||||
} CATCH_IE_EXCEPTIONS catch (const std::exception& ex) {
|
||||
IE_THROW() << ex.what();
|
||||
} catch(...) {
|
||||
IE_THROW(Unexpected);
|
||||
}
|
||||
} catch(...) {details::Rethrow();}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,14 +164,8 @@ protected:
|
||||
try {
|
||||
using CreateF = void(std::shared_ptr<T>&);
|
||||
reinterpret_cast<CreateF*>(_so.get_symbol(SOCreatorTrait<T>::name))(_ptr);
|
||||
} CATCH_IE_EXCEPTIONS catch (const std::exception& ex) {
|
||||
IE_THROW() << ex.what();
|
||||
} catch(...) {
|
||||
IE_THROW(Unexpected);
|
||||
}
|
||||
} catch(...) {details::Rethrow();}
|
||||
}
|
||||
#undef CATCH_IE_EXCEPTION
|
||||
#undef CATCH_IE_EXCEPTIONS
|
||||
|
||||
/**
|
||||
* @brief The DLL
|
||||
|
||||
@@ -371,6 +371,12 @@ INFERENCE_ENGINE_DECLARE_EXCEPTION(InferCancelled, INFER_CANCELLED)
|
||||
|
||||
// TODO: Move this section out of public API
|
||||
namespace details {
|
||||
|
||||
/**
|
||||
* @brief Rethrow a copy of exception. UShould be used in catch blocks
|
||||
*/
|
||||
[[noreturn]] INFERENCE_ENGINE_API_CPP(void) Rethrow();
|
||||
|
||||
/**
|
||||
* @brief Tag struct used to throw exception
|
||||
*/
|
||||
|
||||
@@ -47,23 +47,6 @@ namespace InferenceEngine {
|
||||
return InferenceEngine::DescriptionBuffer(UNEXPECTED); \
|
||||
}
|
||||
|
||||
#define CATCH_IE_EXCEPTION(ExceptionType) catch (const InferenceEngine::ExceptionType& e) {throw e;}
|
||||
|
||||
#define CATCH_IE_EXCEPTIONS \
|
||||
CATCH_IE_EXCEPTION(GeneralError) \
|
||||
CATCH_IE_EXCEPTION(NotImplemented) \
|
||||
CATCH_IE_EXCEPTION(NetworkNotLoaded) \
|
||||
CATCH_IE_EXCEPTION(ParameterMismatch) \
|
||||
CATCH_IE_EXCEPTION(NotFound) \
|
||||
CATCH_IE_EXCEPTION(OutOfBounds) \
|
||||
CATCH_IE_EXCEPTION(Unexpected) \
|
||||
CATCH_IE_EXCEPTION(RequestBusy) \
|
||||
CATCH_IE_EXCEPTION(ResultNotReady) \
|
||||
CATCH_IE_EXCEPTION(NotAllocated) \
|
||||
CATCH_IE_EXCEPTION(InferNotStarted) \
|
||||
CATCH_IE_EXCEPTION(NetworkNotRead) \
|
||||
CATCH_IE_EXCEPTION(InferCancelled)
|
||||
|
||||
#define CALL_STATUS_FNC(function, ...) \
|
||||
if (!actual) IE_THROW() << "Wrapper used was not initialized."; \
|
||||
ResponseDesc resp; \
|
||||
|
||||
@@ -12,14 +12,10 @@
|
||||
namespace InferenceEngine {
|
||||
|
||||
#define EXEC_NET_CALL_STATEMENT(...) \
|
||||
if (_impl == nullptr) IE_THROW() << "ExecutableNetwork was not initialized."; \
|
||||
if (_impl == nullptr) IE_THROW() << "ExecutableNetwork was not initialized."; \
|
||||
try { \
|
||||
__VA_ARGS__; \
|
||||
} CATCH_IE_EXCEPTIONS catch (const std::exception& ex) { \
|
||||
IE_THROW() << ex.what(); \
|
||||
} catch (...) { \
|
||||
IE_THROW(Unexpected); \
|
||||
}
|
||||
} catch(...) {details::Rethrow();}
|
||||
|
||||
ExecutableNetwork::ExecutableNetwork(const details::SharedObjectLoader& so,
|
||||
const IExecutableNetworkInternal::Ptr& impl)
|
||||
|
||||
@@ -15,32 +15,11 @@
|
||||
|
||||
namespace InferenceEngine {
|
||||
|
||||
#define CATCH_IE_EXCEPTION(ExceptionType) catch (const InferenceEngine::ExceptionType& e) {throw e;}
|
||||
|
||||
#define CATCH_IE_EXCEPTIONS \
|
||||
CATCH_IE_EXCEPTION(GeneralError) \
|
||||
CATCH_IE_EXCEPTION(NotImplemented) \
|
||||
CATCH_IE_EXCEPTION(NetworkNotLoaded) \
|
||||
CATCH_IE_EXCEPTION(ParameterMismatch) \
|
||||
CATCH_IE_EXCEPTION(NotFound) \
|
||||
CATCH_IE_EXCEPTION(OutOfBounds) \
|
||||
CATCH_IE_EXCEPTION(Unexpected) \
|
||||
CATCH_IE_EXCEPTION(RequestBusy) \
|
||||
CATCH_IE_EXCEPTION(ResultNotReady) \
|
||||
CATCH_IE_EXCEPTION(NotAllocated) \
|
||||
CATCH_IE_EXCEPTION(InferNotStarted) \
|
||||
CATCH_IE_EXCEPTION(NetworkNotRead) \
|
||||
CATCH_IE_EXCEPTION(InferCancelled)
|
||||
|
||||
#define INFER_REQ_CALL_STATEMENT(...) \
|
||||
if (_impl == nullptr) IE_THROW() << "Inference Request is not initialized"; \
|
||||
try { \
|
||||
__VA_ARGS__ \
|
||||
} CATCH_IE_EXCEPTIONS catch (const std::exception& ex) { \
|
||||
IE_THROW() << ex.what(); \
|
||||
} catch (...) { \
|
||||
IE_THROW(Unexpected); \
|
||||
}
|
||||
} catch(...) {details::Rethrow();}
|
||||
|
||||
InferRequest::InferRequest(const details::SharedObjectLoader& so,
|
||||
const IInferRequestInternal::Ptr& impl)
|
||||
|
||||
@@ -27,11 +27,7 @@
|
||||
if (!_ptr) IE_THROW() << "Wrapper used in the PLUGIN_CALL_STATEMENT was not initialized."; \
|
||||
try { \
|
||||
__VA_ARGS__; \
|
||||
} CATCH_IE_EXCEPTIONS catch (const std::exception& ex) { \
|
||||
IE_THROW() << ex.what(); \
|
||||
} catch (...) { \
|
||||
IE_THROW(Unexpected); \
|
||||
}
|
||||
} catch(...) {details::Rethrow();}
|
||||
|
||||
namespace InferenceEngine {
|
||||
/**
|
||||
|
||||
@@ -9,14 +9,10 @@
|
||||
#include "exception2status.hpp"
|
||||
|
||||
#define VARIABLE_CALL_STATEMENT(...) \
|
||||
if (_impl == nullptr) IE_THROW() << "VariableState was not initialized."; \
|
||||
if (_impl == nullptr) IE_THROW() << "VariableState was not initialized."; \
|
||||
try { \
|
||||
__VA_ARGS__; \
|
||||
} CATCH_IE_EXCEPTIONS catch (const std::exception& ex) { \
|
||||
IE_THROW() << ex.what(); \
|
||||
} catch (...) { \
|
||||
IE_THROW(Unexpected); \
|
||||
}
|
||||
} catch(...) {details::Rethrow();}
|
||||
|
||||
namespace InferenceEngine {
|
||||
|
||||
|
||||
@@ -53,6 +53,27 @@ std::map<std::string, ngraph::OpSet> Extension::getOpSets() {
|
||||
return actual->getOpSets();
|
||||
}
|
||||
namespace details {
|
||||
|
||||
void Rethrow() {
|
||||
try {
|
||||
throw;
|
||||
} catch (const GeneralError& e) {throw e;}
|
||||
catch (const NotImplemented& e) {throw e;}
|
||||
catch (const NetworkNotLoaded& e) {throw e;}
|
||||
catch (const ParameterMismatch& e) {throw e;}
|
||||
catch (const NotFound& e) {throw e;}
|
||||
catch (const OutOfBounds& e) {throw e;}
|
||||
catch (const Unexpected& e) {throw e;}
|
||||
catch (const RequestBusy& e) {throw e;}
|
||||
catch (const ResultNotReady& e) {throw e;}
|
||||
catch (const NotAllocated& e) {throw e;}
|
||||
catch (const InferNotStarted& e) {throw e;}
|
||||
catch (const NetworkNotRead& e) {throw e;}
|
||||
catch (const InferCancelled& e) {throw e;}
|
||||
catch (const std::exception& e) {IE_THROW() << e.what();}
|
||||
catch(...) {IE_THROW(Unexpected);}
|
||||
}
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
|
||||
StatusCode InferenceEngineException::getStatus() const {
|
||||
|
||||
Reference in New Issue
Block a user