diff --git a/samples/cpp/benchmark_app/main.cpp b/samples/cpp/benchmark_app/main.cpp index ce11c9311d3..ba78cb13738 100644 --- a/samples/cpp/benchmark_app/main.cpp +++ b/samples/cpp/benchmark_app/main.cpp @@ -863,10 +863,9 @@ int main(int argc, char* argv[]) { try { nireq = compiledModel.get_property(ov::optimal_number_of_infer_requests); } catch (const std::exception& ex) { - throw ov::Exception("Every device used with the benchmark_app should support " + - std::string(ov::optimal_number_of_infer_requests.name()) + - " Failed to query the metric for the " + device_name + - " with error: " + ex.what()); + OPENVINO_THROW("Every device used with the benchmark_app should support " + + std::string(ov::optimal_number_of_infer_requests.name()) + + " Failed to query the metric for the " + device_name + " with error: " + ex.what()); } } } @@ -964,7 +963,7 @@ int main(int argc, char* argv[]) { nireq); } } else { - throw ov::Exception("Requested device doesn't support `use_device_mem` option."); + OPENVINO_THROW("Requested device doesn't support `use_device_mem` option."); } } else { if (newInputType) { @@ -1056,7 +1055,7 @@ int main(int argc, char* argv[]) { // warming up - out of scope auto inferRequest = inferRequestsQueue.get_idle_request(); if (!inferRequest) { - throw ov::Exception("No idle Infer Requests!"); + OPENVINO_THROW("No idle Infer Requests!"); } if (!inferenceOnly) { @@ -1107,7 +1106,7 @@ int main(int argc, char* argv[]) { (FLAGS_api == "async" && iteration % nireq != 0)) { inferRequest = inferRequestsQueue.get_idle_request(); if (!inferRequest) { - throw ov::Exception("No idle Infer Requests!"); + OPENVINO_THROW("No idle Infer Requests!"); } if (!inferenceOnly) { diff --git a/samples/cpp/common/utils/include/samples/common.hpp b/samples/cpp/common/utils/include/samples/common.hpp index bee4be89063..f637d952118 100644 --- a/samples/cpp/common/utils/include/samples/common.hpp +++ b/samples/cpp/common/utils/include/samples/common.hpp @@ -494,7 +494,7 @@ static inline void fill_tensor_random(ov::Tensor tensor) { fill_random(tensor, 0, 1); break; default: - throw ov::Exception("Input type is not supported for a tensor"); + OPENVINO_THROW("Input type is not supported for a tensor"); } } diff --git a/src/bindings/python/src/compatibility/pyngraph/node_factory.cpp b/src/bindings/python/src/compatibility/pyngraph/node_factory.cpp index 2108a7a057b..f061e43f738 100644 --- a/src/bindings/python/src/compatibility/pyngraph/node_factory.cpp +++ b/src/bindings/python/src/compatibility/pyngraph/node_factory.cpp @@ -77,7 +77,7 @@ private: auto it = s_opsets.find(opset_ver); if (it == s_opsets.end()) { - throw ngraph::ngraph_error("Unsupported opset version requested."); + OPENVINO_THROW("Unsupported opset version requested."); } return it->second(); } diff --git a/src/bindings/python/src/pyopenvino/core/common.cpp b/src/bindings/python/src/pyopenvino/core/common.cpp index d899cb5f121..83681690fc0 100644 --- a/src/bindings/python/src/pyopenvino/core/common.cpp +++ b/src/bindings/python/src/pyopenvino/core/common.cpp @@ -67,7 +67,7 @@ const TensorIndexMap cast_to_tensor_index_map(const py::dict& inputs) { auto tensor = Common::cast_to_tensor(input.second); result_map[idx] = tensor; } else { - throw ov::Exception("Unable to cast tensor " + std::to_string(idx) + "!"); + OPENVINO_THROW("Unable to cast tensor " + std::to_string(idx) + "!"); } } return result_map; @@ -186,7 +186,7 @@ py::array array_from_tensor(ov::Tensor&& t) { break; } default: { - throw ov::Exception("Numpy array cannot be created from given OV Tensor!"); + OPENVINO_THROW("Numpy array cannot be created from given OV Tensor!"); break; } } diff --git a/src/common/conditional_compilation/include/openvino/cc/pass/itt.hpp b/src/common/conditional_compilation/include/openvino/cc/pass/itt.hpp index 32de9caa492..3b522cb78f1 100644 --- a/src/common/conditional_compilation/include/openvino/cc/pass/itt.hpp +++ b/src/common/conditional_compilation/include/openvino/cc/pass/itt.hpp @@ -33,7 +33,7 @@ OV_CC_DOMAINS(ov_pass); # define MATCHER_SCOPE_(scope, region) \ if (OV_CC_SCOPE_IS_ENABLED(OV_PP_CAT3(scope, _, region)) == 0) \ - throw ngraph::ngraph_error(std::string(OV_PP_TOSTRING(OV_PP_CAT3(scope, _, region))) + " is disabled!") + OPENVINO_THROW(std::string(OV_PP_TOSTRING(OV_PP_CAT3(scope, _, region))) + " is disabled!") # define MATCHER_SCOPE(region) \ const std::string matcher_name(OV_PP_TOSTRING(region)); \ diff --git a/src/common/offline_transformations/src/pruning/propagate_masks.cpp b/src/common/offline_transformations/src/pruning/propagate_masks.cpp index 6f289cbff6c..29882572142 100644 --- a/src/common/offline_transformations/src/pruning/propagate_masks.cpp +++ b/src/common/offline_transformations/src/pruning/propagate_masks.cpp @@ -715,7 +715,7 @@ public: for (auto node : fq_params_nodes) { auto const_node = std::dynamic_pointer_cast(node); if (!const_node) - throw ngraph_error("Unexpected operation type."); + OPENVINO_THROW("Unexpected operation type."); auto new_shape = broadcast_shape_to_rank(const_node->get_shape(), m_input.get_partial_shape().rank().get_length()); auto new_const = std::make_shared(*const_node, new_shape); diff --git a/src/common/offline_transformations/src/pruning/shrink_weights.cpp b/src/common/offline_transformations/src/pruning/shrink_weights.cpp index f0520814cbd..5e203e9d34a 100644 --- a/src/common/offline_transformations/src/pruning/shrink_weights.cpp +++ b/src/common/offline_transformations/src/pruning/shrink_weights.cpp @@ -273,8 +273,8 @@ bool ngraph::pass::ShrinkWeights::run_on_model(const std::shared_ptrget_shape_val(); if (res.size() != mask->size()) { - throw ngraph_error("Mask size (" + std::to_string(mask->size()) + ") is not equal to (" + - std::to_string(res.size()) + ")"); + OPENVINO_THROW("Mask size (" + std::to_string(mask->size()) + ") is not equal to (" + + std::to_string(res.size()) + ")"); } for (size_t dim = 0; dim < mask->size(); ++dim) { res[dim] -= mask->at(dim).size(); diff --git a/src/common/snippets/include/snippets/emitter.hpp b/src/common/snippets/include/snippets/emitter.hpp index ad81f93b20c..4298d54890c 100644 --- a/src/common/snippets/include/snippets/emitter.hpp +++ b/src/common/snippets/include/snippets/emitter.hpp @@ -6,6 +6,7 @@ #include #include +#include "ngraph/node.hpp" namespace ngraph { namespace snippets { diff --git a/src/common/snippets/include/snippets/generator.hpp b/src/common/snippets/include/snippets/generator.hpp index 48715235c11..25f605ba7ed 100644 --- a/src/common/snippets/include/snippets/generator.hpp +++ b/src/common/snippets/include/snippets/generator.hpp @@ -50,7 +50,7 @@ public: std::function(std::shared_ptr)> get(const ngraph::DiscreteTypeInfo type) const { auto jitter = jitters.find(type); if (jitter == jitters.end()) { - throw ngraph_error(std::string("Target code emitter is not available for ") + type.name + " operation."); + OPENVINO_THROW(std::string("Target code emitter is not available for ") + type.name + " operation."); } return jitter->second.first; } @@ -59,7 +59,7 @@ public: get_supported_precisions(const ngraph::DiscreteTypeInfo type) const { auto jitter = jitters.find(type); if (jitter == jitters.end()) { - throw ngraph_error(std::string("Target code emitter is not available for ") + type.name + " operation."); + OPENVINO_THROW(std::string("Target code emitter is not available for ") + type.name + " operation."); } return jitter->second.second; } diff --git a/src/common/snippets/src/generator.cpp b/src/common/snippets/src/generator.cpp index dba0f139fda..d59c6772fff 100644 --- a/src/common/snippets/src/generator.cpp +++ b/src/common/snippets/src/generator.cpp @@ -99,7 +99,7 @@ ngraph::snippets::code ngraph::snippets::Generator::generate(std::shared_ptris_supported()) - throw ngraph_error("unsupported architecture for code generation"); + OPENVINO_THROW("unsupported architecture for code generation"); OV_ITT_TASK_CHAIN(GENERATE, ngraph::pass::itt::domains::SnippetsTransform, "Snippets::Generator", "::VectorTile") // vector loop @@ -259,7 +259,7 @@ Generator::opRegType Generator::get_op_reg_type(const std::shared_ptr& op) } Generator::opRegType Generator::get_specific_op_reg_type(const std::shared_ptr& op) const { - throw ov::Exception("Register type of the operation " + std::string(op->get_type_name()) + " isn't determined!"); + OPENVINO_THROW("Register type of the operation " + std::string(op->get_type_name()) + " isn't determined!"); } diff --git a/src/common/snippets/src/op/brgemm.cpp b/src/common/snippets/src/op/brgemm.cpp index 743653099b8..d37d17aa604 100644 --- a/src/common/snippets/src/op/brgemm.cpp +++ b/src/common/snippets/src/op/brgemm.cpp @@ -56,7 +56,7 @@ ov::element::Type Brgemm::get_output_type() const { } else if (is_int8) { return element::i32; } else { - throw ngraph_error("BrgemmCPU node has incompatible input element types: " + + OPENVINO_THROW("BrgemmCPU node has incompatible input element types: " + element_type_a.get_type_name() + " and " + element_type_b.get_type_name()); diff --git a/src/common/snippets/src/op/buffer.cpp b/src/common/snippets/src/op/buffer.cpp index 8a3963119b8..6684c669741 100644 --- a/src/common/snippets/src/op/buffer.cpp +++ b/src/common/snippets/src/op/buffer.cpp @@ -57,7 +57,7 @@ void snippets::op::Buffer::validate_and_infer_types() { output_type = get_input_element_type(0); output_shape = input_shape.get_shape(); } else { - throw ov::Exception("Buffer supports only the following types: NewMemory and IntermediateMemory"); + OPENVINO_THROW("Buffer supports only the following types: NewMemory and IntermediateMemory"); } set_output_type(0, output_type, output_shape); } @@ -70,7 +70,7 @@ std::shared_ptr snippets::op::Buffer::clone_with_new_inputs(const OutputVe } else if (m_type == Type::IntermediateMemory) { return std::make_shared(new_args.at(0), m_shape); } - throw ov::Exception("Buffer supports only the following types: NewMemory and IntermediateMemory"); + OPENVINO_THROW("Buffer supports only the following types: NewMemory and IntermediateMemory"); } size_t ngraph::snippets::op::Buffer::get_byte_size() const { diff --git a/src/common/snippets/src/op/subgraph.cpp b/src/common/snippets/src/op/subgraph.cpp index f8953745520..4ec49ab9388 100644 --- a/src/common/snippets/src/op/subgraph.cpp +++ b/src/common/snippets/src/op/subgraph.cpp @@ -184,7 +184,7 @@ auto snippets::op::Subgraph::wrap_node_as_subgraph(const std::shared_ptrget_output_size() != body_node->get_output_size()) { - throw ngraph::ngraph_error("original node outputs size and extracted subgraph node outputs size doesn't much"); + OPENVINO_THROW("original node outputs size and extracted subgraph node outputs size doesn't much"); } ngraph::ResultVector body_results; @@ -212,7 +212,7 @@ auto snippets::op::Subgraph::wrap_node_as_subgraph(const std::shared_ptrget_output_size() != body->get_results().size()) { - throw ngraph::ngraph_error("newly create subgraph doesn't much number of original node results"); + OPENVINO_THROW("newly create subgraph doesn't much number of original node results"); } return subgraph; @@ -446,7 +446,7 @@ void snippets::op::Subgraph::initialize_buffer_scratchpad_size() { if (auto memory_access = ov::as_type_ptr(parent)) { memory_access->set_output_offset(offset, idx); } else { - throw ngraph_error( + OPENVINO_THROW( "Buffer::set_offset() was called when Buffer didn't have the corresponding MemoryAccess op for offset propagation"); } } @@ -468,7 +468,7 @@ void snippets::op::Subgraph::initialize_buffer_scratchpad_size() { } else if (auto memory_access = ov::as_type_ptr(child)) { memory_access->set_input_offset(offset, target_input.get_index()); } else { - throw ngraph_error("Buffer::set_offset() was called when Buffer didn't have the corresponding MemoryAccess op for offset propagation"); + OPENVINO_THROW("Buffer::set_offset() was called when Buffer didn't have the corresponding MemoryAccess op for offset propagation"); } }; diff --git a/src/common/snippets/src/pass/assign_registers.cpp b/src/common/snippets/src/pass/assign_registers.cpp index c9af20443b8..d9aa93a378c 100644 --- a/src/common/snippets/src/pass/assign_registers.cpp +++ b/src/common/snippets/src/pass/assign_registers.cpp @@ -118,7 +118,7 @@ bool ngraph::snippets::pass::AssignRegisters::run_on_model(const std::shared_ptr std::set result; for (const auto& t : tensors) { if (reg_map.count(t) == 0) - throw ngraph::ngraph_error("Assign registers: attempt to access not enumerated tensor"); + OPENVINO_THROW("Assign registers: attempt to access not enumerated tensor"); Reg reg_id = reg_map.at(t); if (reg_id != IS_MANUALLY_ALLOCATED_REG) result.insert(reg_id); @@ -179,7 +179,7 @@ bool ngraph::snippets::pass::AssignRegisters::run_on_model(const std::shared_ptr for (const auto& port : out.get_target_inputs()) { size_t k = std::find(ops.begin(), ops.end(), port.get_node()->shared_from_this()) - ops.begin(); if (k == ops.size()) - throw ngraph_error("assign registers can't find target op in the body"); + OPENVINO_THROW("assign registers can't find target op in the body"); switch (typed_ops[k].first) { case opRegType::vec2vec: case opRegType::vec2gpr: @@ -258,7 +258,7 @@ bool ngraph::snippets::pass::AssignRegisters::run_on_model(const std::shared_ptr if (active.size() == reg_pool.size()) { // todo: if it is LoopBegin or LoopEnd that requires gpr, and we don't have any in the pool, // then assign SIZE_MAX-1 as a flag to spill a reg inside emitter - throw ngraph::ngraph_error("can't allocate registers for a snippet "); + OPENVINO_THROW("can't allocate registers for a snippet "); } else { register_map[unique_reg] = bank.top(); bank.pop(); @@ -287,7 +287,7 @@ bool ngraph::snippets::pass::AssignRegisters::run_on_model(const std::shared_ptr if (reg.second == IS_MANUALLY_ALLOCATED_REG) continue; if (unique2reused.count(reg.second) == 0) - throw ngraph::ngraph_error("Assign registers failed to allocate register for a tensor"); + OPENVINO_THROW("Assign registers failed to allocate register for a tensor"); assigned_regs[reg.first] = unique2reused.at(reg.second); } }; diff --git a/src/common/snippets/src/pass/collapse_subgraph.cpp b/src/common/snippets/src/pass/collapse_subgraph.cpp index 48b7d304428..3cfb3ef7952 100644 --- a/src/common/snippets/src/pass/collapse_subgraph.cpp +++ b/src/common/snippets/src/pass/collapse_subgraph.cpp @@ -506,7 +506,7 @@ TokenizeSnippets::TokenizeSnippets() { << " body node outputs = " << body_node->get_output_size() << std::endl; if (node->get_output_size() != body_node->get_output_size()) { - throw ngraph_error("original node outputs size and extracted node outputs size doesn't much"); + OPENVINO_THROW("original node outputs size and extracted node outputs size doesn't much"); } // After some transformations, a different number of Constants for some operations may be created @@ -552,7 +552,7 @@ TokenizeSnippets::TokenizeSnippets() { } if (!!subgraph_result_inputs.back().count(target_input)) { - throw ngraph_error("target input added twice!!!"); + OPENVINO_THROW("target input added twice!!!"); } // save target input port outside the body subgraph_result_inputs.back().insert(target_input); @@ -567,7 +567,7 @@ TokenizeSnippets::TokenizeSnippets() { } if (body_results.size() != subgraph_result_inputs.size()) { - throw ngraph_error("body results and node results size mismatch during subgraph collaps"); + OPENVINO_THROW("body results and node results size mismatch during subgraph collaps"); } // todo: move this plugin-specific constraint to the plugin callback @@ -593,7 +593,7 @@ TokenizeSnippets::TokenizeSnippets() { } if (subgraph->get_output_size() != subgraph_result_inputs.size()) { - throw ngraph_error("newly create subgraph doesn't much number of results"); + OPENVINO_THROW("newly create subgraph doesn't much number of results"); } if (outputs_are_not_broadcastable(subgraph)) diff --git a/src/common/snippets/src/pass/insert_buffer.cpp b/src/common/snippets/src/pass/insert_buffer.cpp index e7f4c90ae02..72a8b46f712 100644 --- a/src/common/snippets/src/pass/insert_buffer.cpp +++ b/src/common/snippets/src/pass/insert_buffer.cpp @@ -37,7 +37,7 @@ ngraph::snippets::pass::InsertBuffer::InsertBuffer(const int32_t allocation_rank } if (ov::is_type(input.get_source_output().get_node_shared_ptr()) && input.get_source_output().get_target_inputs().size() != 1) { - throw ngraph::ngraph_error( + OPENVINO_THROW( "If Buffer is a input for operation output, this Buffer should be a single consumer for this port"); } } @@ -62,7 +62,7 @@ ngraph::snippets::pass::InsertBuffer::InsertBuffer(const int32_t allocation_rank * / \ * Buffer Result */ - throw ngraph::ngraph_error( + OPENVINO_THROW( "Operation which is should be wrapped by Buffers has few children from one output port where one of them is Result"); } } @@ -88,7 +88,7 @@ ngraph::snippets::pass::InsertBuffer::InsertBuffer(const int32_t allocation_rank return ov::is_type(child) && child->output(0).get_target_inputs().size() > 0; }); if (has_buffer_on_output && new_target_inputs.size() != 1) { - throw ngraph::ngraph_error( + OPENVINO_THROW( "If Buffer is a input for operation output, this Buffer should be a single consumer for this port"); } } diff --git a/src/common/snippets/src/pass/insert_loops.cpp b/src/common/snippets/src/pass/insert_loops.cpp index e88ba92770d..56ef7c80647 100644 --- a/src/common/snippets/src/pass/insert_loops.cpp +++ b/src/common/snippets/src/pass/insert_loops.cpp @@ -17,7 +17,7 @@ namespace pass { InsertLoops::InsertLoops(ov::PartialShape master_shape, size_t loop_depth, size_t vector_size, bool single_loop_body) : m_master_shape(std::move(master_shape)), m_loop_depth(loop_depth), m_vector_size(vector_size), m_single_loop_body(single_loop_body) { if (m_master_shape.size() < m_loop_depth) - throw ngraph_error("InsertLoops can't insert loops: master shape rank is too small"); + OPENVINO_THROW("InsertLoops can't insert loops: master shape rank is too small"); } std::vector InsertLoops::calculate_inner_apply_increments(const ov::PartialShape& master, @@ -215,7 +215,7 @@ void insert_loops_explicitly(const ov::NodeVector& ops, const size_t vector_size bool InsertLoops::run_on_model(const std::shared_ptr &model) { RUN_ON_FUNCTION_SCOPE(InsertLoops); if (m_master_shape.is_dynamic()) - throw ngraph_error("InsertLoops doesn't support dynamic shapes yet"); + OPENVINO_THROW("InsertLoops doesn't support dynamic shapes yet"); const auto inner_work_amount = utils::get_inner_dim(m_master_shape).get_length(); const auto outer_work_amount = m_loop_depth == 2 ? utils::get_outer_dim(m_master_shape).get_length() : 1; @@ -231,11 +231,11 @@ bool InsertLoops::run_on_model(const std::shared_ptr &model) { const auto& body_rt_info = model->get_rt_info(); const auto& plugin_shapes = body_rt_info.find("PluginShapesOverride"); if (plugin_shapes == body_rt_info.end()) { - throw ngraph_error("InsertLoops requires PluginShapesOverride rt_info field"); + OPENVINO_THROW("InsertLoops requires PluginShapesOverride rt_info field"); } else { const auto& new_shapes = plugin_shapes->second.as>>(); if (new_shapes.size() != commonResults.size() + commonParams.size()) - throw ngraph_error("InsertLoops got invalid number of plugin-overriden shapes"); + OPENVINO_THROW("InsertLoops got invalid number of plugin-overriden shapes"); for (size_t i = 0; i < commonParams.size(); i++) ioShapes.emplace_back(new_shapes[i]); // reverse overriden_shapes for results since commonResults are reversed with respect to model->get_parameters() diff --git a/src/common/snippets/src/pass/insert_movebroadcast.cpp b/src/common/snippets/src/pass/insert_movebroadcast.cpp index aab74227461..de8d4a9d32a 100644 --- a/src/common/snippets/src/pass/insert_movebroadcast.cpp +++ b/src/common/snippets/src/pass/insert_movebroadcast.cpp @@ -23,7 +23,7 @@ std::pair> get_numpy_broadcast_p ov::PartialShape target_shape = input_shapes.front(); for (size_t i = 1; i < input_shapes.size(); i++) { if (!ov::PartialShape::broadcast_merge_into(target_shape, input_shapes[i], op::AutoBroadcastType::NUMPY)) - throw ngraph::ngraph_error("InsertMoveBroadcast: Failed broadcast-merge input shapes"); + OPENVINO_THROW("InsertMoveBroadcast: Failed broadcast-merge input shapes"); } std::vector normalized_shapes; for (const auto& input : input_shapes) { diff --git a/src/common/snippets/src/pass/mha_tokenization.cpp b/src/common/snippets/src/pass/mha_tokenization.cpp index 12161d5214c..4a8ab99e89f 100644 --- a/src/common/snippets/src/pass/mha_tokenization.cpp +++ b/src/common/snippets/src/pass/mha_tokenization.cpp @@ -358,7 +358,7 @@ ngraph::snippets::pass::TokenizeMHASnippets::TokenizeMHASnippets() { } if (body_results.size() != subgraph_result_inputs.size()) { - throw ngraph_error("body results and node results size mismatch during subgraph collapse"); + OPENVINO_THROW("body results and node results size mismatch during subgraph collapse"); } // todo: move this plugin-specific constraint to the plugin callback diff --git a/src/common/snippets/src/pass/tokenization.cpp b/src/common/snippets/src/pass/tokenization.cpp index 4744b73b882..e0aa78b4e2d 100644 --- a/src/common/snippets/src/pass/tokenization.cpp +++ b/src/common/snippets/src/pass/tokenization.cpp @@ -36,7 +36,7 @@ int64_t GetTopologicalOrder(const std::shared_ptr &node) { auto &rt = node->get_rt_info(); const auto rinfo = rt.find("TopologicalOrder"); if (rinfo == rt.end()) - throw ngraph_error("Topological order is required, but not set."); + OPENVINO_THROW("Topological order is required, but not set."); return rinfo->second.as(); } diff --git a/src/common/snippets/src/utils.cpp b/src/common/snippets/src/utils.cpp index 6587ff93fa6..8d294455150 100644 --- a/src/common/snippets/src/utils.cpp +++ b/src/common/snippets/src/utils.cpp @@ -74,7 +74,7 @@ std::vector get_node_output_layout(const Node* node) { if (!node) return {}; if (node->is_dynamic()) - throw ngraph_error("It's illegal to call get_node_output_layout for dynamic nodes"); + OPENVINO_THROW("It's illegal to call get_node_output_layout for dynamic nodes"); auto &rt = node->get_rt_info(); const auto rinfo = rt.find("Layout"); if (rinfo != rt.end()) { @@ -82,7 +82,7 @@ std::vector get_node_output_layout(const Node* node) { // This might be a little costy, but still useful sanity check. Remove if proved to be unacceptably heavy. std::set unique_elements(layout.begin(), layout.end()); if (unique_elements.size() < layout.size()) - throw ngraph_error("Layout must contain only unique dimension indexes"); + OPENVINO_THROW("Layout must contain only unique dimension indexes"); return layout; } else { return {}; @@ -94,13 +94,13 @@ ov::PartialShape get_reordered_planar_shape(const ov::PartialShape& shape, const return shape; std::vector reordered_shape(layout.size()); if (shape.rank().is_dynamic()) - throw ngraph_error("get_reordered_planar_shape can't be called for outputs with dynamic rank"); + OPENVINO_THROW("get_reordered_planar_shape can't be called for outputs with dynamic rank"); const size_t rank = shape.rank().get_length(); if (layout.size() > rank) - throw ngraph_error("Layout rank can't be larger than tensor rank"); + OPENVINO_THROW("Layout rank can't be larger than tensor rank"); // Note that it can be smaller though, for example tensor shape can be prepended with 1 for scheduling purposes if (std::any_of(layout.begin(), layout.end(), [=](size_t x) {return x >= rank;})) - throw ngraph_error("Invalid layout detected: all layout indexes must be smaller than the tensor rank"); + OPENVINO_THROW("Invalid layout detected: all layout indexes must be smaller than the tensor rank"); for (size_t i = 0; i < layout.size(); i++) reordered_shape[i] = shape[layout[i]]; return reordered_shape; @@ -110,7 +110,7 @@ ov::PartialShape get_port_planar_shape(const Output& out) { std::vector layout = get_node_output_layout(out.get_node_shared_ptr()); const auto& tensor = out.get_tensor_ptr(); if (!tensor) - throw ngraph_error("get_port_planar_shape can't be called for an uninitialized output tensor"); + OPENVINO_THROW("get_port_planar_shape can't be called for an uninitialized output tensor"); auto tensor_shape = tensor->get_partial_shape(); return get_reordered_planar_shape(tensor_shape, layout); } diff --git a/src/common/transformations/src/ov_ops/multiclass_nms_ie_internal.cpp b/src/common/transformations/src/ov_ops/multiclass_nms_ie_internal.cpp index 27450593570..934b9e191c4 100644 --- a/src/common/transformations/src/ov_ops/multiclass_nms_ie_internal.cpp +++ b/src/common/transformations/src/ov_ops/multiclass_nms_ie_internal.cpp @@ -33,7 +33,7 @@ std::shared_ptr op::internal::MulticlassNmsIEInternal::clone_with_new_inpu } else if (new_args.size() == 2) { return std::make_shared(new_args.at(0), new_args.at(1), m_attrs); } - throw ngraph::ngraph_error("Unsupported number of inputs: " + std::to_string(new_args.size())); + OPENVINO_THROW("Unsupported number of inputs: " + std::to_string(new_args.size())); } void op::internal::MulticlassNmsIEInternal::validate_and_infer_types() { diff --git a/src/common/transformations/src/ov_ops/nms_ie_internal.cpp b/src/common/transformations/src/ov_ops/nms_ie_internal.cpp index 1e32d54d0a0..d5513af0d4c 100644 --- a/src/common/transformations/src/ov_ops/nms_ie_internal.cpp +++ b/src/common/transformations/src/ov_ops/nms_ie_internal.cpp @@ -70,7 +70,7 @@ std::shared_ptr op::internal::NonMaxSuppressionIEInternal::clone_with_new_ m_sort_result_descending, m_output_type); } - throw ngraph::ngraph_error("Unsupported number of inputs: " + std::to_string(new_args.size())); + OPENVINO_THROW("Unsupported number of inputs: " + std::to_string(new_args.size())); } bool op::internal::NonMaxSuppressionIEInternal::visit_attributes(AttributeVisitor& visitor) { diff --git a/src/common/transformations/src/transformations/common_optimizations/ric_fusion.cpp b/src/common/transformations/src/transformations/common_optimizations/ric_fusion.cpp index 261d714016e..2cc7205994d 100644 --- a/src/common/transformations/src/transformations/common_optimizations/ric_fusion.cpp +++ b/src/common/transformations/src/transformations/common_optimizations/ric_fusion.cpp @@ -186,7 +186,7 @@ Attribute get(const T& port) { if (res != attrs.end()) { return res->second.template as(); } - throw Exception("reverse_input_channel_index is missing in given port"); + OPENVINO_THROW("reverse_input_channel_index is missing in given port"); } template > diff --git a/src/common/transformations/src/transformations/convert_precision.cpp b/src/common/transformations/src/transformations/convert_precision.cpp index 7bd8cd822d6..187eb575331 100644 --- a/src/common/transformations/src/transformations/convert_precision.cpp +++ b/src/common/transformations/src/transformations/convert_precision.cpp @@ -504,7 +504,7 @@ bool fuse_type_to_nms3(const std::shared_ptr& node, const precisio if (to == ov::element::i32 || to == ov::element::i64) { nms->set_output_type(to); } else { - throw Exception("Type: " + to.get_type_name() + " is not supported for NMS3"); + OPENVINO_THROW("Type: " + to.get_type_name() + " is not supported for NMS3"); } return true; } @@ -520,7 +520,7 @@ bool fuse_type_to_nms4(const std::shared_ptr& node, const precisio if (to == ov::element::i32 || to == ov::element::i64) { nms->set_output_type(to); } else { - throw Exception("Type: " + to.get_type_name() + " is not supported for NMS4"); + OPENVINO_THROW("Type: " + to.get_type_name() + " is not supported for NMS4"); } return true; } @@ -815,7 +815,7 @@ std::shared_ptr change_constant_precision(std::shared_ptroutput(0).set_names(constant->output(0).get_names()); auto* dst_data = const_cast(reinterpret_cast(new_constant->get_data_ptr())); if (dst_data == nullptr) - throw Exception("Can't get destination data pointer"); + OPENVINO_THROW("Can't get destination data pointer"); for (size_t i = 0; i < size; ++i) { dst_data[i] = convert_value(src_data[i]); @@ -836,7 +836,7 @@ std::shared_ptr change_constant_precisionoutput(0).set_names(constant->output(0).get_names()); auto* dst_data = const_cast(reinterpret_cast(new_constant->get_data_ptr())); if (dst_data == nullptr) - throw Exception("Can't get destination data pointer"); + OPENVINO_THROW("Can't get destination data pointer"); ngraph::runtime::reference::convert(src_data, dst_data, size); @@ -856,7 +856,7 @@ std::shared_ptr change_constant_precisionoutput(0).set_names(constant->output(0).get_names()); auto* dst_data = const_cast(reinterpret_cast(new_constant->get_data_ptr())); if (dst_data == nullptr) - throw Exception("Can't get destination data pointer"); + OPENVINO_THROW("Can't get destination data pointer"); ngraph::runtime::reference::convert(src_data, dst_data, size); @@ -957,15 +957,15 @@ std::shared_ptr convert_low_precisions_int(std::shared_ptrget_element_type().get_type_name() + " to " + - to.get_type_name() + " is not implemented!"); + OPENVINO_THROW("Convert low precision for " + constant->get_element_type().get_type_name() + " to " + + to.get_type_name() + " is not implemented!"); // Create a new constant operation and get destination data auto new_constant = std::make_shared(to, constant->get_shape()); auto* dst_data = const_cast(reinterpret_cast(new_constant->get_data_ptr())); // Check pointers if (src_data == nullptr || dst_data == nullptr) - throw Exception("Can't get data pointer"); + OPENVINO_THROW("Can't get data pointer"); // Convert values const auto size = shape_size(constant->get_shape()); @@ -1019,7 +1019,7 @@ std::shared_ptr convert_low_precisions_int(std::shared_ptr& node, } else if (from == ov::element::i4 || from == ov::element::u4 || from == ov::element::u1) { new_const = convert_low_precisions_int(constant, to); } else { - throw Exception("Precision conversion from " + from.get_type_name() + " to " + to.get_type_name() + - " is not supported"); + OPENVINO_THROW("Precision conversion from " + from.get_type_name() + " to " + to.get_type_name() + + " is not supported"); } for (auto& output : consumers) { output.replace_source_output(new_const); diff --git a/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp b/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp index f06e53b6910..611a3706aef 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp @@ -68,7 +68,7 @@ ov::pass::ConvertNMS9ToNMSIEInternal::ConvertNMS9ToNMSIEInternal() { center_point_box = 0; break; default: - throw Exception("NonMaxSuppression layer " + nms_9->get_friendly_name() + " has unsupported box encoding"); + OPENVINO_THROW("NonMaxSuppression layer " + nms_9->get_friendly_name() + " has unsupported box encoding"); } std::shared_ptr nms_legacy{nullptr}; diff --git a/src/common/transformations/src/transformations/op_conversions/convert_nms_to_nms_ie_internal.cpp b/src/common/transformations/src/transformations/op_conversions/convert_nms_to_nms_ie_internal.cpp index 80827f11f5b..59a17b29686 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_nms_to_nms_ie_internal.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_nms_to_nms_ie_internal.cpp @@ -68,7 +68,7 @@ ov::pass::ConvertNMSToNMSIEInternal::ConvertNMSToNMSIEInternal() { center_point_box = 0; break; default: - throw Exception("NonMaxSuppression layer " + nms_5->get_friendly_name() + " has unsupported box encoding"); + OPENVINO_THROW("NonMaxSuppression layer " + nms_5->get_friendly_name() + " has unsupported box encoding"); } std::shared_ptr nms_legacy{nullptr}; diff --git a/src/common/transformations/src/transformations/op_conversions/convert_previous_nms_to_nms_5.cpp b/src/common/transformations/src/transformations/op_conversions/convert_previous_nms_to_nms_5.cpp index 1b08466a9bf..170bfebba45 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_previous_nms_to_nms_5.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_previous_nms_to_nms_5.cpp @@ -42,7 +42,7 @@ NMSAttributes get_nms4_attrs(const std::shared_ptrget_friendly_name() + " has unsupported box encoding"); + OPENVINO_THROW("NonMaxSuppression layer " + nms4->get_friendly_name() + " has unsupported box encoding"); } attrs.sort_result_descending = nms4->get_sort_result_descending(); @@ -67,7 +67,7 @@ NMSAttributes get_nms3_attrs(const std::shared_ptrget_friendly_name() + " has unsupported box encoding"); + OPENVINO_THROW("NonMaxSuppression layer " + nms3->get_friendly_name() + " has unsupported box encoding"); } attrs.sort_result_descending = nms3->get_sort_result_descending(); @@ -92,7 +92,7 @@ NMSAttributes get_nms1_attrs(const std::shared_ptrget_friendly_name() + " has unsupported box encoding"); + OPENVINO_THROW("NonMaxSuppression layer " + nms1->get_friendly_name() + " has unsupported box encoding"); } attrs.sort_result_descending = nms1->get_sort_result_descending(); diff --git a/src/common/transformations/src/transformations/op_conversions/convert_previous_nms_to_nms_9.cpp b/src/common/transformations/src/transformations/op_conversions/convert_previous_nms_to_nms_9.cpp index 5f84c4cc6ab..794ef7f03db 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_previous_nms_to_nms_9.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_previous_nms_to_nms_9.cpp @@ -43,7 +43,7 @@ NMS9Attributes get_nms9_attrs_from_nms5(const std::shared_ptrget_friendly_name() + " has unsupported box encoding"); + OPENVINO_THROW("NonMaxSuppression layer " + nms5->get_friendly_name() + " has unsupported box encoding"); } attrs.sort_result_descending = nms5->get_sort_result_descending(); @@ -68,7 +68,7 @@ NMS9Attributes get_nms9_attrs_from_nms4(const std::shared_ptrget_friendly_name() + " has unsupported box encoding"); + OPENVINO_THROW("NonMaxSuppression layer " + nms4->get_friendly_name() + " has unsupported box encoding"); } attrs.sort_result_descending = nms4->get_sort_result_descending(); @@ -93,7 +93,7 @@ NMS9Attributes get_nms9_attrs_from_nms3(const std::shared_ptrget_friendly_name() + " has unsupported box encoding"); + OPENVINO_THROW("NonMaxSuppression layer " + nms3->get_friendly_name() + " has unsupported box encoding"); } attrs.sort_result_descending = nms3->get_sort_result_descending(); @@ -118,7 +118,7 @@ NMS9Attributes get_nms9_attrs_from_nms1(const std::shared_ptrget_friendly_name() + " has unsupported box encoding"); + OPENVINO_THROW("NonMaxSuppression layer " + nms1->get_friendly_name() + " has unsupported box encoding"); } attrs.sort_result_descending = nms1->get_sort_result_descending(); diff --git a/src/common/transformations/src/transformations/op_conversions/convert_roi_align_v3_to_v9.cpp b/src/common/transformations/src/transformations/op_conversions/convert_roi_align_v3_to_v9.cpp index f27b27dfe76..703635e8cb0 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_roi_align_v3_to_v9.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_roi_align_v3_to_v9.cpp @@ -37,7 +37,7 @@ ov::pass::ConvertROIAlign3To9::ConvertROIAlign3To9() { break; } default: { - throw Exception("unsupported PoolingMode "); + OPENVINO_THROW("unsupported PoolingMode "); } } diff --git a/src/common/transformations/src/transformations/op_conversions/convert_roi_align_v9_to_v3.cpp b/src/common/transformations/src/transformations/op_conversions/convert_roi_align_v9_to_v3.cpp index cca002d648d..af44f358966 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_roi_align_v9_to_v3.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_roi_align_v9_to_v3.cpp @@ -41,7 +41,7 @@ ov::pass::ConvertROIAlign9To3::ConvertROIAlign9To3() { break; } default: { - throw Exception("unsupported PoolingMode "); + OPENVINO_THROW("unsupported PoolingMode "); } } diff --git a/src/common/transformations/src/transformations/op_conversions/convert_scatter_elements_to_scatter.cpp b/src/common/transformations/src/transformations/op_conversions/convert_scatter_elements_to_scatter.cpp index 9def4bde880..aee58882285 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_scatter_elements_to_scatter.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_scatter_elements_to_scatter.cpp @@ -66,7 +66,7 @@ ov::pass::ConvertScatterElementsToScatter::ConvertScatterElementsToScatter() { uint64_t l, r; Range(const uint64_t& l, const uint64_t& r) : l(l), r(r) { if (l > r) - throw Exception("Range values are inconsistent"); + OPENVINO_THROW("Range values are inconsistent"); } uint64_t size() const { diff --git a/src/common/transformations/src/transformations/rt_info/primitives_priority_attribute.cpp b/src/common/transformations/src/transformations/rt_info/primitives_priority_attribute.cpp index 92541487ccd..24c03f62570 100644 --- a/src/common/transformations/src/transformations/rt_info/primitives_priority_attribute.cpp +++ b/src/common/transformations/src/transformations/rt_info/primitives_priority_attribute.cpp @@ -52,7 +52,7 @@ Any PrimitivesPriority::merge(const ngraph::NodeVector& nodes) const { } if (unique_pp.size() > 1) { - throw ngraph_error("PrimitivesPriority no rule defined for multiple values."); + OPENVINO_THROW("PrimitivesPriority no rule defined for multiple values."); } std::string final_primitives_priority; diff --git a/src/common/transformations/tests/op_conversions/convert_reduce_to_pooling_test.cpp b/src/common/transformations/tests/op_conversions/convert_reduce_to_pooling_test.cpp index 04d1dfd87b0..d0022db2e88 100644 --- a/src/common/transformations/tests/op_conversions/convert_reduce_to_pooling_test.cpp +++ b/src/common/transformations/tests/op_conversions/convert_reduce_to_pooling_test.cpp @@ -113,7 +113,7 @@ public: false /*any*/, ngraph::op::RoundingType::FLOOR /*any*/); } else { - throw ngraph::ngraph_error("Unsupported Reduce type!"); + OPENVINO_THROW("Unsupported Reduce type!"); } } diff --git a/src/common/transformations/tests/op_conversions/convert_scatter_elements_to_scatter_test.cpp b/src/common/transformations/tests/op_conversions/convert_scatter_elements_to_scatter_test.cpp index 038dbb62b09..d203eaaf486 100644 --- a/src/common/transformations/tests/op_conversions/convert_scatter_elements_to_scatter_test.cpp +++ b/src/common/transformations/tests/op_conversions/convert_scatter_elements_to_scatter_test.cpp @@ -35,7 +35,7 @@ std::shared_ptr get_initial_function(const ngraph::PartialShap auto broadcast_len = broadcast_shape.rank().get_length(); if (std::numeric_limits::max() < (size_t)broadcast_len) { - throw ngraph::ngraph_error("broadcast_len cannot be represented in size_t"); + OPENVINO_THROW("broadcast_len cannot be represented in size_t"); } auto broadcast_shape_param = diff --git a/src/common/transformations/tests/op_conversions/gather_normalize_negative_indices_test.cpp b/src/common/transformations/tests/op_conversions/gather_normalize_negative_indices_test.cpp index 6c27102627f..49e63c71e09 100644 --- a/src/common/transformations/tests/op_conversions/gather_normalize_negative_indices_test.cpp +++ b/src/common/transformations/tests/op_conversions/gather_normalize_negative_indices_test.cpp @@ -47,7 +47,7 @@ TEST_F(TransformationTestsF, GatherNegativeIndicesNormalize) { auto const_add = ngraph::get_constant_from_source(add); OPENVINO_SUPPRESS_DEPRECATED_END if (const_add == nullptr) - throw ngraph::ngraph_error("indices should've been constant folded"); + OPENVINO_THROW("indices should've been constant folded"); auto gather = std::make_shared(data, const_add, axis); function_ref = std::make_shared(ngraph::NodeVector{gather}, ngraph::ParameterVector{data}); @@ -84,7 +84,7 @@ TEST_F(TransformationTestsF, GatherNegativeIndicesNormalize_neg_axis) { auto const_add = ngraph::get_constant_from_source(add); OPENVINO_SUPPRESS_DEPRECATED_END if (const_add == nullptr) - throw ngraph::ngraph_error("indices should've been constant folded"); + OPENVINO_THROW("indices should've been constant folded"); auto gather = std::make_shared(data, const_add, axis); function_ref = std::make_shared(ngraph::NodeVector{gather}, ngraph::ParameterVector{data}); @@ -121,7 +121,7 @@ TEST_F(TransformationTestsF, GatherNegativeIndicesNormalize_dif_input_types) { auto const_add = ngraph::get_constant_from_source(add); OPENVINO_SUPPRESS_DEPRECATED_END if (const_add == nullptr) - throw ngraph::ngraph_error("indices should've been constant folded"); + OPENVINO_THROW("indices should've been constant folded"); auto gather = std::make_shared(data, const_add, axis); function_ref = std::make_shared(ngraph::NodeVector{gather}, ngraph::ParameterVector{data}); diff --git a/src/core/builder/include/ngraph/builder/make_constant.hpp b/src/core/builder/include/ngraph/builder/make_constant.hpp index b9b19145091..5fa7ba68dcf 100644 --- a/src/core/builder/include/ngraph/builder/make_constant.hpp +++ b/src/core/builder/include/ngraph/builder/make_constant.hpp @@ -21,6 +21,7 @@ std::shared_ptr make_constant(const element::Type& type, const Shape& shap # pragma GCC diagnostic error "-Wswitch" # pragma GCC diagnostic error "-Wswitch-enum" #endif + std::string unsupported_data_type; switch (type) { case element::Type_t::f32: val = @@ -84,18 +85,27 @@ std::shared_ptr make_constant(const element::Type& type, const Shape& shap std::vector{static_cast(num)}); break; case element::Type_t::dynamic: - throw ngraph_error("make_constant: Unsupported element type 'dynamic'"); + unsupported_data_type = "dynamic"; + break; case element::Type_t::boolean: - throw ngraph_error("make_constant: Unsupported element type 'boolean'"); + unsupported_data_type = "boolean"; + break; case element::Type_t::u1: - throw ngraph_error("make_constant: Unsupported element type 'u1'"); + unsupported_data_type = "u1"; + break; case element::Type_t::i4: - throw ngraph_error("make_constant: Unsupported element type 'i4'"); + unsupported_data_type = "i4"; + break; case element::Type_t::u4: - throw ngraph_error("make_constant: Unsupported element type 'u4'"); + unsupported_data_type = "u4"; + break; case element::Type_t::undefined: - throw ngraph_error("make_constant: Unsupported element type 'undefined'"); + unsupported_data_type = "undefined"; + break; } + if (!unsupported_data_type.empty()) + OPENVINO_THROW("make_constant: Unsupported element type '", unsupported_data_type, "'"); + #if defined(__GNUC__) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 8) # pragma GCC diagnostic pop #endif diff --git a/src/core/builder/src/builder/autobroadcast.cpp b/src/core/builder/src/builder/autobroadcast.cpp index 9d5de74b42e..e4694d5b2d5 100644 --- a/src/core/builder/src/builder/autobroadcast.cpp +++ b/src/core/builder/src/builder/autobroadcast.cpp @@ -20,11 +20,13 @@ using namespace std; namespace ngraph { namespace builder { +OPENVINO_SUPPRESS_DEPRECATED_START numpy_autobroadcast_incompatible_shapes::numpy_autobroadcast_incompatible_shapes(const Shape& shape1, const Shape& shape2) : ngraph_error(error_str(shape1, shape2)), m_shape1(shape1), m_shape2(shape2) {} +OPENVINO_SUPPRESS_DEPRECATED_END string numpy_autobroadcast_incompatible_shapes::error_str(const Shape& shape1, const Shape& shape2) { ostringstream os; diff --git a/src/core/builder/src/builder/make_constant.cpp b/src/core/builder/src/builder/make_constant.cpp index 73beb7c3f51..d61125c4c51 100644 --- a/src/core/builder/src/builder/make_constant.cpp +++ b/src/core/builder/src/builder/make_constant.cpp @@ -62,7 +62,7 @@ std::shared_ptr make_constant_from_double(const element::Type& type, const break; } default: - throw std::runtime_error("Unsupported data type during make_constant_from_double"); + OPENVINO_THROW("Unsupported data type during make_constant_from_double"); break; } return result; diff --git a/src/core/include/ngraph/op/util/op_annotations.hpp b/src/core/include/ngraph/op/util/op_annotations.hpp index 23e3ec7a5d2..8ef3d67c198 100644 --- a/src/core/include/ngraph/op/util/op_annotations.hpp +++ b/src/core/include/ngraph/op/util/op_annotations.hpp @@ -29,7 +29,7 @@ public: void add_in_place_oi_pair(const struct oi_pair& oi) { for (const auto& e : m_in_place_oi_pairs) { if (e.input == oi.input || e.output == oi.output) { - throw ngraph_error("In_place hint conflicts with an existing entry"); + OPENVINO_THROW("In_place hint conflicts with an existing entry"); } } m_in_place_oi_pairs.emplace_back(oi); diff --git a/src/core/include/openvino/core/except.hpp b/src/core/include/openvino/core/except.hpp index c7c143764f0..9bef38c30dc 100644 --- a/src/core/include/openvino/core/except.hpp +++ b/src/core/include/openvino/core/except.hpp @@ -8,17 +8,32 @@ #include #include "openvino/core/core_visibility.hpp" +#include "openvino/core/deprecated.hpp" namespace ov { + +struct CheckLocInfo { + const char* file; + int line; + const char* check_string; +}; + /// Base error for ov runtime errors. class OPENVINO_API Exception : public std::runtime_error { public: + OPENVINO_DEPRECATED("This constructor is deprecated and will be removed, please use OPENVINO_THROW instead") explicit Exception(const std::string& what_arg) : std::runtime_error(what_arg) {} - - explicit Exception(const char* what_arg) : std::runtime_error(what_arg) {} - + OPENVINO_DEPRECATED("This constructor is deprecated and will be removed, please use OPENVINO_THROW instead") explicit Exception(const std::stringstream& what_arg) : std::runtime_error(what_arg.str()) {} + [[noreturn]] static void create(const CheckLocInfo& check_loc_info, + const std::string& context_info, + const std::string& explanation); virtual ~Exception(); + +protected: + static std::string make_what(const CheckLocInfo& check_loc_info, + const std::string& context_info, + const std::string& explanation); }; static inline std::ostream& write_all_to_stream(std::ostream& str) { @@ -29,31 +44,30 @@ static inline std::ostream& write_all_to_stream(std::ostream& str, const T& arg, return write_all_to_stream(str << arg, args...); } -struct CheckLocInfo { - const char* file; - int line; - const char* check_string; -}; - /// Base class for check failure exceptions. class OPENVINO_API AssertFailure : public Exception { public: - AssertFailure(const CheckLocInfo& check_loc_info, const std::string& context_info, const std::string& explanation) - : Exception(make_what(check_loc_info, context_info, explanation)) {} + [[noreturn]] static void create(const CheckLocInfo& check_loc_info, + const std::string& context_info, + const std::string& explanation); ~AssertFailure() override; -private: - static std::string make_what(const CheckLocInfo& check_loc_info, - const std::string& context_info, - const std::string& explanation); +protected: + OPENVINO_SUPPRESS_DEPRECATED_START + explicit AssertFailure(const std::string& what_arg) : ov::Exception(what_arg) {} + OPENVINO_SUPPRESS_DEPRECATED_END }; /// Exception class to be thrown on not implemented code class OPENVINO_API NotImplemented : public AssertFailure { public: - NotImplemented(const CheckLocInfo& check_loc_info, const std::string& context_info, const std::string& explanation) - : AssertFailure(check_loc_info, context_info, explanation) {} + [[noreturn]] static void create(const CheckLocInfo& check_loc_info, + const std::string& context_info, + const std::string& explanation); ~NotImplemented() override; + +protected: + explicit NotImplemented(const std::string& what_arg) : ov::AssertFailure(what_arg) {} }; } // namespace ov @@ -119,20 +133,20 @@ public: // The "..." may be filled with expressions of any type that has an "operator<<" overload for // insertion into std::ostream. // -#define OPENVINO_ASSERT_HELPER2(exc_class, ctx, check, ...) \ - do { \ - if (!(check)) { \ - ::std::stringstream ss___; \ - ::ov::write_all_to_stream(ss___, __VA_ARGS__); \ - throw exc_class((::ov::CheckLocInfo{__FILE__, __LINE__, #check}), (ctx), ss___.str()); \ - } \ +#define OPENVINO_ASSERT_HELPER2(exc_class, ctx, check, ...) \ + do { \ + if (!(check)) { \ + ::std::stringstream ss___; \ + ::ov::write_all_to_stream(ss___, __VA_ARGS__); \ + exc_class::create((::ov::CheckLocInfo{__FILE__, __LINE__, #check}), (ctx), ss___.str()); \ + } \ } while (0) -#define OPENVINO_ASSERT_HELPER1(exc_class, ctx, check) \ - do { \ - if (!(check)) { \ - throw exc_class((::ov::CheckLocInfo{__FILE__, __LINE__, #check}), (ctx), ""); \ - } \ +#define OPENVINO_ASSERT_HELPER1(exc_class, ctx, check) \ + do { \ + if (!(check)) { \ + exc_class::create((::ov::CheckLocInfo{__FILE__, __LINE__, #check}), (ctx), ""); \ + } \ } while (0) /// \brief Macro to check whether a boolean condition holds. @@ -147,8 +161,8 @@ public: /// implemented with OPENVINO_ASSERT macro. /// \param ... Additional error message that should describe why that execution path is unreachable. /// \throws ::ov::AssertFailure if the macro is executed. -// TODO: throw ov::Exception after migration to functions -#define OPENVINO_THROW(...) OPENVINO_ASSERT(false, __VA_ARGS__) +// TODO: OPENVINO_THROW after migration to functions +#define OPENVINO_THROW(...) OPENVINO_ASSERT_HELPER(::ov::Exception, "", false, __VA_ARGS__) #define OPENVINO_ASSERT_HELPER(exc_class, ctx, ...) CALL_OVERLOAD(OPENVINO_ASSERT_HELPER, exc_class, ctx, __VA_ARGS__) #define OPENVINO_NOT_IMPLEMENTED OPENVINO_ASSERT_HELPER(::ov::NotImplemented, "", false, "Not Implemented", "") diff --git a/src/core/include/openvino/core/graph_util.hpp b/src/core/include/openvino/core/graph_util.hpp index f2f399a4e55..3aee53be409 100644 --- a/src/core/include/openvino/core/graph_util.hpp +++ b/src/core/include/openvino/core/graph_util.hpp @@ -15,6 +15,7 @@ #include #include "openvino/core/core_visibility.hpp" +#include "openvino/core/except.hpp" #include "openvino/core/model.hpp" #include "openvino/core/node.hpp" #include "openvino/op/parameter.hpp" @@ -238,8 +239,9 @@ std::vector> topological_sort(T root_nodes) { // Node may be at the top of `nodes_to_do` not more than twice before it's added to `nodes_done` - // when visited and placed in `nodes_to_do` and after the subtree traversal is finished. // Otherwise it's a loop. - throw Exception("Loop detected during topological sort starting from '" + node->get_friendly_name() + - "' node."); + OPENVINO_THROW("Loop detected during topological sort starting from '", + node->get_friendly_name(), + "' node."); size_t arg_count = node->get_input_size(); for (size_t i = 0; i < arg_count; ++i) { diff --git a/src/core/include/openvino/core/node.hpp b/src/core/include/openvino/core/node.hpp index c2bb3fef234..a0fe5bdfe89 100644 --- a/src/core/include/openvino/core/node.hpp +++ b/src/core/include/openvino/core/node.hpp @@ -530,9 +530,14 @@ using RawNodeOutputMap = std::map>; class OPENVINO_API NodeValidationFailure : public ov::AssertFailure { public: - NodeValidationFailure(const ov::CheckLocInfo& check_loc_info, const Node* node, const std::string& explanation) - : AssertFailure(check_loc_info, node_validation_failure_loc_string(node), explanation) {} + [[noreturn]] static void create(const CheckLocInfo& check_loc_info, + const Node* node, + const std::string& explanation); + +protected: + explicit NodeValidationFailure(const std::string& what_arg) : ov::AssertFailure(what_arg) {} }; + } // namespace ov #define NODE_VALIDATION_CHECK(node, ...) OPENVINO_ASSERT_HELPER(::ov::NodeValidationFailure, (node), __VA_ARGS__) diff --git a/src/core/include/openvino/op/util/activation_functions.hpp b/src/core/include/openvino/op/util/activation_functions.hpp index 7e9d26cb22a..66133049790 100644 --- a/src/core/include/openvino/op/util/activation_functions.hpp +++ b/src/core/include/openvino/op/util/activation_functions.hpp @@ -22,7 +22,9 @@ namespace op { namespace util { namespace error { struct UnknownActivationFunction : Exception { + OPENVINO_SUPPRESS_DEPRECATED_START UnknownActivationFunction(const std::string& func_name) : Exception{"Unknown activation function: " + func_name} {} + OPENVINO_SUPPRESS_DEPRECATED_END }; } // namespace error diff --git a/src/core/include/openvino/pass/pattern/matcher.hpp b/src/core/include/openvino/pass/pattern/matcher.hpp index a4290aeb214..c0a92dd6fb1 100644 --- a/src/core/include/openvino/pass/pattern/matcher.hpp +++ b/src/core/include/openvino/pass/pattern/matcher.hpp @@ -105,7 +105,7 @@ public: for (const auto& arg : node->input_values()) { if (auto t_casted = ov::as_type_ptr(arg.get_node_shared_ptr())) { if (matched) { - throw Exception("There's more than two arguments of the same type"); + OPENVINO_THROW("There's more than two arguments of the same type"); } else { matched = t_casted; } @@ -231,7 +231,7 @@ public: /// describing an individual cell NodeVector get_bound_nodes_for_pattern(const std::shared_ptr& pattern) const { if (m_matches.count(pattern) == 0) { - throw Exception("No bound nodes for a given label"); + OPENVINO_THROW("No bound nodes for a given label"); } return as_node_vector(m_matches.at(pattern)); diff --git a/src/core/include/openvino/pass/pattern/op/any_of.hpp b/src/core/include/openvino/pass/pattern/op/any_of.hpp index c0d77bd4ba1..468347a72ca 100644 --- a/src/core/include/openvino/pass/pattern/op/any_of.hpp +++ b/src/core/include/openvino/pass/pattern/op/any_of.hpp @@ -26,7 +26,7 @@ public: AnyOf(const element::Type& type, const PartialShape& s, ValuePredicate pred, const OutputVector& wrapped_values) : Pattern(wrapped_values, pred) { if (wrapped_values.size() != 1) { - throw Exception("AnyOf expects exactly one argument"); + OPENVINO_THROW("AnyOf expects exactly one argument"); } set_output_type(0, type, s); } diff --git a/src/core/include/openvino/pass/pattern/op/pattern.hpp b/src/core/include/openvino/pass/pattern/op/pattern.hpp index d5004c0ba70..c44a6bf0bd3 100644 --- a/src/core/include/openvino/pass/pattern/op/pattern.hpp +++ b/src/core/include/openvino/pass/pattern/op/pattern.hpp @@ -85,7 +85,7 @@ public: Pattern(const OutputVector& patterns) : Pattern(patterns, nullptr) {} std::shared_ptr clone_with_new_inputs(const OutputVector& /* new_args */) const override { - throw Exception("Uncopyable"); + OPENVINO_THROW("Uncopyable"); } ValuePredicate get_predicate() const; diff --git a/src/core/reference/include/ngraph/runtime/reference/ctc_loss.hpp b/src/core/reference/include/ngraph/runtime/reference/ctc_loss.hpp index bd366854754..dc4fc81c70e 100644 --- a/src/core/reference/include/ngraph/runtime/reference/ctc_loss.hpp +++ b/src/core/reference/include/ngraph/runtime/reference/ctc_loss.hpp @@ -40,11 +40,11 @@ void CTCLoss(const T* logits, U actualTargetLen = labelsLength[b]; if (static_cast(actualLogitLen) > maxTime || static_cast(actualTargetLen) > maxTime || actualTargetLen > actualLogitLen) { - throw ngraph_error(std::string("Logit or label length cannot greater than max sequence" - "length. Also a label length cannot be greater than a" - "logit length.\nMaxSeqLen: ") + - std::to_string(maxTime) + "; Logit len: " + std::to_string(actualLogitLen) + - "; Label len: " + std::to_string(actualTargetLen)); + OPENVINO_THROW(std::string("Logit or label length cannot greater than max sequence" + "length. Also a label length cannot be greater than a" + "logit length.\nMaxSeqLen: ") + + std::to_string(maxTime) + "; Logit len: " + std::to_string(actualLogitLen) + + "; Label len: " + std::to_string(actualTargetLen)); } const U* target = &labels[b * maxTime]; diff --git a/src/core/reference/include/ngraph/runtime/reference/embedding_bag_offsets_sum.hpp b/src/core/reference/include/ngraph/runtime/reference/embedding_bag_offsets_sum.hpp index be2637b5e74..ca36a096b61 100644 --- a/src/core/reference/include/ngraph/runtime/reference/embedding_bag_offsets_sum.hpp +++ b/src/core/reference/include/ngraph/runtime/reference/embedding_bag_offsets_sum.hpp @@ -32,11 +32,10 @@ void embeddingBagOffsetsSum(const T* emb_table, auto get_indices = [&](size_t emb_index, const U*& indices_ref, size_t& indices_num, size_t& weights_idx, bool& with_weights) { if (emb_index >= offsets_size) - throw ngraph_error("Invalid embedding bag index."); + OPENVINO_THROW("Invalid embedding bag index."); if (static_cast(offsets[emb_index]) >= indices_count) - throw ngraph_error(std::string("Offset value exceeds indices size in the model.\noffset: ") + - std::to_string(offsets[emb_index]) + - "; indices size: " + std::to_string(indices_count)); + OPENVINO_THROW(std::string("Offset value exceeds indices size in the model.\noffset: ") + + std::to_string(offsets[emb_index]) + "; indices size: " + std::to_string(indices_count)); indices_ref = nullptr; indices_num = 0lu; diff --git a/src/core/reference/include/ngraph/runtime/reference/embedding_segments_sum.hpp b/src/core/reference/include/ngraph/runtime/reference/embedding_segments_sum.hpp index cfeb702b851..8b4a833bf66 100644 --- a/src/core/reference/include/ngraph/runtime/reference/embedding_segments_sum.hpp +++ b/src/core/reference/include/ngraph/runtime/reference/embedding_segments_sum.hpp @@ -33,7 +33,7 @@ void embeddingSegmentsSum(const T* embTable, for (size_t index = 0; index < indices_len; index++) { size_t obi = segmentIds[index]; if (obi >= segments_num) - throw ngraph_error("Segment index could not be more than segments number"); + OPENVINO_THROW("Segment index could not be more than segments number"); size_t dst_index = obi * embDepth; size_t src_index = indices[index] * embDepth; @@ -51,7 +51,7 @@ void embeddingSegmentsSum(const T* embTable, if (defaultIndex != nullptr) { U defIndex = defaultIndex[0]; if (defIndex < U(0) && static_cast(defIndex) >= embTableShape[0]) - throw ngraph_error(std::string("Invalid default index") + std::to_string(defIndex)); + OPENVINO_THROW(std::string("Invalid default index") + std::to_string(defIndex)); for (size_t obi = 0; obi < segments_num; obi++) { bool found = false; for (size_t index = 0; index < indices_len; index++) { diff --git a/src/core/reference/include/ngraph/runtime/reference/extract_image_patches.hpp b/src/core/reference/include/ngraph/runtime/reference/extract_image_patches.hpp index 4e4b11095e9..0d1f748b7e3 100644 --- a/src/core/reference/include/ngraph/runtime/reference/extract_image_patches.hpp +++ b/src/core/reference/include/ngraph/runtime/reference/extract_image_patches.hpp @@ -95,15 +95,15 @@ void extract_image_patches(const std::shared_ptr extImg int64_t iwKW = iw0 + kw * RW; int64_t dst_idx = ob_OCOHOW_ohOW_ow + oc * OH_OW; if (dst_idx >= OB_OC_OH_OW) - throw ngraph_error("ExtractImagePatches. Destination index is out of " - "bounds."); + OPENVINO_THROW("ExtractImagePatches. Destination index is out of " + "bounds."); if (ihKH < 0 || ihKH >= IH || iwKW < 0 || iwKW >= IW) { out[dst_idx] = T(0); } else { int64_t src_idx = ib_ICIHIW_ihKH_IW + ic * IH_IW + iwKW; if (src_idx >= IB_IC_IH_IW) - throw ngraph_error("ExtractImagePatches. Source index is out of " - "bounds."); + OPENVINO_THROW("ExtractImagePatches. Source index is out of " + "bounds."); out[dst_idx] = input[src_idx]; } } diff --git a/src/core/reference/include/ngraph/runtime/reference/gru_cell.hpp b/src/core/reference/include/ngraph/runtime/reference/gru_cell.hpp index 8802c85be3e..5d041161bfb 100644 --- a/src/core/reference/include/ngraph/runtime/reference/gru_cell.hpp +++ b/src/core/reference/include/ngraph/runtime/reference/gru_cell.hpp @@ -131,7 +131,7 @@ void gru_cell(const T* X, } else if (activation == "tanh") { reference::tanh(gate.data(), gate.data(), gate.size()); } else { - throw ngraph_error("Activation function " + activation + " is not supported."); + OPENVINO_THROW("Activation function " + activation + " is not supported."); } }; diff --git a/src/core/reference/include/ngraph/runtime/reference/interpolate.hpp b/src/core/reference/include/ngraph/runtime/reference/interpolate.hpp index 7db65c5d7a3..c2eb4344ede 100644 --- a/src/core/reference/include/ngraph/runtime/reference/interpolate.hpp +++ b/src/core/reference/include/ngraph/runtime/reference/interpolate.hpp @@ -425,7 +425,7 @@ void InterpolateEval::linear_onnx_func(const T* input_data, T* out) { } if (!correct_axes) - throw ngraph_error("Axes are not correct!"); + OPENVINO_THROW("Axes are not correct!"); const auto info = helper.get_info_for_generic_linear_onnx(); diff --git a/src/core/reference/include/ngraph/runtime/reference/lstm_cell.hpp b/src/core/reference/include/ngraph/runtime/reference/lstm_cell.hpp index 99b2f7b4899..a448d7f15a1 100644 --- a/src/core/reference/include/ngraph/runtime/reference/lstm_cell.hpp +++ b/src/core/reference/include/ngraph/runtime/reference/lstm_cell.hpp @@ -122,7 +122,7 @@ void lstm_cell(const T* X, } else if (activation == "tanh") { reference::tanh(gate.data(), gate.data(), gate.size()); } else { - throw ngraph_error("Activation function " + activation + " is not supported."); + OPENVINO_THROW("Activation function " + activation + " is not supported."); } }; @@ -228,7 +228,7 @@ void lstm_cell_v1(const T* X, auto all_gates_shape_size = gate_shape_size * 4; if (weight_format != ov::op::LSTMWeightsFormat::FICO) { - throw ngraph_error("Only LSTMWeightFormat = FICO is supported."); + OPENVINO_THROW("Only LSTMWeightFormat = FICO is supported."); } // Xt*(W^T) std::vector Xt_W(all_gates_shape_size); @@ -270,7 +270,7 @@ void lstm_cell_v1(const T* X, } else if (activation == "tanh") { reference::tanh(gate.data(), gate.data(), gate.size()); } else { - throw ngraph_error("Activation function " + activation + " is not supported."); + OPENVINO_THROW("Activation function " + activation + " is not supported."); } }; diff --git a/src/core/reference/include/ngraph/runtime/reference/rnn_cell.hpp b/src/core/reference/include/ngraph/runtime/reference/rnn_cell.hpp index 22da145d628..99e4a781604 100644 --- a/src/core/reference/include/ngraph/runtime/reference/rnn_cell.hpp +++ b/src/core/reference/include/ngraph/runtime/reference/rnn_cell.hpp @@ -88,7 +88,7 @@ void rnn_cell(const T* X, } else if (activation_f == "tanh") { reference::tanh(i_t.data(), dst_data, i_t.size()); } else { - throw ngraph_error("Activation function " + activation_f + " is not supported."); + OPENVINO_THROW("Activation function " + activation_f + " is not supported."); } } } // namespace reference diff --git a/src/core/reference/include/ngraph/runtime/reference/roi_align.hpp b/src/core/reference/include/ngraph/runtime/reference/roi_align.hpp index 3ea62e8d033..4cb4b38e235 100644 --- a/src/core/reference/include/ngraph/runtime/reference/roi_align.hpp +++ b/src/core/reference/include/ngraph/runtime/reference/roi_align.hpp @@ -58,7 +58,7 @@ void roi_align(const T* feature_maps, break; } default: { - throw ngraph_error(std::string("Not supported aligned_mode")); + OPENVINO_THROW(std::string("Not supported aligned_mode")); break; } } diff --git a/src/core/reference/src/runtime/reference/experimental_detectron_proposal_single_image.cpp b/src/core/reference/src/runtime/reference/experimental_detectron_proposal_single_image.cpp index 90635729583..9a320082bc2 100644 --- a/src/core/reference/src/runtime/reference/experimental_detectron_proposal_single_image.cpp +++ b/src/core/reference/src/runtime/reference/experimental_detectron_proposal_single_image.cpp @@ -333,9 +333,9 @@ void experimental_detectron_proposals_single_image_postprocessing(void* prois, memcpy(scores_ptr, output_scores.data(), shape_size(output_scores_shape) * sizeof(float)); } break; default:; - throw ngraph_error("Unsupported input data type: " - "ExperimentalDetectronGenerateProposalsSingleImage operation" - " supports only fp32, fp16, or bf16 data."); + OPENVINO_THROW("Unsupported input data type: " + "ExperimentalDetectronGenerateProposalsSingleImage operation" + " supports only fp32, fp16, or bf16 data."); } } } // namespace reference diff --git a/src/core/reference/src/runtime/reference/gather_tree.cpp b/src/core/reference/src/runtime/reference/gather_tree.cpp index b428fbfb6b1..ea50ba09c68 100644 --- a/src/core/reference/src/runtime/reference/gather_tree.cpp +++ b/src/core/reference/src/runtime/reference/gather_tree.cpp @@ -11,6 +11,7 @@ #include "ngraph/check.hpp" #include "ngraph/coordinate_transform.hpp" +#include "openvino/core/except.hpp" using namespace ngraph; @@ -33,7 +34,7 @@ static size_t _asIndex(const char* source, const element::Type& element_type) { return static_cast(tmpBuff); } default: { - throw ngraph_error(std::string("Unsupported input data type: ") + element_type.get_type_name()); + OPENVINO_THROW("Unsupported input data type: ", element_type.get_type_name()); } } } @@ -50,16 +51,16 @@ void runtime::reference::gather_tree(const char* step_ids, const Shape& end_token_shape, const element::Type& element_type) { if (step_ids_shape != parent_ids_shape) { - throw ngraph_error("step_ids shape and parent_ids shape must be the same"); + OPENVINO_THROW("step_ids shape and parent_ids shape must be the same"); } if (step_ids_shape.size() != 3) { - throw ngraph_error("step_ids must be a 3-tensor"); + OPENVINO_THROW("step_ids must be a 3-tensor"); } if (!is_vector(max_seq_len_shape)) { - throw ngraph_error("max_seq_len must be a vector"); + OPENVINO_THROW("max_seq_len must be a vector"); } if (!is_scalar(end_token_shape)) { - throw ngraph_error("end_token must be a scalar"); + OPENVINO_THROW("end_token must be a scalar"); } const size_t max_time = step_ids_shape.at(0); @@ -69,7 +70,7 @@ void runtime::reference::gather_tree(const char* step_ids, const size_t elem_size = element_type.size(); if (max_seq_len_shape.front() != batch_size) { - throw ngraph_error("max_seq_len must have size of BATCH_SIZE"); + OPENVINO_THROW("max_seq_len must have size of BATCH_SIZE"); } const auto in_strides = row_major_strides(step_ids_shape); diff --git a/src/core/reference/src/runtime/reference/generate_proposal.cpp b/src/core/reference/src/runtime/reference/generate_proposal.cpp index 3aa82a11eba..3154d14d0eb 100644 --- a/src/core/reference/src/runtime/reference/generate_proposal.cpp +++ b/src/core/reference/src/runtime/reference/generate_proposal.cpp @@ -398,9 +398,9 @@ void generate_proposals_postprocessing(void* prois, memcpy(scores_ptr, output_scores.data(), shape_size(output_scores_shape) * sizeof(float)); } break; default:; - throw ngraph_error("Unsupported input data type: " - "GenerateProposals operation" - " supports only fp32, fp16, or bf16 data."); + OPENVINO_THROW("Unsupported input data type: " + "GenerateProposals operation" + " supports only fp32, fp16, or bf16 data."); } for (size_t i = 0; i < num_rois.size(); i++) { @@ -414,8 +414,8 @@ void generate_proposals_postprocessing(void* prois, roi_num_ptr[i] = static_cast(num_rois[i]); } break; default:; - throw ngraph_error("Unsupported data type on output port 3: " - " supports only int32 or int64."); + OPENVINO_THROW("Unsupported data type on output port 3: " + " supports only int32 or int64."); } } } diff --git a/src/core/reference/src/runtime/reference/random_uniform.cpp b/src/core/reference/src/runtime/reference/random_uniform.cpp index 23478ede3c8..3b4b70c1b71 100644 --- a/src/core/reference/src/runtime/reference/random_uniform.cpp +++ b/src/core/reference/src/runtime/reference/random_uniform.cpp @@ -7,6 +7,7 @@ #include #include "ngraph/shape.hpp" +#include "openvino/core/except.hpp" namespace ngraph { namespace runtime { @@ -304,7 +305,7 @@ std::pair random_uniform(const uint64_t* out_shape, break; } default: - throw ngraph_error("Unsupported type of RandomUniform: " + elem_type.get_type_name()); + OPENVINO_THROW("Unsupported type of RandomUniform: ", elem_type.get_type_name()); } if (++n == 0) ++counter; diff --git a/src/core/reference/src/runtime/reference/reorg_yolo.cpp b/src/core/reference/src/runtime/reference/reorg_yolo.cpp index 4e6d4ab76b1..2a8d6097f88 100644 --- a/src/core/reference/src/runtime/reference/reorg_yolo.cpp +++ b/src/core/reference/src/runtime/reference/reorg_yolo.cpp @@ -29,8 +29,8 @@ void reorg_yolo(const char* arg, char* out, const Shape& in_shape, int64_t strid size_t impl_out_C = in_C / (stride * stride); if (impl_out_C == 0) { - throw ngraph_error("ReorgYolo. For [N, C, H, W] input shape, C >= (stride*stride) is " - "required."); + OPENVINO_THROW("ReorgYolo. For [N, C, H, W] input shape, C >= (stride*stride) is " + "required."); } size_t impl_out_H = in_H * stride; size_t impl_out_W = in_W * stride; diff --git a/src/core/src/descriptor/tensor.cpp b/src/core/src/descriptor/tensor.cpp index 18a024835bd..09fc247c37b 100644 --- a/src/core/src/descriptor/tensor.cpp +++ b/src/core/src/descriptor/tensor.cpp @@ -5,6 +5,7 @@ #include "openvino/core/descriptor/tensor.hpp" #include "ngraph/node.hpp" +#include "openvino/core/except.hpp" using namespace std; @@ -106,7 +107,7 @@ const std::unordered_set& ov::descriptor::Tensor::get_names() const const std::string& ov::descriptor::Tensor::get_any_name() const { if (m_name_it == m_names.cend()) { - throw ngraph::ngraph_error("Attempt to get a name for a Tensor without names"); + OPENVINO_THROW("Attempt to get a name for a Tensor without names"); } return *m_name_it; } diff --git a/src/core/src/except.cpp b/src/core/src/except.cpp index ef0b76fb376..6faef9d93c2 100644 --- a/src/core/src/except.cpp +++ b/src/core/src/except.cpp @@ -4,9 +4,17 @@ #include "openvino/core/except.hpp" -std::string ov::AssertFailure::make_what(const CheckLocInfo& check_loc_info, - const std::string& context_info, - const std::string& explanation) { +void ov::Exception::create(const CheckLocInfo& check_loc_info, + const std::string& context_info, + const std::string& explanation) { + OPENVINO_SUPPRESS_DEPRECATED_START + throw ov::Exception(make_what(check_loc_info, context_info, explanation)); + OPENVINO_SUPPRESS_DEPRECATED_END +} + +std::string ov::Exception::make_what(const CheckLocInfo& check_loc_info, + const std::string& context_info, + const std::string& explanation) { // Use relative path only for internal code auto getRelativePath = [](const std::string& path) -> std::string { // Path to local OpenVINO repository @@ -31,5 +39,17 @@ std::string ov::AssertFailure::make_what(const CheckLocInfo& check_loc_info, } ov::Exception::~Exception() = default; + +void ov::AssertFailure::create(const CheckLocInfo& check_loc_info, + const std::string& context_info, + const std::string& explanation) { + throw ov::AssertFailure(make_what(check_loc_info, context_info, explanation)); +} ov::AssertFailure::~AssertFailure() = default; + +void ov::NotImplemented::create(const CheckLocInfo& check_loc_info, + const std::string& context_info, + const std::string& explanation) { + throw ov::NotImplemented(make_what(check_loc_info, context_info, explanation)); +} ov::NotImplemented::~NotImplemented() = default; diff --git a/src/core/src/graph_util.cpp b/src/core/src/graph_util.cpp index beec35ac293..ea4168b4910 100644 --- a/src/core/src/graph_util.cpp +++ b/src/core/src/graph_util.cpp @@ -114,7 +114,7 @@ void ov::replace_node(const std::shared_ptr& target, const std::shared_ptr& replacement, const std::vector& output_order) { if (ngraph::op::is_output(target)) { - throw ngraph::ngraph_error("Result nodes cannot be replaced."); + OPENVINO_THROW("Result nodes cannot be replaced."); } NGRAPH_CHECK(target->get_output_size() == output_order.size(), @@ -140,7 +140,7 @@ void ov::replace_node(const std::shared_ptr& target, void ov::replace_node(const std::shared_ptr& target, const OutputVector& replacement_values) { if (ngraph::op::is_output(target)) { - throw ngraph::ngraph_error("Result nodes cannot be replaced."); + OPENVINO_THROW("Result nodes cannot be replaced."); } NGRAPH_CHECK(target->get_output_size() == replacement_values.size()); @@ -285,7 +285,7 @@ std::shared_ptr clone_ov_model(const Model& func, std::unordered_map node : func.get_results()) { auto result = ov::as_type_ptr(node_map.at(node.get())); if (!result) { - throw ngraph::ngraph_error("Results should be of type op::Result"); + OPENVINO_THROW("Results should be of type op::Result"); } cloned_results.push_back(result); } @@ -439,7 +439,7 @@ pair, shared_ptr> ngraph:: const shared_ptr& src_node, const shared_ptr& dst_node) { if (src_node->get_output_size() != 1) { - throw ngraph_error("Multiple output per op not supported in graph partition yet."); + OPENVINO_THROW("Multiple output per op not supported in graph partition yet."); } // Make parameter node diff --git a/src/core/src/itt.hpp b/src/core/src/itt.hpp index 5c527ecee2d..e8702f04109 100644 --- a/src/core/src/itt.hpp +++ b/src/core/src/itt.hpp @@ -39,7 +39,7 @@ OV_CC_DOMAINS(ov_opset); #elif defined(SELECTIVE_BUILD) # define OV_OP_SCOPE(region) \ if (OV_CC_SCOPE_IS_ENABLED(OV_PP_CAT3(ov_op, _, region)) == 0) \ - throw ngraph::ngraph_error(std::string(OV_PP_TOSTRING(OV_PP_CAT3(ov_op, _, region))) + " is disabled!") + OPENVINO_THROW(std::string(OV_PP_TOSTRING(OV_PP_CAT3(ov_op, _, region))) + " is disabled!") # define REGISTER_OP(opset_name, op_name) # define INSERT_OP(opset_name, op_name, op_namespace) \ if (OV_CC_SCOPE_IS_ENABLED(OV_PP_CAT4(ov_opset_, opset_name, _, op_name)) == 1) \ diff --git a/src/core/src/node.cpp b/src/core/src/node.cpp index 526b07f61f9..137f7d1187f 100644 --- a/src/core/src/node.cpp +++ b/src/core/src/node.cpp @@ -26,6 +26,12 @@ using namespace std; +void ov::NodeValidationFailure::create(const CheckLocInfo& check_loc_info, + const Node* node, + const std::string& explanation) { + throw ov::NodeValidationFailure(make_what(check_loc_info, node_validation_failure_loc_string(node), explanation)); +} + atomic ov::Node::m_next_instance_id(0); ov::Node::Node() = default; @@ -417,7 +423,7 @@ const ov::element::Type& ov::Node::get_output_element_type(size_t i) const { const ov::element::Type& ov::Node::get_element_type() const { if (get_output_size() != 1) { - throw ngraph::ngraph_error("get_element_type() must be called on a node with exactly one output."); + OPENVINO_THROW("get_element_type() must be called on a node with exactly one output."); } return get_output_element_type(0); } diff --git a/src/core/src/op/broadcast.cpp b/src/core/src/op/broadcast.cpp index 9e1461cf0ad..69a450beddc 100644 --- a/src/core/src/op/broadcast.cpp +++ b/src/core/src/op/broadcast.cpp @@ -183,7 +183,7 @@ shared_ptr op::v3::Broadcast::clone_with_new_inputs(const OutputVector& ne } else if (new_args.size() == 3) { return make_shared(new_args.at(0), new_args.at(1), new_args.at(2), m_mode); } else { - throw ngraph_error("Not supported number of Broadcast:v3 args"); + OPENVINO_THROW("Not supported number of Broadcast:v3 args"); } } diff --git a/src/core/src/op/ctc_greedy_decoder_seq_len.cpp b/src/core/src/op/ctc_greedy_decoder_seq_len.cpp index afbddc295ae..e852bc73a38 100644 --- a/src/core/src/op/ctc_greedy_decoder_seq_len.cpp +++ b/src/core/src/op/ctc_greedy_decoder_seq_len.cpp @@ -84,6 +84,6 @@ shared_ptr op::v6::CTCGreedyDecoderSeqLen::clone_with_new_inputs(const Out m_classes_index_type, m_sequence_length_type); } else { - throw ngraph_error("Incorrect number of arguments"); + OPENVINO_THROW("Incorrect number of arguments"); } } diff --git a/src/core/src/op/deformable_psroi_pooling.cpp b/src/core/src/op/deformable_psroi_pooling.cpp index d5126489c99..a6a5db8f5c9 100644 --- a/src/core/src/op/deformable_psroi_pooling.cpp +++ b/src/core/src/op/deformable_psroi_pooling.cpp @@ -105,7 +105,7 @@ shared_ptr op::v1::DeformablePSROIPooling::clone_with_new_inputs(const Out m_trans_std, m_part_size); } else { - throw ngraph_error("Not supported number of DeformablePSROIPooling args"); + OPENVINO_THROW("Not supported number of DeformablePSROIPooling args"); } } diff --git a/src/core/src/op/embedding_segments_sum.cpp b/src/core/src/op/embedding_segments_sum.cpp index 0058f99dc2a..b7dc0df1fca 100644 --- a/src/core/src/op/embedding_segments_sum.cpp +++ b/src/core/src/op/embedding_segments_sum.cpp @@ -132,6 +132,6 @@ shared_ptr op::v3::EmbeddingSegmentsSum::clone_with_new_inputs(const Outpu new_args.at(4), new_args.at(5)); } else { - throw ngraph_error("Incorrect number of arguments"); + OPENVINO_THROW("Incorrect number of arguments"); } } diff --git a/src/core/src/op/embeddingbag_offsets_sum.cpp b/src/core/src/op/embeddingbag_offsets_sum.cpp index 14c34506f34..f510e380de8 100644 --- a/src/core/src/op/embeddingbag_offsets_sum.cpp +++ b/src/core/src/op/embeddingbag_offsets_sum.cpp @@ -45,6 +45,6 @@ shared_ptr op::v3::EmbeddingBagOffsetsSum::clone_with_new_inputs(const Out new_args.at(3), new_args.at(4)); } else { - throw ngraph_error("Incorrect number of arguments"); + OPENVINO_THROW("Incorrect number of arguments"); } } diff --git a/src/core/src/op/embeddingbag_packedsum.cpp b/src/core/src/op/embeddingbag_packedsum.cpp index 50829a0541c..319f2569ada 100644 --- a/src/core/src/op/embeddingbag_packedsum.cpp +++ b/src/core/src/op/embeddingbag_packedsum.cpp @@ -26,6 +26,6 @@ shared_ptr op::v3::EmbeddingBagPackedSum::clone_with_new_inputs(const Outp } else if (new_args.size() == 3) { return make_shared(new_args.at(0), new_args.at(1), new_args.at(2)); } else { - throw ngraph_error("Incorrect number of arguments"); + OPENVINO_THROW("Incorrect number of arguments"); } } diff --git a/src/core/src/op/gelu.cpp b/src/core/src/op/gelu.cpp index a2a4d2f313e..45d36be385d 100644 --- a/src/core/src/op/gelu.cpp +++ b/src/core/src/op/gelu.cpp @@ -28,7 +28,7 @@ bool op::v0::Gelu::visit_attributes(AttributeVisitor& visitor) { shared_ptr op::v0::Gelu::clone_with_new_inputs(const OutputVector& new_args) const { OV_OP_SCOPE(v0_Gelu_clone_with_new_inputs); if (new_args.size() != 1) { - throw ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } return make_shared(new_args.at(0)); } @@ -78,7 +78,7 @@ bool op::v7::Gelu::visit_attributes(AttributeVisitor& visitor) { shared_ptr op::v7::Gelu::clone_with_new_inputs(const OutputVector& new_args) const { OV_OP_SCOPE(v7_Gelu_clone_with_new_inputs); if (new_args.size() != 1) { - throw ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } return make_shared(new_args.at(0), m_approximation_mode); } diff --git a/src/core/src/op/grn.cpp b/src/core/src/op/grn.cpp index 65b5ee0a41f..ff95ade95da 100644 --- a/src/core/src/op/grn.cpp +++ b/src/core/src/op/grn.cpp @@ -40,7 +40,7 @@ void op::v0::GRN::validate_and_infer_types() { shared_ptr op::v0::GRN::clone_with_new_inputs(const OutputVector& new_args) const { OV_OP_SCOPE(v0_GRN_clone_with_new_inputs); if (new_args.size() != 1) { - throw ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } return make_shared(new_args.at(0), m_bias); } diff --git a/src/core/src/op/gru_cell.cpp b/src/core/src/op/gru_cell.cpp index 038d783419f..4e82409fedd 100644 --- a/src/core/src/op/gru_cell.cpp +++ b/src/core/src/op/gru_cell.cpp @@ -141,6 +141,6 @@ shared_ptr op::v3::GRUCell::clone_with_new_inputs(const OutputVector& new_ get_clip(), m_linear_before_reset); } else { - throw ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } } diff --git a/src/core/src/op/lstm_cell.cpp b/src/core/src/op/lstm_cell.cpp index a07f937f3c1..eb5ec3a96ca 100644 --- a/src/core/src/op/lstm_cell.cpp +++ b/src/core/src/op/lstm_cell.cpp @@ -232,7 +232,7 @@ shared_ptr op::v0::LSTMCell::clone_with_new_inputs(const OutputVector& new get_clip(), m_input_forget); } else { - throw ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } } @@ -401,6 +401,6 @@ shared_ptr op::v4::LSTMCell::clone_with_new_inputs(const OutputVector& new get_activations_beta(), get_clip()); } else { - throw ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } } diff --git a/src/core/src/op/lstm_sequence.cpp b/src/core/src/op/lstm_sequence.cpp index 94116657e5c..8f2f2e8e31a 100644 --- a/src/core/src/op/lstm_sequence.cpp +++ b/src/core/src/op/lstm_sequence.cpp @@ -142,7 +142,7 @@ shared_ptr op::v0::LSTMSequence::clone_with_new_inputs(const OutputVector& m_clip_threshold, m_input_forget); } else { - throw ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } } @@ -341,7 +341,7 @@ shared_ptr op::v5::LSTMSequence::clone_with_new_inputs(const OutputVector& m_activations, m_clip); } else { - throw ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } } diff --git a/src/core/src/op/normalize_l2.cpp b/src/core/src/op/normalize_l2.cpp index a714836c7f2..438f2f2ac5b 100644 --- a/src/core/src/op/normalize_l2.cpp +++ b/src/core/src/op/normalize_l2.cpp @@ -82,7 +82,7 @@ AxisSet op::v0::NormalizeL2::get_reduction_axes() const { shared_ptr op::v0::NormalizeL2::clone_with_new_inputs(const OutputVector& new_args) const { OV_OP_SCOPE(v0_NormalizeL2_clone_with_new_inputs); if (new_args.size() != 2) { - throw ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } return make_shared(new_args.at(0), new_args.at(1), m_eps, m_eps_mode); } diff --git a/src/core/src/op/random_uniform.cpp b/src/core/src/op/random_uniform.cpp index b756d529c29..df3efad45f8 100644 --- a/src/core/src/op/random_uniform.cpp +++ b/src/core/src/op/random_uniform.cpp @@ -105,7 +105,7 @@ void op::v8::RandomUniform::validate_and_infer_types() { ", max value: ", max_val); } else { - throw ngraph_error("Unsupported output type of RandomUniform: " + get_out_type().get_type_name()); + OPENVINO_THROW("Unsupported output type of RandomUniform: " + get_out_type().get_type_name()); } } } @@ -156,8 +156,8 @@ bool op::v8::RandomUniform::evaluate(const HostTensorVector& outputs, const Host }); out_shape = out_shape_uint64.data(); } else { - throw ngraph_error("Unsupported type of out shape in RandomUniform operation: " + - inputs[0]->get_element_type().get_type_name()); + OPENVINO_THROW("Unsupported type of out shape in RandomUniform operation: " + + inputs[0]->get_element_type().get_type_name()); } element::Type_t t_out = get_out_type(); @@ -182,7 +182,7 @@ bool op::v8::RandomUniform::evaluate(const HostTensorVector& outputs, const Host out = (char*)outputs[0]->get_data_ptr(); break; default: - throw ngraph_error("Unsupported type of RandomUniform: " + get_out_type().get_type_name()); + OPENVINO_THROW("Unsupported type of RandomUniform: " + get_out_type().get_type_name()); } auto state = ngraph::runtime::reference::random_uniform(out_shape, diff --git a/src/core/src/op/reshape.cpp b/src/core/src/op/reshape.cpp index 27931808710..62c03dc6388 100644 --- a/src/core/src/op/reshape.cpp +++ b/src/core/src/op/reshape.cpp @@ -165,7 +165,7 @@ bool op::v1::Reshape::evaluate_reshape(const HostTensorVector& outputs, const Ho COMPUTE_OUT_SHAPE_CASE(u32, inputs[1], out_shape_val); COMPUTE_OUT_SHAPE_CASE(u64, inputs[1], out_shape_val); default: - throw ngraph_error("shape_pattern element type is not integral data type"); + OPENVINO_THROW("shape_pattern element type is not integral data type"); } std::vector reshape_pattern; diff --git a/src/core/src/op/rnn_cell.cpp b/src/core/src/op/rnn_cell.cpp index dcf69df10c4..97dda033aa0 100644 --- a/src/core/src/op/rnn_cell.cpp +++ b/src/core/src/op/rnn_cell.cpp @@ -175,6 +175,6 @@ shared_ptr op::v0::RNNCell::clone_with_new_inputs(const OutputVector& new_ get_activations_beta(), get_clip()); } else { - throw ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } } diff --git a/src/core/src/op/shuffle_channels.cpp b/src/core/src/op/shuffle_channels.cpp index d6c7afe6497..e29bb6de497 100644 --- a/src/core/src/op/shuffle_channels.cpp +++ b/src/core/src/op/shuffle_channels.cpp @@ -41,7 +41,7 @@ size_t op::ShuffleChannels::get_zero_based_axis() const { return ov::normalize_axis(this, m_axis, input_rank); OPENVINO_SUPPRESS_DEPRECATED_END } else { - throw ngraph_error("Cannot request zero-based axis with a input of unknown rank"); + OPENVINO_THROW("Cannot request zero-based axis with a input of unknown rank"); } } diff --git a/src/core/src/op/space_to_depth.cpp b/src/core/src/op/space_to_depth.cpp index cb10742d9df..4f6ec1d1760 100644 --- a/src/core/src/op/space_to_depth.cpp +++ b/src/core/src/op/space_to_depth.cpp @@ -38,7 +38,7 @@ bool ngraph::op::v0::SpaceToDepth::visit_attributes(AttributeVisitor& visitor) { std::shared_ptr ov::op::v0::SpaceToDepth::clone_with_new_inputs(const OutputVector& new_args) const { OV_OP_SCOPE(v0_SpaceToDepth_clone_with_new_inputs); if (new_args.size() != 1) { - throw ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } return std::make_shared(new_args.at(0), m_mode, m_blocksize); } diff --git a/src/core/src/op/squeeze.cpp b/src/core/src/op/squeeze.cpp index 78e37b140f1..812cdc6ea69 100644 --- a/src/core/src/op/squeeze.cpp +++ b/src/core/src/op/squeeze.cpp @@ -53,7 +53,7 @@ shared_ptr op::Squeeze::clone_with_new_inputs(const OutputVector& new_args } else if (new_args.size() == 2) { return make_shared(new_args.at(0), new_args.at(1)); } else { - throw ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } } diff --git a/src/core/src/op/unsqueeze.cpp b/src/core/src/op/unsqueeze.cpp index 4bd98e4cc01..ddeef24b8ce 100644 --- a/src/core/src/op/unsqueeze.cpp +++ b/src/core/src/op/unsqueeze.cpp @@ -41,7 +41,7 @@ bool op::v0::Unsqueeze::visit_attributes(AttributeVisitor& visitor) { shared_ptr op::v0::Unsqueeze::clone_with_new_inputs(const OutputVector& new_args) const { OV_OP_SCOPE(v0_Unsqueeze_clone_with_new_inputs); if (new_args.size() != 2) { - throw ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } return make_shared(new_args.at(0), new_args.at(1)); } diff --git a/src/core/src/pattern/op/wrap_type.cpp b/src/core/src/pattern/op/wrap_type.cpp index 58602ab3c61..1be4684ca22 100644 --- a/src/core/src/pattern/op/wrap_type.cpp +++ b/src/core/src/pattern/op/wrap_type.cpp @@ -5,6 +5,7 @@ #include "ngraph/pattern/op/wrap_type.hpp" #include "ngraph/pattern/matcher.hpp" +#include "openvino/core/except.hpp" using namespace std; using namespace ngraph; @@ -30,7 +31,7 @@ bool pattern::op::WrapType::match_value(Matcher* matcher, NodeTypeInfo pattern::op::WrapType::get_wrapped_type() const { if (m_wrapped_types.size() > 1) { - throw ngraph::ngraph_error("get_wrapped_type() called on WrapType with more than one type"); + OPENVINO_THROW("get_wrapped_type() called on WrapType with more than one type"); } return m_wrapped_types.at(0); } diff --git a/src/core/src/util.cpp b/src/core/src/util.cpp index 172dbcf7c61..8a5f6ea6502 100644 --- a/src/core/src/util.cpp +++ b/src/core/src/util.cpp @@ -350,7 +350,7 @@ vector read_float_vector(shared_ptr tv) { float_vec.push_back(static_cast(value)); } } else { - throw ngraph_error("Unsupported OpenVINO element type."); + OPENVINO_THROW("Unsupported OpenVINO element type."); } return float_vec; @@ -426,7 +426,7 @@ vector read_index_vector(shared_ptr tv) { index_vec.push_back(static_cast(value)); } } else { - throw ngraph_error("Unsupported OpenVINO element type."); + OPENVINO_THROW("Unsupported OpenVINO element type."); } return index_vec; diff --git a/src/core/template_extension/old/fft_op.cpp b/src/core/template_extension/old/fft_op.cpp index 5dd54889120..df33379027a 100644 --- a/src/core/template_extension/old/fft_op.cpp +++ b/src/core/template_extension/old/fft_op.cpp @@ -19,7 +19,7 @@ void FFTOp::validate_and_infer_types() { std::shared_ptr FFTOp::clone_with_new_inputs(const ngraph::OutputVector& new_args) const { if (new_args.size() != 1) { - throw ngraph::ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } return std::make_shared(new_args.at(0), inverse); } diff --git a/src/core/template_extension/old/op.cpp b/src/core/template_extension/old/op.cpp index a1d321c54c3..ae0c0b677bb 100644 --- a/src/core/template_extension/old/op.cpp +++ b/src/core/template_extension/old/op.cpp @@ -22,7 +22,7 @@ void Operation::validate_and_infer_types() { //! [op:copy] std::shared_ptr Operation::clone_with_new_inputs(const ngraph::OutputVector& new_args) const { if (new_args.size() != 1) { - throw ngraph::ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } return std::make_shared(new_args.at(0), add); diff --git a/src/core/tests/control_dependencies.cpp b/src/core/tests/control_dependencies.cpp index 20557380ee1..2ccb6d0d3e8 100644 --- a/src/core/tests/control_dependencies.cpp +++ b/src/core/tests/control_dependencies.cpp @@ -37,7 +37,7 @@ public: ControlDependencyOp(const OutputVector& args, const std::set>& deps) : Op(args) { if (args.size() == 0 && deps.size() == 0) { - throw ngraph_error("Expected some arguments or dependencies"); + OPENVINO_THROW("Expected some arguments or dependencies"); } for (auto& node : deps) { diff --git a/src/core/tests/graph_rewrite.cpp b/src/core/tests/graph_rewrite.cpp index d85146b1ffd..30a4e2db12c 100644 --- a/src/core/tests/graph_rewrite.cpp +++ b/src/core/tests/graph_rewrite.cpp @@ -409,7 +409,7 @@ public: */ auto cnt = consumers(node.get()); if (node.use_count() != cnt + 7) { - throw ngraph::ngraph_error("Wrong number of consumers"); + OPENVINO_THROW("Wrong number of consumers"); } NodeVector nodes; @@ -423,7 +423,7 @@ public: */ for (const auto& input_node : nodes) { if (input_node.use_count() != consumers(input_node.get()) + 1) { - throw ngraph::ngraph_error("Wrong number of consumers"); + OPENVINO_THROW("Wrong number of consumers"); } } return false; diff --git a/src/core/tests/preprocess.cpp b/src/core/tests/preprocess.cpp index d714108aae9..ad025d27041 100644 --- a/src/core/tests/preprocess.cpp +++ b/src/core/tests/preprocess.cpp @@ -1977,7 +1977,7 @@ TEST(pre_post_process, exception_safety) { .tensor() .set_color_format(ColorFormat::NV12_TWO_PLANES); p.input().preprocess().custom([](const Output& node) -> Output { - throw ngraph::ngraph_error("test error"); + OPENVINO_THROW("test error"); }); p.build(), ov::AssertFailure); @@ -1989,7 +1989,7 @@ TEST(pre_post_process, exception_safety) { p.output(1) // This one is not .postprocess() .custom([](const Output& node) -> Output { - throw ngraph::ngraph_error("test error"); + OPENVINO_THROW("test error"); }); p.build(), ngraph::ngraph_error); EXPECT_EQ(f->get_parameters().size(), 2); diff --git a/src/core/tests/type_prop/reduce_ops.hpp b/src/core/tests/type_prop/reduce_ops.hpp index 7ca2b5ab6f8..28ad1607032 100644 --- a/src/core/tests/type_prop/reduce_ops.hpp +++ b/src/core/tests/type_prop/reduce_ops.hpp @@ -26,7 +26,7 @@ static std::shared_ptr makeReduceOp(const ReduceParams& p, bool axes_as_pa in_axes = make_shared(p.axes_et, p.axes_ps); } else { if (shape_size(p.axes_ps) != p.axes.size()) { - throw ngraph_error("Axes shape does not match with axes elements"); + OPENVINO_THROW("Axes shape does not match with axes elements"); } in_axes = make_shared(p.axes_et, p.axes_ps, p.axes); } diff --git a/src/frontends/common/include/openvino/frontend/exception.hpp b/src/frontends/common/include/openvino/frontend/exception.hpp index 4fdb3c316a5..dfdee0aeebd 100644 --- a/src/frontends/common/include/openvino/frontend/exception.hpp +++ b/src/frontends/common/include/openvino/frontend/exception.hpp @@ -14,36 +14,52 @@ namespace ov { namespace frontend { class FRONTEND_API GeneralFailure : public AssertFailure { public: - GeneralFailure(const CheckLocInfo& check_loc_info, const std::string& context, const std::string& explanation) - : AssertFailure(check_loc_info, "FrontEnd API failed with GeneralFailure: " + context, explanation) {} + [[noreturn]] static void create(const CheckLocInfo& check_loc_info, + const std::string& context_info, + const std::string& explanation); + +protected: + explicit GeneralFailure(const std::string& what_arg) : ov::AssertFailure(what_arg) {} }; class FRONTEND_API InitializationFailure : public AssertFailure { public: - InitializationFailure(const CheckLocInfo& check_loc_info, - const std::string& context, - const std::string& explanation) - : AssertFailure(check_loc_info, "FrontEnd API failed with InitializationFailure: " + context, explanation) {} + [[noreturn]] static void create(const CheckLocInfo& check_loc_info, + const std::string& context_info, + const std::string& explanation); + +protected: + explicit InitializationFailure(const std::string& what_arg) : ov::AssertFailure(what_arg) {} }; class FRONTEND_API OpValidationFailure : public AssertFailure { public: - OpValidationFailure(const CheckLocInfo& check_loc_info, const std::string& context, const std::string& explanation) - : AssertFailure(check_loc_info, "FrontEnd API failed with OpValidationFailure: " + context, explanation) {} + [[noreturn]] static void create(const CheckLocInfo& check_loc_info, + const std::string& context_info, + const std::string& explanation); + +protected: + explicit OpValidationFailure(const std::string& what_arg) : ov::AssertFailure(what_arg) {} }; class FRONTEND_API OpConversionFailure : public AssertFailure { public: - OpConversionFailure(const CheckLocInfo& check_loc_info, const std::string& context, const std::string& explanation) - : AssertFailure(check_loc_info, "FrontEnd API failed with OpConversionFailure: " + context, explanation) {} + [[noreturn]] static void create(const CheckLocInfo& check_loc_info, + const std::string& context_info, + const std::string& explanation); + +protected: + explicit OpConversionFailure(const std::string& what_arg) : ov::AssertFailure(what_arg) {} }; class FRONTEND_API NotImplementedFailure : public AssertFailure { public: - NotImplementedFailure(const CheckLocInfo& check_loc_info, - const std::string& context, - const std::string& explanation) - : AssertFailure(check_loc_info, "FrontEnd API failed with NotImplementedFailure: " + context, explanation) {} + [[noreturn]] static void create(const CheckLocInfo& check_loc_info, + const std::string& context_info, + const std::string& explanation); + +protected: + explicit NotImplementedFailure(const std::string& what_arg) : ov::AssertFailure(what_arg) {} }; /// \brief Macro to check whether a boolean condition holds. diff --git a/src/frontends/common/src/exception.cpp b/src/frontends/common/src/exception.cpp new file mode 100644 index 00000000000..67ed9b25740 --- /dev/null +++ b/src/frontends/common/src/exception.cpp @@ -0,0 +1,40 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "openvino/frontend/exception.hpp" + +void ov::frontend::GeneralFailure::create(const CheckLocInfo& check_loc_info, + const std::string& context_info, + const std::string& explanation) { + throw ov::frontend::GeneralFailure( + make_what(check_loc_info, "FrontEnd API failed with GeneralFailure: " + context_info, explanation)); +} + +void ov::frontend::InitializationFailure::create(const CheckLocInfo& check_loc_info, + const std::string& context_info, + const std::string& explanation) { + throw ov::frontend::InitializationFailure( + make_what(check_loc_info, "FrontEnd API failed with InitializationFailure: " + context_info, explanation)); +} + +void ov::frontend::OpValidationFailure::create(const CheckLocInfo& check_loc_info, + const std::string& context_info, + const std::string& explanation) { + throw ov::frontend::OpValidationFailure( + make_what(check_loc_info, "FrontEnd API failed with OpValidationFailure: " + context_info, explanation)); +} + +void ov::frontend::OpConversionFailure::create(const CheckLocInfo& check_loc_info, + const std::string& context_info, + const std::string& explanation) { + throw ov::frontend::OpConversionFailure( + make_what(check_loc_info, "FrontEnd API failed with OpConversionFailure: " + context_info, explanation)); +} + +void ov::frontend::NotImplementedFailure::create(const CheckLocInfo& check_loc_info, + const std::string& context_info, + const std::string& explanation) { + throw ov::frontend::NotImplementedFailure( + make_what(check_loc_info, "FrontEnd API failed with NotImplementedFailure: " + context_info, explanation)); +} diff --git a/src/frontends/onnx/frontend/include/onnx_import/core/node.hpp b/src/frontends/onnx/frontend/include/onnx_import/core/node.hpp index 8ef171794b6..19170bfb0b3 100644 --- a/src/frontends/onnx/frontend/include/onnx_import/core/node.hpp +++ b/src/frontends/onnx/frontend/include/onnx_import/core/node.hpp @@ -22,8 +22,10 @@ namespace onnx_import { namespace error { namespace node { struct UnknownAttribute : ngraph_error { + OPENVINO_SUPPRESS_DEPRECATED_START explicit UnknownAttribute(const std::string& node, const std::string& name) : ngraph_error{"Node (" + node + "): unknown attribute \'" + name + "\'"} {} + OPENVINO_SUPPRESS_DEPRECATED_END }; } // namespace node diff --git a/src/frontends/onnx/frontend/src/core/attribute.hpp b/src/frontends/onnx/frontend/src/core/attribute.hpp index b21571eaa64..80e7cf10df4 100644 --- a/src/frontends/onnx/frontend/src/core/attribute.hpp +++ b/src/frontends/onnx/frontend/src/core/attribute.hpp @@ -27,9 +27,11 @@ using AttributeProto_AttributeType = decltype(ONNX_NAMESPACE::AttributeProto{}.t namespace error { namespace attribute { namespace detail { +OPENVINO_SUPPRESS_DEPRECATED_START struct Attribute : ngraph_error { Attribute(const std::string& msg, AttributeProto_AttributeType type) : ngraph_error{msg} {} }; +OPENVINO_SUPPRESS_DEPRECATED_END } // namespace detail diff --git a/src/frontends/onnx/frontend/src/core/graph.cpp b/src/frontends/onnx/frontend/src/core/graph.cpp index 5d46da8805e..5ce1350e541 100644 --- a/src/frontends/onnx/frontend/src/core/graph.cpp +++ b/src/frontends/onnx/frontend/src/core/graph.cpp @@ -375,7 +375,7 @@ OutputVector Graph::make_ng_nodes(const Node& onnx_node) { throw; } catch (const std::exception& exc) { std::string msg_prefix = error::detail::get_error_msg_prefix(onnx_node); - throw ngraph_error(msg_prefix + ":\n" + std::string(exc.what())); + OPENVINO_THROW(msg_prefix + ":\n" + std::string(exc.what())); } catch (...) { std::string msg_prefix = error::detail::get_error_msg_prefix(onnx_node); // Since we do not know anything about current exception data type we can only diff --git a/src/frontends/onnx/frontend/src/core/graph_cache.cpp b/src/frontends/onnx/frontend/src/core/graph_cache.cpp index 1fc68d47b3f..45fd899d4b6 100644 --- a/src/frontends/onnx/frontend/src/core/graph_cache.cpp +++ b/src/frontends/onnx/frontend/src/core/graph_cache.cpp @@ -22,7 +22,7 @@ Output GraphCache::get_node(const std::string& name) const { try { return m_graph_cache_map.at(name); } catch (const std::out_of_range&) { - throw ngraph_error(name + " node not found in graph cache"); + OPENVINO_THROW(name + " node not found in graph cache"); } } diff --git a/src/frontends/onnx/frontend/src/core/tensor.hpp b/src/frontends/onnx/frontend/src/core/tensor.hpp index 06dba8b3f8e..2f824949a32 100644 --- a/src/frontends/onnx/frontend/src/core/tensor.hpp +++ b/src/frontends/onnx/frontend/src/core/tensor.hpp @@ -29,6 +29,7 @@ using TensorProto_DataType = decltype(ONNX_NAMESPACE::TensorProto{}.data_type()) namespace error { namespace tensor { +OPENVINO_SUPPRESS_DEPRECATED_START struct invalid_data_type : ngraph_error { explicit invalid_data_type(TensorProto_DataType type) : ngraph_error{"invalid data type"} {} }; @@ -56,6 +57,7 @@ struct segments_unsupported : ngraph_error { struct shape_doesnt_match_data_size : ngraph_error { shape_doesnt_match_data_size() : ngraph_error{"tensor shape doesn't match data size"} {} }; +OPENVINO_SUPPRESS_DEPRECATED_END } // namespace tensor } // namespace error diff --git a/src/frontends/onnx/frontend/src/detail/subgraph_extraction.cpp b/src/frontends/onnx/frontend/src/detail/subgraph_extraction.cpp index e6a61ea032f..3274753ab38 100644 --- a/src/frontends/onnx/frontend/src/detail/subgraph_extraction.cpp +++ b/src/frontends/onnx/frontend/src/detail/subgraph_extraction.cpp @@ -95,8 +95,8 @@ int find_source_node_idx(const ONNX_NAMESPACE::GraphProto& graph, } } - throw ngraph::ngraph_error{"Source node not found in the graph for node: " + std::to_string(current_node_idx) + - " and input name: " + input_name}; + OPENVINO_THROW("Source node not found in the graph for node: " + std::to_string(current_node_idx) + + " and input name: " + input_name); } /// \brief Looks up a descriptor for a given tensor name. This descriptor contains inferred diff --git a/src/frontends/onnx/frontend/src/exceptions.cpp b/src/frontends/onnx/frontend/src/exceptions.cpp index ddc6ade8174..7db6c86f382 100644 --- a/src/frontends/onnx/frontend/src/exceptions.cpp +++ b/src/frontends/onnx/frontend/src/exceptions.cpp @@ -16,6 +16,12 @@ std::string get_error_msg_prefix(const Node& node) { return ss.str(); } } // namespace detail + +void OnnxNodeValidationFailure::create(const CheckLocInfo& check_loc_info, + const Node& node, + const std::string& explanation) { + throw OnnxNodeValidationFailure(make_what(check_loc_info, detail::get_error_msg_prefix(node), explanation)); +} } // namespace error } // namespace onnx_import } // namespace ngraph diff --git a/src/frontends/onnx/frontend/src/exceptions.hpp b/src/frontends/onnx/frontend/src/exceptions.hpp index 66fe13f8156..81add351b22 100644 --- a/src/frontends/onnx/frontend/src/exceptions.hpp +++ b/src/frontends/onnx/frontend/src/exceptions.hpp @@ -9,6 +9,7 @@ #include "ngraph/check.hpp" #include "ngraph/except.hpp" #include "onnx_import/core/node.hpp" +#include "openvino/core/except.hpp" #include "utils/tensor_external_data.hpp" namespace ngraph { @@ -18,17 +19,23 @@ namespace detail { std::string get_error_msg_prefix(const Node& node); } -class OnnxNodeValidationFailure : public CheckFailure { +class OnnxNodeValidationFailure : public ov::AssertFailure { public: - OnnxNodeValidationFailure(const CheckLocInfo& check_loc_info, const Node& node, const std::string& explanation) - : CheckFailure(check_loc_info, detail::get_error_msg_prefix(node), explanation) {} + [[noreturn]] static void create(const CheckLocInfo& check_loc_info, + const Node& node, + const std::string& explanation); + +protected: + explicit OnnxNodeValidationFailure(const std::string& what_arg) : ov::AssertFailure(what_arg) {} }; +OPENVINO_SUPPRESS_DEPRECATED_START struct invalid_external_data : ngraph_error { invalid_external_data(const onnx_import::detail::TensorExternalData& external_data) : ngraph_error{std::string{"invalid external data: "} + external_data.to_string()} {} invalid_external_data(const std::string& what_arg) : ngraph_error{what_arg} {} }; +OPENVINO_SUPPRESS_DEPRECATED_END } // namespace error @@ -37,4 +44,4 @@ struct invalid_external_data : ngraph_error { } // namespace ngraph #define CHECK_VALID_NODE(node_, cond_, ...) \ - NGRAPH_CHECK_HELPER(::ngraph::onnx_import::error::OnnxNodeValidationFailure, (node_), (cond_), ##__VA_ARGS__) + OPENVINO_ASSERT_HELPER(::ngraph::onnx_import::error::OnnxNodeValidationFailure, (node_), (cond_), ##__VA_ARGS__) diff --git a/src/frontends/onnx/frontend/src/onnx.cpp b/src/frontends/onnx/frontend/src/onnx.cpp index 8944fcb5fd3..227d28f803b 100644 --- a/src/frontends/onnx/frontend/src/onnx.cpp +++ b/src/frontends/onnx/frontend/src/onnx.cpp @@ -33,8 +33,8 @@ std::shared_ptr import_onnx_model(const std::string& file_path) { std::ifstream model_stream{file_path, std::ios::in | std::ios::binary}; if (!model_stream.is_open()) { - throw ngraph_error("Error during import of ONNX model expected to be in file: " + file_path + - ". Could not open the file."); + OPENVINO_THROW("Error during import of ONNX model expected to be in file: " + file_path + + ". Could not open the file."); }; return import_onnx_model(model_stream, file_path); diff --git a/src/frontends/onnx/frontend/src/op/batch_norm.cpp b/src/frontends/onnx/frontend/src/op/batch_norm.cpp index 4b8cad3bca2..e644b00af99 100644 --- a/src/frontends/onnx/frontend/src/op/batch_norm.cpp +++ b/src/frontends/onnx/frontend/src/op/batch_norm.cpp @@ -46,7 +46,7 @@ OutputVector batch_norm(const Node& node) { saved_var}; } - throw ngraph_error("Cannot create OpenVINO batch norm with unsupported number of inputs"); + OPENVINO_THROW("Cannot create OpenVINO batch norm with unsupported number of inputs"); } } // namespace set_1 diff --git a/src/frontends/onnx/frontend/src/op/mod.cpp b/src/frontends/onnx/frontend/src/op/mod.cpp index 85b761d7217..331e7a9f319 100644 --- a/src/frontends/onnx/frontend/src/op/mod.cpp +++ b/src/frontends/onnx/frontend/src/op/mod.cpp @@ -30,7 +30,7 @@ OutputVector mod(const Node& node) { "must be set to 1."); output = {std::make_shared(dividend, divisor)}; } else { - throw ngraph_error("Unsupported value of 'fmod' attribute (should be: 0 or 1)"); + OPENVINO_THROW("Unsupported value of 'fmod' attribute (should be: 0 or 1)"); } return output; } diff --git a/src/frontends/onnx/frontend/src/op/pad.cpp b/src/frontends/onnx/frontend/src/op/pad.cpp index e3f71c1254e..aa26a8da2be 100644 --- a/src/frontends/onnx/frontend/src/op/pad.cpp +++ b/src/frontends/onnx/frontend/src/op/pad.cpp @@ -30,7 +30,7 @@ ngraph::op::PadMode get_pad_mode(std::string mode) { } else if (mode == "edge") { pad_mode = ngraph::op::PadMode::EDGE; } else { - throw ngraph::ngraph_error("Unsupported padding mode: [" + mode + "]"); + OPENVINO_THROW("Unsupported padding mode: [" + mode + "]"); } return pad_mode; diff --git a/src/frontends/onnx/frontend/src/op/quant_conv.cpp b/src/frontends/onnx/frontend/src/op/quant_conv.cpp index fa0787d3deb..299222de575 100644 --- a/src/frontends/onnx/frontend/src/op/quant_conv.cpp +++ b/src/frontends/onnx/frontend/src/op/quant_conv.cpp @@ -103,7 +103,7 @@ namespace ngraph if (bias.get_node()) { - throw ngraph_error( + OPENVINO_THROW( "Groups != 1 not supported for Quantized Convolution with " "bias."); } diff --git a/src/frontends/onnx/frontend/src/ops_bridge.hpp b/src/frontends/onnx/frontend/src/ops_bridge.hpp index fd4b024ffe0..128eda55bf2 100644 --- a/src/frontends/onnx/frontend/src/ops_bridge.hpp +++ b/src/frontends/onnx/frontend/src/ops_bridge.hpp @@ -12,11 +12,13 @@ #include "ngraph/except.hpp" #include "onnx_import/core/operator_set.hpp" +#include "openvino/core/deprecated.hpp" #include "version_range.hpp" namespace ngraph { namespace onnx_import { namespace error { +OPENVINO_SUPPRESS_DEPRECATED_START struct UnknownOperator : ngraph_error { UnknownOperator(const std::string& name, const std::string& domain) : ngraph_error{(domain.empty() ? "" : domain + ".") + name} {} @@ -31,6 +33,7 @@ struct UnsupportedVersion : ngraph_error { : ngraph_error{"Unsupported operator version: " + (domain.empty() ? "" : domain + ".") + name + ":" + std::to_string(version)} {} }; +OPENVINO_SUPPRESS_DEPRECATED_END } // namespace error diff --git a/src/frontends/onnx/frontend/src/utils/common.cpp b/src/frontends/onnx/frontend/src/utils/common.cpp index c2e2aeb12f7..94fc2d687da 100644 --- a/src/frontends/onnx/frontend/src/utils/common.cpp +++ b/src/frontends/onnx/frontend/src/utils/common.cpp @@ -43,7 +43,7 @@ const ngraph::element::Type& get_ngraph_element_type(int64_t onnx_type) { case ONNX_NAMESPACE::TensorProto_DataType_BFLOAT16: return element::bf16; } - throw ngraph_error("unsupported element type"); + OPENVINO_THROW("unsupported element type"); } std::shared_ptr get_monotonic_range_along_node_rank(const Output& value, diff --git a/src/frontends/onnx/onnx_common/src/parser.cpp b/src/frontends/onnx/onnx_common/src/parser.cpp index 4be16a7c0e6..5a837728211 100644 --- a/src/frontends/onnx/onnx_common/src/parser.cpp +++ b/src/frontends/onnx/onnx_common/src/parser.cpp @@ -18,7 +18,7 @@ ONNX_NAMESPACE::ModelProto parse_from_file(const std::string& file_path) { std::ifstream file_stream{file_path, std::ios::in | std::ios::binary}; if (!file_stream.is_open()) { - throw ngraph_error("Could not open the file: " + file_path); + OPENVINO_THROW("Could not open the file: " + file_path); }; auto model_proto = parse_from_istream(file_stream); @@ -32,7 +32,7 @@ ONNX_NAMESPACE::ModelProto parse_from_file(const std::wstring& file_path) { if (!file_stream.is_open()) { NGRAPH_SUPPRESS_DEPRECATED_START - throw ngraph_error("Could not open the file: " + file_util::wstring_to_string(file_path)); + OPENVINO_THROW("Could not open the file: " + file_util::wstring_to_string(file_path)); NGRAPH_SUPPRESS_DEPRECATED_END }; @@ -47,14 +47,14 @@ ONNX_NAMESPACE::ModelProto parse_from_istream(std::istream& model_stream) { model_stream.clear(); model_stream.seekg(0); if (!model_stream.good()) { - throw ngraph_error("Provided input stream has incorrect state."); + OPENVINO_THROW("Provided input stream has incorrect state."); } } ONNX_NAMESPACE::ModelProto model_proto; if (!model_proto.ParseFromIstream(&model_stream)) { - throw ngraph_error("Error during import of ONNX model provided as input stream " - " with binary protobuf message."); + OPENVINO_THROW("Error during import of ONNX model provided as input stream " + " with binary protobuf message."); } return model_proto; diff --git a/src/frontends/onnx/onnx_common/src/utils.cpp b/src/frontends/onnx/onnx_common/src/utils.cpp index 808c8148e1a..ad2c6c9ee6b 100644 --- a/src/frontends/onnx/onnx_common/src/utils.cpp +++ b/src/frontends/onnx/onnx_common/src/utils.cpp @@ -45,7 +45,7 @@ size_t get_onnx_data_size(int32_t onnx_type) { case ONNX_NAMESPACE::TensorProto_DataType_BFLOAT16: return sizeof(uint16_t); } - throw ngraph_error("unsupported element type"); + OPENVINO_THROW("unsupported element type"); } namespace { using namespace ONNX_NAMESPACE; @@ -73,7 +73,7 @@ element::Type_t onnx_to_ng_data_type(const TensorProto_DataType& onnx_type) { return pair.second == onnx_type; }); if (result == std::end(NG_2_ONNX_TYPES)) { - throw ngraph_error( + OPENVINO_THROW( "unsupported element type: " + ONNX_NAMESPACE::TensorProto_DataType_Name(static_cast(onnx_type))); } diff --git a/src/frontends/paddle/include/openvino/frontend/paddle/exception.hpp b/src/frontends/paddle/include/openvino/frontend/paddle/exception.hpp index 861c8524fed..a4ae59bdb79 100644 --- a/src/frontends/paddle/include/openvino/frontend/paddle/exception.hpp +++ b/src/frontends/paddle/include/openvino/frontend/paddle/exception.hpp @@ -14,8 +14,12 @@ class NodeContext; class OpValidationFailure : public ov::frontend::OpValidationFailure { public: - OpValidationFailure(const CheckLocInfo& check_loc_info, const NodeContext& node, const std::string& explanation) - : ov::frontend::OpValidationFailure(check_loc_info, get_error_msg_prefix_paddle(node), explanation) {} + [[noreturn]] static void create(const CheckLocInfo& check_loc_info, + const NodeContext& node, + const std::string& explanation); + +protected: + explicit OpValidationFailure(const std::string& what_arg) : ov::frontend::OpValidationFailure(what_arg) {} private: static std::string get_error_msg_prefix_paddle(const NodeContext& node); diff --git a/src/frontends/paddle/src/exception.cpp b/src/frontends/paddle/src/exception.cpp index ae082d448f7..fa4b14d29dc 100644 --- a/src/frontends/paddle/src/exception.cpp +++ b/src/frontends/paddle/src/exception.cpp @@ -14,6 +14,12 @@ std::string OpValidationFailure::get_error_msg_prefix_paddle(const paddle::NodeC ss << "While validating node '" << node.get_op_type() << '\''; return ss.str(); } + +void OpValidationFailure::create(const CheckLocInfo& check_loc_info, + const NodeContext& node, + const std::string& explanation) { + throw OpValidationFailure(make_what(check_loc_info, get_error_msg_prefix_paddle(node), explanation)); +} } // namespace paddle } // namespace frontend } // namespace ov diff --git a/src/inference/dev_api/openvino/runtime/iasync_infer_request.hpp b/src/inference/dev_api/openvino/runtime/iasync_infer_request.hpp index a49c07703e0..84705d082ac 100644 --- a/src/inference/dev_api/openvino/runtime/iasync_infer_request.hpp +++ b/src/inference/dev_api/openvino/runtime/iasync_infer_request.hpp @@ -228,9 +228,9 @@ private: state = m_state; switch (m_state) { case InferState::BUSY: - throw ov::Busy("Infer Request is busy"); + ov::Busy::create("Infer Request is busy"); case InferState::CANCELLED: - throw ov::Cancelled("Infer Request was canceled"); + ov::Cancelled::create("Infer Request was canceled"); case InferState::IDLE: { m_futures.erase(std::remove_if(std::begin(m_futures), std::end(m_futures), diff --git a/src/inference/include/openvino/runtime/exception.hpp b/src/inference/include/openvino/runtime/exception.hpp index 952f201c14b..bfda6d49a6f 100644 --- a/src/inference/include/openvino/runtime/exception.hpp +++ b/src/inference/include/openvino/runtime/exception.hpp @@ -14,7 +14,14 @@ namespace ov { * @ingroup ov_runtime_cpp_api */ class OPENVINO_RUNTIME_API Cancelled : public Exception { - using Exception::Exception; +public: + [[noreturn]] static void create(const std::string& explanation); + ~Cancelled() override; + +protected: + OPENVINO_SUPPRESS_DEPRECATED_START + explicit Cancelled(const std::string& what_arg) : ov::Exception(what_arg) {} + OPENVINO_SUPPRESS_DEPRECATED_END }; /** @@ -23,7 +30,14 @@ class OPENVINO_RUNTIME_API Cancelled : public Exception { * @ingroup ov_runtime_cpp_api */ class OPENVINO_RUNTIME_API Busy : public Exception { - using Exception::Exception; +public: + [[noreturn]] static void create(const std::string& explanation); + ~Busy() override; + +protected: + OPENVINO_SUPPRESS_DEPRECATED_START + explicit Busy(const std::string& what_arg) : ov::Exception(what_arg) {} + OPENVINO_SUPPRESS_DEPRECATED_END }; } // namespace ov diff --git a/src/inference/include/openvino/runtime/properties.hpp b/src/inference/include/openvino/runtime/properties.hpp index b2b81b51c24..2ad601bb93a 100644 --- a/src/inference/include/openvino/runtime/properties.hpp +++ b/src/inference/include/openvino/runtime/properties.hpp @@ -372,7 +372,7 @@ inline std::ostream& operator<<(std::ostream& os, const SchedulingCoreType& core case SchedulingCoreType::ECORE_ONLY: return os << "ECORE_ONLY"; default: - throw ov::Exception{"Unsupported core type!"}; + OPENVINO_THROW("Unsupported core type!"); } } @@ -386,7 +386,7 @@ inline std::istream& operator>>(std::istream& is, SchedulingCoreType& core_type) } else if (str == "ECORE_ONLY") { core_type = SchedulingCoreType::ECORE_ONLY; } else { - throw ov::Exception{"Unsupported core type: " + str}; + OPENVINO_THROW("Unsupported core type: ", str); } return is; } diff --git a/src/inference/src/dev/converter_utils.cpp b/src/inference/src/dev/converter_utils.cpp index e54b8f64d1e..455afd08c43 100644 --- a/src/inference/src/dev/converter_utils.cpp +++ b/src/inference/src/dev/converter_utils.cpp @@ -647,7 +647,7 @@ public: } catch (const ov::Cancelled&) { throw; } catch (const InferenceEngine::InferCancelled& e) { - throw ov::Cancelled{e.what()}; + ov::Cancelled::create(e.what()); } catch (const std::exception& ex) { OPENVINO_THROW(ex.what()); } catch (...) { @@ -658,7 +658,7 @@ public: try { return m_request->Wait(timeout.count()) == InferenceEngine::OK; } catch (const InferenceEngine::InferCancelled& e) { - throw ov::Cancelled{e.what()}; + ov::Cancelled::create(e.what()); } catch (const std::exception& ex) { OPENVINO_THROW(ex.what()); } catch (...) { diff --git a/src/inference/src/dev/iasync_infer_request.cpp b/src/inference/src/dev/iasync_infer_request.cpp index 25ab052e7fc..578b6fdb8c8 100644 --- a/src/inference/src/dev/iasync_infer_request.cpp +++ b/src/inference/src/dev/iasync_infer_request.cpp @@ -193,9 +193,9 @@ void ov::IAsyncInferRequest::check_state() const { std::lock_guard lock{m_mutex}; switch (m_state) { case InferState::BUSY: - throw ov::Busy("Infer Request is busy"); + ov::Busy::create("Infer Request is busy"); case InferState::CANCELLED: - throw ov::Cancelled("Infer Request was canceled"); + ov::Cancelled::create("Infer Request was canceled"); default: break; } diff --git a/src/inference/src/dev/make_tensor.cpp b/src/inference/src/dev/make_tensor.cpp index b74244513fe..d2b34ad6e1b 100644 --- a/src/inference/src/dev/make_tensor.cpp +++ b/src/inference/src/dev/make_tensor.cpp @@ -528,7 +528,7 @@ public: OPENVINO_ASSERT(!std::dynamic_pointer_cast(tensor)); } catch (const std::exception& ex) { - throw ov::Exception(ex.what()); + OPENVINO_THROW(ex.what()); } void setShape(const ie::SizeVector& dims) override { diff --git a/src/inference/src/dev/threading/cpu_map_scheduling.cpp b/src/inference/src/dev/threading/cpu_map_scheduling.cpp index 1ba22fb3090..7147a121264 100644 --- a/src/inference/src/dev/threading/cpu_map_scheduling.cpp +++ b/src/inference/src/dev/threading/cpu_map_scheduling.cpp @@ -34,7 +34,7 @@ std::vector> apply_scheduling_core_type(const ov::hint::Schedul } break; default: - throw ov::Exception{"Unsupported core type!"}; + OPENVINO_THROW("Unsupported core type!"); } return result_table; @@ -57,4 +57,4 @@ std::vector> apply_hyper_threading(bool input_value, return result_table; } -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/inference/src/exception.cpp b/src/inference/src/exception.cpp new file mode 100644 index 00000000000..27b17c3a5e2 --- /dev/null +++ b/src/inference/src/exception.cpp @@ -0,0 +1,17 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "openvino/runtime/exception.hpp" + +void ov::Cancelled::create(const std::string& explanation) { + throw ov::Cancelled(explanation); +} + +ov::Cancelled::~Cancelled() = default; + +void ov::Busy::create(const std::string& explanation) { + throw ov::Busy(explanation); +} + +ov::Busy::~Busy() = default; diff --git a/src/inference/src/infer_request.cpp b/src/inference/src/infer_request.cpp index 4e81056d22c..b546d56dfe2 100644 --- a/src/inference/src/infer_request.cpp +++ b/src/inference/src/infer_request.cpp @@ -21,7 +21,7 @@ try { \ __VA_ARGS__; \ } catch (const ::InferenceEngine::RequestBusy& ex) { \ - throw ov::Busy(ex.what()); \ + ov::Busy::create(ex.what()); \ } catch (const std::exception& ex) { \ OPENVINO_THROW(ex.what()); \ } catch (...) { \ @@ -234,7 +234,7 @@ void InferRequest::wait() { } catch (const ov::Cancelled&) { throw; } catch (const ie::InferCancelled& e) { - throw Cancelled{e.what()}; + Cancelled::create(e.what()); } catch (const std::exception& ex) { OPENVINO_THROW(ex.what()); } catch (...) { @@ -247,7 +247,7 @@ bool InferRequest::wait_for(const std::chrono::milliseconds timeout) { try { return _impl->wait_for(timeout); } catch (const ie::InferCancelled& e) { - throw Cancelled{e.what()}; + Cancelled::create(e.what()); } catch (const std::exception& ex) { OPENVINO_THROW(ex.what()); } catch (...) { diff --git a/src/inference/tests/functional/ngraph_reshape_tests.cpp b/src/inference/tests/functional/ngraph_reshape_tests.cpp index 5ff39130bc9..525d0bed6d0 100644 --- a/src/inference/tests/functional/ngraph_reshape_tests.cpp +++ b/src/inference/tests/functional/ngraph_reshape_tests.cpp @@ -182,7 +182,7 @@ public: std::shared_ptr clone_with_new_inputs(const ngraph::OutputVector& new_args) const override { if (new_args.size() != 1) { - throw ngraph::ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } return std::make_shared(new_args.at(0), test1, test2); diff --git a/src/inference/tests/functional/ov_extension_test.cpp b/src/inference/tests/functional/ov_extension_test.cpp index 37af0efbe3f..e02a45ae920 100644 --- a/src/inference/tests/functional/ov_extension_test.cpp +++ b/src/inference/tests/functional/ov_extension_test.cpp @@ -214,7 +214,7 @@ public: std::shared_ptr clone_with_new_inputs(const ngraph::OutputVector& new_args) const override { if (new_args.size() != 1) { - throw ngraph::ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } return std::make_shared(new_args.at(0)); diff --git a/src/plugins/intel_cpu/src/emitters/x64/cpu_generator.cpp b/src/plugins/intel_cpu/src/emitters/x64/cpu_generator.cpp index 2dad24ae632..bc3ce1c2d3f 100644 --- a/src/plugins/intel_cpu/src/emitters/x64/cpu_generator.cpp +++ b/src/plugins/intel_cpu/src/emitters/x64/cpu_generator.cpp @@ -182,5 +182,5 @@ ngraph::snippets::Generator::opRegType ov::intel_cpu::CPUGenerator::get_specific std::dynamic_pointer_cast(op)) return vec2vec; else - throw ov::Exception("Register type of the operation " + std::string(op->get_type_name()) + " isn't determined!"); + OPENVINO_THROW("Register type of the operation " + std::string(op->get_type_name()) + " isn't determined!"); } diff --git a/src/plugins/intel_cpu/src/emitters/x64/jit_snippets_emitters.cpp b/src/plugins/intel_cpu/src/emitters/x64/jit_snippets_emitters.cpp index 3612720f13b..aafc4d5b5fa 100644 --- a/src/plugins/intel_cpu/src/emitters/x64/jit_snippets_emitters.cpp +++ b/src/plugins/intel_cpu/src/emitters/x64/jit_snippets_emitters.cpp @@ -844,7 +844,7 @@ std::set> BrgemmEmitter::get_supported_precisions(con {element::u8, element::i8, element::u8}, {element::bf16, element::bf16, element::u8}}; default: - throw ov::Exception("BrgemmEmitter got BrgemmCPU node with unsupported type"); + OPENVINO_THROW("BrgemmEmitter got BrgemmCPU node with unsupported type"); } } diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/fully_connected.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/fully_connected.cpp index 23316961d10..dce8bf31bf0 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/fully_connected.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/fully_connected.cpp @@ -31,7 +31,7 @@ std::shared_ptr ov::intel_cpu::FullyConnectedNode::clone_with_new_ return std::make_shared(new_args.at(0), new_args.at(1), new_args.at(2), m_output_rank, m_output_type); } - throw ngraph::ngraph_error("Unsupported number of arguments for FullyConnected operation"); + OPENVINO_THROW("Unsupported number of arguments for FullyConnected operation"); } void ov::intel_cpu::FullyConnectedNode::validate_and_infer_types() { diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/power_static.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/power_static.cpp index 2a5cd2a8102..eacb0b53ee8 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/power_static.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/power_static.cpp @@ -17,7 +17,7 @@ ov::intel_cpu::PowerStaticNode::PowerStaticNode(const ngraph::Output &data std::shared_ptr ov::intel_cpu::PowerStaticNode::clone_with_new_inputs(const ngraph::OutputVector &new_args) const { INTERNAL_OP_SCOPE(PowerStaticNode_clone_with_new_inputs); if (new_args.size() != 1) { - throw ngraph::ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } return std::make_shared(new_args.at(0), this->power, this->scale, this->shift, this->m_output_type); diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_fq_rnn_to_quantized_rnn.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_fq_rnn_to_quantized_rnn.cpp index 4cfb98deb13..9bb4367f6f2 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_fq_rnn_to_quantized_rnn.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_fq_rnn_to_quantized_rnn.cpp @@ -162,7 +162,7 @@ ov::intel_cpu::ConvertFqRnnToQuantizedRnn::ConvertFqRnnToQuantizedRnn() { const float* input_scale_ptr = input_scale_constant->get_data_ptr(); if (*input_scale_ptr == 0.f) - throw ngraph::ngraph_error("Cannot handle zero input scale"); + OPENVINO_THROW("Cannot handle zero input scale"); const float input_scale = 1 / *input_scale_ptr; const std::vector weights_scales = weights_scale_constant->get_vector(); diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_matmul_to_fc.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_matmul_to_fc.cpp index a9c8b1147dc..6173b93ae52 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_matmul_to_fc.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_matmul_to_fc.cpp @@ -119,7 +119,7 @@ ov::intel_cpu::ConvertMatMulToFC::ConvertMatMulToFC() { auto aligned_a_rank = shape_a_aligned.rank(), aligned_b_rank = shape_b_aligned.rank(); if (aligned_a_rank.is_dynamic() || aligned_b_rank.is_dynamic() || aligned_a_rank.get_length() < 2 || aligned_b_rank.get_length() < 2) { - throw ngraph::ngraph_error("MatMul " + matmul->get_friendly_name() + " shapes are inconsistent."); + OPENVINO_THROW("MatMul " + matmul->get_friendly_name() + " shapes are inconsistent."); } // Transferring from MatMul representation: [B, I, K] * [B, K, O] = [B, I, O] diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_to_power_static.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_to_power_static.cpp index 1588aff87e9..2e4fe228434 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_to_power_static.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_to_power_static.cpp @@ -95,7 +95,7 @@ std::shared_ptr convert(const std::shared_ptr &node) { return std::make_shared(node->input(nonConstPort).get_source_output(), 1.f, value, 0.0f, node->output(0).get_element_type()); } else { - throw ngraph::ngraph_error("ConvertToPowerStatic: op type is not supported"); + OPENVINO_THROW("ConvertToPowerStatic: op type is not supported"); } } @@ -132,7 +132,7 @@ ov::intel_cpu::ConvertToPowerStatic::ConvertToPowerStatic() { return false; toReplace = convert(mult); } else { - throw ngraph::ngraph_error("ConvertToPowerStatic: op type is not supported"); + OPENVINO_THROW("ConvertToPowerStatic: op type is not supported"); } toReplace->set_friendly_name(node->get_friendly_name()); ngraph::copy_runtime_info(node, toReplace); diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.cpp index 67e85394063..5f52a3ad9da 100644 --- a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.cpp +++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.cpp @@ -105,7 +105,7 @@ std::shared_ptr BrgemmCPU::get_brgemm_copy() const { if (const auto buffer = ov::as_type_ptr(get_input_node_shared_ptr(1))) { return ov::as_type_ptr(buffer->get_input_node_shared_ptr(0)); } - throw ov::Exception("BrgemmCopyB hasn't been found!"); + OPENVINO_THROW("BrgemmCopyB hasn't been found!"); } size_t BrgemmCPU::get_offset_scratch() const { @@ -114,4 +114,4 @@ size_t BrgemmCPU::get_offset_scratch() const { } } // namespace intel_cpu -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/brgemm_to_brgemm_cpu.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/brgemm_to_brgemm_cpu.cpp index c1b8e2a4841..345b8d8f2c9 100644 --- a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/brgemm_to_brgemm_cpu.cpp +++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/brgemm_to_brgemm_cpu.cpp @@ -33,7 +33,7 @@ pass::BrgemmToBrgemmCPU::BrgemmToBrgemmCPU() { const auto brgemm = ov::as_type_ptr(node); const auto brgemm_plugin = ov::as_type_ptr(node); if (!brgemm || brgemm_plugin) - throw ov::Exception("BrgemmCPU cannot be in body before BrgemmToBrgemmCPU pass"); + OPENVINO_THROW("BrgemmCPU cannot be in body before BrgemmToBrgemmCPU pass"); if (brgemm->is_dynamic()) { return false; diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/fuse_load_store_and_convert.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/fuse_load_store_and_convert.cpp index 6571d719268..3d66f78310b 100644 --- a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/fuse_load_store_and_convert.cpp +++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/fuse_load_store_and_convert.cpp @@ -46,7 +46,7 @@ ov::intel_cpu::pass::FuseLoadConvert::FuseLoadConvert() { convert_truncation->get_destination_type(), load->get_count(), load->get_offset()); } else { - throw ngraph::ngraph_error( + OPENVINO_THROW( "Type of Convert op is undefined. Supports only fusing Load and ConvertTruncation or ConvertSaturation ops"); } @@ -95,7 +95,7 @@ ov::intel_cpu::pass::FuseStoreConvert::FuseStoreConvert() { convert_truncation->get_destination_type(), store->get_count(), store->get_offset()); } else { - throw ngraph::ngraph_error( + OPENVINO_THROW( "Type of Convert op is undefined. Supports only fusing Store and ConvertTruncation or ConvertSaturation ops"); } diff --git a/src/plugins/intel_cpu/src/utils/rt_info/memory_formats_attribute.hpp b/src/plugins/intel_cpu/src/utils/rt_info/memory_formats_attribute.hpp index 67ae9c8ab48..5d01b9fd581 100644 --- a/src/plugins/intel_cpu/src/utils/rt_info/memory_formats_attribute.hpp +++ b/src/plugins/intel_cpu/src/utils/rt_info/memory_formats_attribute.hpp @@ -43,7 +43,7 @@ public: } if (unique_mem_format.size() > 1) { - throw ngraph::ngraph_error( + OPENVINO_THROW( std::string(MemoryFormat::get_type_info_static().name) + " no rule defined for multiple values."); } diff --git a/src/plugins/intel_gna/legacy/src/ngraph_ops/convolution_ie.cpp b/src/plugins/intel_gna/legacy/src/ngraph_ops/convolution_ie.cpp index c5b7091add1..4495c060b89 100644 --- a/src/plugins/intel_gna/legacy/src/ngraph_ops/convolution_ie.cpp +++ b/src/plugins/intel_gna/legacy/src/ngraph_ops/convolution_ie.cpp @@ -170,7 +170,7 @@ shared_ptr op::ConvolutionIE::clone_with_new_inputs(const ngraph::OutputVe m_auto_pad); } - throw ngraph_error("Unsupported number of arguments for ConvolutionIE operation"); + OPENVINO_THROW("Unsupported number of arguments for ConvolutionIE operation"); } bool op::ConvolutionIE::visit_attributes(AttributeVisitor& visitor) { diff --git a/src/plugins/intel_gna/legacy/src/ngraph_ops/crop_ie.cpp b/src/plugins/intel_gna/legacy/src/ngraph_ops/crop_ie.cpp index 5a90d2779fa..fa5736b25ed 100644 --- a/src/plugins/intel_gna/legacy/src/ngraph_ops/crop_ie.cpp +++ b/src/plugins/intel_gna/legacy/src/ngraph_ops/crop_ie.cpp @@ -27,7 +27,7 @@ op::CropIE::CropIE(const Output& data, std::shared_ptr op::CropIE::clone_with_new_inputs(const OutputVector& new_args) const { if (new_args.size() != 1) { - throw ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } return make_shared(new_args.at(0), axes, dim, offset); diff --git a/src/plugins/intel_gna/legacy/src/ngraph_ops/deconvolution_ie.cpp b/src/plugins/intel_gna/legacy/src/ngraph_ops/deconvolution_ie.cpp index b8dac8ded3d..0c1bef5d736 100644 --- a/src/plugins/intel_gna/legacy/src/ngraph_ops/deconvolution_ie.cpp +++ b/src/plugins/intel_gna/legacy/src/ngraph_ops/deconvolution_ie.cpp @@ -140,7 +140,7 @@ shared_ptr op::DeconvolutionIE::clone_with_new_inputs(const ngraph::Output m_output_padding, m_output_shape); } - throw ngraph::ngraph_error("Unexpected number of arguments"); + OPENVINO_THROW("Unexpected number of arguments"); } bool op::DeconvolutionIE::visit_attributes(AttributeVisitor& visitor) { diff --git a/src/plugins/intel_gna/legacy/src/ngraph_ops/eltwise.cpp b/src/plugins/intel_gna/legacy/src/ngraph_ops/eltwise.cpp index 9f79a93f38b..1d80c3f7aa6 100644 --- a/src/plugins/intel_gna/legacy/src/ngraph_ops/eltwise.cpp +++ b/src/plugins/intel_gna/legacy/src/ngraph_ops/eltwise.cpp @@ -25,7 +25,7 @@ op::Eltwise::Eltwise(const Output& data1, std::shared_ptr op::Eltwise::clone_with_new_inputs(const OutputVector& new_args) const { if (new_args.size() != 2) { - throw ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } return make_shared(new_args.at(0), new_args.at(1), eltwise_type, m_output_type); diff --git a/src/plugins/intel_gna/legacy/src/ngraph_ops/nms_ie.cpp b/src/plugins/intel_gna/legacy/src/ngraph_ops/nms_ie.cpp index e3869735cf4..d9a0950aa8b 100644 --- a/src/plugins/intel_gna/legacy/src/ngraph_ops/nms_ie.cpp +++ b/src/plugins/intel_gna/legacy/src/ngraph_ops/nms_ie.cpp @@ -173,7 +173,7 @@ std::shared_ptr op::NonMaxSuppressionIE3::clone_with_new_inputs(const ngra m_sort_result_descending, m_output_type); } - throw ngraph::ngraph_error("Unsupported number of inputs: " + std::to_string(new_args.size())); + OPENVINO_THROW("Unsupported number of inputs: " + std::to_string(new_args.size())); } bool op::NonMaxSuppressionIE3::visit_attributes(AttributeVisitor& visitor) { diff --git a/src/plugins/intel_gna/legacy/src/ngraph_ops/pad_ie.cpp b/src/plugins/intel_gna/legacy/src/ngraph_ops/pad_ie.cpp index d21e2a38fb2..dc354b36ed5 100644 --- a/src/plugins/intel_gna/legacy/src/ngraph_ops/pad_ie.cpp +++ b/src/plugins/intel_gna/legacy/src/ngraph_ops/pad_ie.cpp @@ -26,10 +26,10 @@ op::PadIE::PadIE(const std::shared_ptr& pad) auto const_node = std::dynamic_pointer_cast(pad->input(3).get_source_output().get_node_shared_ptr()); if (!const_node) { - throw ngraph_error("Pad " + pad->get_friendly_name() + " with not constant pad_value is not allowed"); + OPENVINO_THROW("Pad " + pad->get_friendly_name() + " with not constant pad_value is not allowed"); } if (!ov::op::util::get_single_value(const_node, m_pad_value)) { - throw ngraph_error("Unsupported pad value"); + OPENVINO_THROW("Unsupported pad value"); } } constructor_validate_and_infer_types(); diff --git a/src/plugins/intel_gna/legacy/src/ngraph_ops/power.cpp b/src/plugins/intel_gna/legacy/src/ngraph_ops/power.cpp index 119308e779e..e62301f0df2 100644 --- a/src/plugins/intel_gna/legacy/src/ngraph_ops/power.cpp +++ b/src/plugins/intel_gna/legacy/src/ngraph_ops/power.cpp @@ -27,7 +27,7 @@ op::PowerIE::PowerIE(const Output& data_batch, std::shared_ptr op::PowerIE::clone_with_new_inputs(const OutputVector& new_args) const { if (new_args.size() != 1) { - throw ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } return make_shared(new_args.at(0), this->power, this->scale, this->shift, this->m_output_type); diff --git a/src/plugins/intel_gna/legacy/src/ngraph_ops/scaleshift.cpp b/src/plugins/intel_gna/legacy/src/ngraph_ops/scaleshift.cpp index c4b52480026..ee098a67fcf 100644 --- a/src/plugins/intel_gna/legacy/src/ngraph_ops/scaleshift.cpp +++ b/src/plugins/intel_gna/legacy/src/ngraph_ops/scaleshift.cpp @@ -41,7 +41,7 @@ op::ScaleShiftIE::ScaleShiftIE(const Output& data_batch, std::shared_ptr op::ScaleShiftIE::clone_with_new_inputs(const OutputVector& new_args) const { if (new_args.size() != 3) { - throw ngraph_error("Incorrect number of new arguments"); + OPENVINO_THROW("Incorrect number of new arguments"); } return make_shared(new_args.at(0), new_args.at(1), new_args.at(2), output_type); diff --git a/src/plugins/intel_gna/legacy/src/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.cpp b/src/plugins/intel_gna/legacy/src/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.cpp index 3f580e0dc38..03705229b24 100644 --- a/src/plugins/intel_gna/legacy/src/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.cpp +++ b/src/plugins/intel_gna/legacy/src/transformations/convert_opset1_to_legacy/convert_matmul_to_fc_or_gemm.cpp @@ -65,7 +65,7 @@ ngraph::pass::ConvertMatMulToFC::ConvertMatMulToFC() { if (shape_a_aligned[i] != shape_b_aligned[i] && shape_a_aligned[i] > 1 && shape_b_aligned[i] > 1) { std::ostringstream stream; stream << "Shapes can't be aligned: " << shape_a_aligned << " " << shape_b_aligned; - throw ngraph_error(stream.str()); + OPENVINO_THROW(stream.str()); } size_t max_value = std::max(shape_a_aligned[i], shape_b_aligned[i]); shape_a_aligned[i] = shape_b_aligned[i] = max_value; @@ -119,7 +119,7 @@ ngraph::pass::ConvertMatMulToFC::ConvertMatMulToFC() { std::tie(shape_a_aligned, shape_b_aligned) = get_aligned_shapes(); if (shape_a_aligned.size() < 2 || shape_b_aligned.size() < 2) { - throw ngraph_error("MatMul " + matmul->get_friendly_name() + " shapes are inconsistent."); + OPENVINO_THROW("MatMul " + matmul->get_friendly_name() + " shapes are inconsistent."); } // Transferring from MatMul representation: [B, I, K] * [B, K, O] = [B, I, O] diff --git a/src/plugins/intel_gna/legacy/src/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.cpp b/src/plugins/intel_gna/legacy/src/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.cpp index 3817974bf75..ef3954955ef 100644 --- a/src/plugins/intel_gna/legacy/src/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.cpp +++ b/src/plugins/intel_gna/legacy/src/transformations/convert_opset1_to_legacy/convert_nms_5_to_legacy.cpp @@ -66,8 +66,7 @@ ngraph::pass::ConvertNMS5ToLegacyMatcher::ConvertNMS5ToLegacyMatcher(bool force_ center_point_box = 0; break; default: - throw ngraph_error("NonMaxSuppression layer " + nms_5->get_friendly_name() + - " has unsupported box encoding"); + OPENVINO_THROW("NonMaxSuppression layer " + nms_5->get_friendly_name() + " has unsupported box encoding"); } std::shared_ptr nms_legacy{nullptr}; diff --git a/src/plugins/intel_gna/legacy/src/transformations/convert_opset1_to_legacy/convert_nms_to_nms_ie.cpp b/src/plugins/intel_gna/legacy/src/transformations/convert_opset1_to_legacy/convert_nms_to_nms_ie.cpp index 40887fa7a16..c9a51136a91 100644 --- a/src/plugins/intel_gna/legacy/src/transformations/convert_opset1_to_legacy/convert_nms_to_nms_ie.cpp +++ b/src/plugins/intel_gna/legacy/src/transformations/convert_opset1_to_legacy/convert_nms_to_nms_ie.cpp @@ -77,7 +77,7 @@ ngraph::pass::ConvertNMSToNMSIEMatcher::ConvertNMSToNMSIEMatcher() { center_point_box = 0; break; default: - throw ngraph_error("NonMaxSuppression layer " + nms->get_friendly_name() + " has unsupported box encoding"); + OPENVINO_THROW("NonMaxSuppression layer " + nms->get_friendly_name() + " has unsupported box encoding"); } auto new_nms = std::make_shared(nms->input_value(0), nms->input_value(1), diff --git a/src/plugins/intel_gna/legacy/src/transformations/convert_opset1_to_legacy/reshape_1d_ops.cpp b/src/plugins/intel_gna/legacy/src/transformations/convert_opset1_to_legacy/reshape_1d_ops.cpp index 5ae7a71f37d..1c13d096e69 100644 --- a/src/plugins/intel_gna/legacy/src/transformations/convert_opset1_to_legacy/reshape_1d_ops.cpp +++ b/src/plugins/intel_gna/legacy/src/transformations/convert_opset1_to_legacy/reshape_1d_ops.cpp @@ -134,7 +134,7 @@ matcher_pass_callback get_callback() { } else if (auto avg_pool = std::dynamic_pointer_cast(node)) { last = convert(last, avg_pool, new_ops); } else { - throw ngraph_error("Reshape1DOps: op type is not supported"); + OPENVINO_THROW("Reshape1DOps: op type is not supported"); } last.get_node_shared_ptr()->set_friendly_name(node->get_friendly_name() + "/new"); diff --git a/src/plugins/intel_gna/legacy/tests/conv_fusion_test.cpp b/src/plugins/intel_gna/legacy/tests/conv_fusion_test.cpp index f2380edc59f..3998d77c595 100644 --- a/src/plugins/intel_gna/legacy/tests/conv_fusion_test.cpp +++ b/src/plugins/intel_gna/legacy/tests/conv_fusion_test.cpp @@ -80,7 +80,7 @@ private: } else if (eltwise_type == ngraph::opset5::Multiply::get_type_info_static()) { eltwise = std::make_shared(conv, const_node); } else { - throw ngraph::ngraph_error("Unsupported element type"); + OPENVINO_THROW("Unsupported element type"); } return std::make_shared(ngraph::NodeVector{eltwise.get_node_shared_ptr()}, @@ -121,7 +121,7 @@ private: std::make_shared(weights, ov::op::util::reshapeTo(const_node, const_shape)); conv = conv.get_node_shared_ptr()->copy_with_new_inputs({input, weights}); } else { - throw ngraph::ngraph_error("Unsupported element type"); + OPENVINO_THROW("Unsupported element type"); } return std::make_shared(ngraph::NodeVector{conv.get_node_shared_ptr()}, diff --git a/src/plugins/intel_gna/legacy/tests/mul_add_conversion_test.cpp b/src/plugins/intel_gna/legacy/tests/mul_add_conversion_test.cpp index 6e855ba8546..c1b935bce2a 100644 --- a/src/plugins/intel_gna/legacy/tests/mul_add_conversion_test.cpp +++ b/src/plugins/intel_gna/legacy/tests/mul_add_conversion_test.cpp @@ -85,7 +85,7 @@ public: const AddConstant& add_const, const IsDequantization& is_dequanization) { if (mul_const.skip && add_const.skip) { - throw ngraph::ngraph_error("Invalid arguments"); + OPENVINO_THROW("Invalid arguments"); } auto input = std::make_shared(ngraph::element::f32, input_shape); diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_engine.cpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_engine.cpp index 1fe556af93b..1825f4b2108 100644 --- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_engine.cpp +++ b/src/plugins/intel_gpu/src/runtime/ocl/ocl_engine.cpp @@ -38,8 +38,10 @@ cl::PFN_clCreateFromD3D11Buffer cl::BufferDX::pfn_clCreateFromD3D11Buffer = NULL namespace cldnn { namespace ocl { +OPENVINO_SUPPRESS_DEPRECATED_START ocl_error::ocl_error(cl::Error const& err) : ov::Exception("[GPU] " + std::string(err.what()) + std::string(", error code: ") + std::to_string(err.err())) {} +OPENVINO_SUPPRESS_DEPRECATED_END ocl_engine::ocl_engine(const device::ptr dev, runtime_types runtime_type) : engine(dev) { diff --git a/src/plugins/template/backend/ops/abs.cpp b/src/plugins/template/backend/ops/abs.cpp index aecf1ee8755..f33a935d26b 100644 --- a/src/plugins/template/backend/ops/abs.cpp +++ b/src/plugins/template/backend/ops/abs.cpp @@ -60,7 +60,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/adaptive_avg_pool.cpp b/src/plugins/template/backend/ops/adaptive_avg_pool.cpp index 2380f7a051f..42e414f0356 100644 --- a/src/plugins/template/backend/ops/adaptive_avg_pool.cpp +++ b/src/plugins/template/backend/ops/adaptive_avg_pool.cpp @@ -92,7 +92,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/adaptive_max_pool.cpp b/src/plugins/template/backend/ops/adaptive_max_pool.cpp index 3504e2cf84d..450c161eec6 100644 --- a/src/plugins/template/backend/ops/adaptive_max_pool.cpp +++ b/src/plugins/template/backend/ops/adaptive_max_pool.cpp @@ -103,7 +103,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/assign.cpp b/src/plugins/template/backend/ops/assign.cpp index 609b058092e..8cdef6c7677 100644 --- a/src/plugins/template/backend/ops/assign.cpp +++ b/src/plugins/template/backend/ops/assign.cpp @@ -58,7 +58,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/avg_pool.cpp b/src/plugins/template/backend/ops/avg_pool.cpp index 065e7fffcf6..82a21966866 100644 --- a/src/plugins/template/backend/ops/avg_pool.cpp +++ b/src/plugins/template/backend/ops/avg_pool.cpp @@ -67,7 +67,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/batch_norm.cpp b/src/plugins/template/backend/ops/batch_norm.cpp index 78890bf5793..f498a717e0f 100644 --- a/src/plugins/template/backend/ops/batch_norm.cpp +++ b/src/plugins/template/backend/ops/batch_norm.cpp @@ -112,8 +112,8 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -191,7 +191,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/binary_convolution.cpp b/src/plugins/template/backend/ops/binary_convolution.cpp index aa090e8eea9..5a5539d1de0 100644 --- a/src/plugins/template/backend/ops/binary_convolution.cpp +++ b/src/plugins/template/backend/ops/binary_convolution.cpp @@ -124,7 +124,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/bucketize.cpp b/src/plugins/template/backend/ops/bucketize.cpp index 2c2c793195b..c0ba7a1237f 100644 --- a/src/plugins/template/backend/ops/bucketize.cpp +++ b/src/plugins/template/backend/ops/bucketize.cpp @@ -211,7 +211,7 @@ bool evaluate_node(std::shared_ptr node outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/ceiling.cpp b/src/plugins/template/backend/ops/ceiling.cpp index 5a4bf39b255..09477f69890 100644 --- a/src/plugins/template/backend/ops/ceiling.cpp +++ b/src/plugins/template/backend/ops/ceiling.cpp @@ -61,7 +61,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/convert.cpp b/src/plugins/template/backend/ops/convert.cpp index d38becffc7c..c6d277198b2 100644 --- a/src/plugins/template/backend/ops/convert.cpp +++ b/src/plugins/template/backend/ops/convert.cpp @@ -163,7 +163,7 @@ bool evaluate_node(std::shared_ptr no outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/convert_color_nv12.cpp b/src/plugins/template/backend/ops/convert_color_nv12.cpp index 5b72ab49e95..3a523a61bde 100644 --- a/src/plugins/template/backend/ops/convert_color_nv12.cpp +++ b/src/plugins/template/backend/ops/convert_color_nv12.cpp @@ -114,8 +114,8 @@ bool evaluate_node(std::shared_ptr node outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -183,8 +183,8 @@ bool evaluate_node(std::shared_ptr node outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -252,8 +252,8 @@ bool evaluate_node(std::shared_ptr node outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -321,7 +321,7 @@ bool evaluate_node(std::shared_ptr node outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/convolution.cpp b/src/plugins/template/backend/ops/convolution.cpp index 84a5480456b..e526717bee7 100644 --- a/src/plugins/template/backend/ops/convolution.cpp +++ b/src/plugins/template/backend/ops/convolution.cpp @@ -103,7 +103,7 @@ bool evaluate_node(std::shared_ptr no outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/convolution_backprop_data.cpp b/src/plugins/template/backend/ops/convolution_backprop_data.cpp index 42002cf6c47..2c0cd812c42 100644 --- a/src/plugins/template/backend/ops/convolution_backprop_data.cpp +++ b/src/plugins/template/backend/ops/convolution_backprop_data.cpp @@ -109,7 +109,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/ctc_greedy_decoder.cpp b/src/plugins/template/backend/ops/ctc_greedy_decoder.cpp index 0da22f64f74..3c6ed1228f5 100644 --- a/src/plugins/template/backend/ops/ctc_greedy_decoder.cpp +++ b/src/plugins/template/backend/ops/ctc_greedy_decoder.cpp @@ -95,7 +95,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/ctc_greedy_decoder_seq_len.cpp b/src/plugins/template/backend/ops/ctc_greedy_decoder_seq_len.cpp index 80cad9d1c0a..888779b6683 100644 --- a/src/plugins/template/backend/ops/ctc_greedy_decoder_seq_len.cpp +++ b/src/plugins/template/backend/ops/ctc_greedy_decoder_seq_len.cpp @@ -150,7 +150,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/ctc_loss.cpp b/src/plugins/template/backend/ops/ctc_loss.cpp index 244561eb87d..904bf49b88c 100644 --- a/src/plugins/template/backend/ops/ctc_loss.cpp +++ b/src/plugins/template/backend/ops/ctc_loss.cpp @@ -109,7 +109,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/cum_sum.cpp b/src/plugins/template/backend/ops/cum_sum.cpp index 3457dc4a655..73566bdf012 100644 --- a/src/plugins/template/backend/ops/cum_sum.cpp +++ b/src/plugins/template/backend/ops/cum_sum.cpp @@ -82,7 +82,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/deformable_convolution.cpp b/src/plugins/template/backend/ops/deformable_convolution.cpp index 4550d683e51..d4ad5fdf9ce 100644 --- a/src/plugins/template/backend/ops/deformable_convolution.cpp +++ b/src/plugins/template/backend/ops/deformable_convolution.cpp @@ -164,8 +164,8 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -243,7 +243,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/deformable_psroi_pooling.cpp b/src/plugins/template/backend/ops/deformable_psroi_pooling.cpp index 9f078162bdf..689e49c3738 100644 --- a/src/plugins/template/backend/ops/deformable_psroi_pooling.cpp +++ b/src/plugins/template/backend/ops/deformable_psroi_pooling.cpp @@ -127,7 +127,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/detection_output.cpp b/src/plugins/template/backend/ops/detection_output.cpp index a8cbc56a554..5d27547003a 100644 --- a/src/plugins/template/backend/ops/detection_output.cpp +++ b/src/plugins/template/backend/ops/detection_output.cpp @@ -31,7 +31,7 @@ bool evaluate(const std::shared_ptr& op, inputs[4]->get_data_ptr(), outputs[0]->get_data_ptr()); } else { - throw ngraph::ngraph_error("DetectionOutput layer supports only 3 or 5 inputs"); + OPENVINO_THROW("DetectionOutput layer supports only 3 or 5 inputs"); } return true; } @@ -61,7 +61,7 @@ bool evaluate(const std::shared_ptr& op, inputs[4]->get_data_ptr(), outputs[0]->get_data_ptr()); } else { - throw ngraph::ngraph_error("DetectionOutput layer supports only 3 or 5 inputs"); + OPENVINO_THROW("DetectionOutput layer supports only 3 or 5 inputs"); } return true; } @@ -140,8 +140,8 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -219,7 +219,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/einsum.cpp b/src/plugins/template/backend/ops/einsum.cpp index cf339a8144a..b869d67e606 100644 --- a/src/plugins/template/backend/ops/einsum.cpp +++ b/src/plugins/template/backend/ops/einsum.cpp @@ -59,7 +59,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/elu.cpp b/src/plugins/template/backend/ops/elu.cpp index e492a7c0e55..60a2360522a 100644 --- a/src/plugins/template/backend/ops/elu.cpp +++ b/src/plugins/template/backend/ops/elu.cpp @@ -60,7 +60,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/embedding_bag_offsets_sum.cpp b/src/plugins/template/backend/ops/embedding_bag_offsets_sum.cpp index 429d0c337aa..b947afe3567 100644 --- a/src/plugins/template/backend/ops/embedding_bag_offsets_sum.cpp +++ b/src/plugins/template/backend/ops/embedding_bag_offsets_sum.cpp @@ -116,7 +116,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/embedding_bag_packed_sum.cpp b/src/plugins/template/backend/ops/embedding_bag_packed_sum.cpp index 01ff4188dba..85f4710aede 100644 --- a/src/plugins/template/backend/ops/embedding_bag_packed_sum.cpp +++ b/src/plugins/template/backend/ops/embedding_bag_packed_sum.cpp @@ -116,7 +116,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/embedding_segments_sum.cpp b/src/plugins/template/backend/ops/embedding_segments_sum.cpp index d28b06ac06a..b7c801fee26 100644 --- a/src/plugins/template/backend/ops/embedding_segments_sum.cpp +++ b/src/plugins/template/backend/ops/embedding_segments_sum.cpp @@ -117,7 +117,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/equal.cpp b/src/plugins/template/backend/ops/equal.cpp index 75c3c6b764f..980ad3f4624 100644 --- a/src/plugins/template/backend/ops/equal.cpp +++ b/src/plugins/template/backend/ops/equal.cpp @@ -71,7 +71,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/evaluate_node.hpp b/src/plugins/template/backend/ops/evaluate_node.hpp index a2c90435c86..8f766473969 100644 --- a/src/plugins/template/backend/ops/evaluate_node.hpp +++ b/src/plugins/template/backend/ops/evaluate_node.hpp @@ -4,6 +4,7 @@ #pragma once #include "ngraph/ops.hpp" +#include "openvino/core/except.hpp" template bool evaluate(std::shared_ptr op, @@ -54,7 +55,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/exp.cpp b/src/plugins/template/backend/ops/exp.cpp index 7eb6dae839f..6a902a490a8 100644 --- a/src/plugins/template/backend/ops/exp.cpp +++ b/src/plugins/template/backend/ops/exp.cpp @@ -59,7 +59,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/experimental_detectron_detection_output.cpp b/src/plugins/template/backend/ops/experimental_detectron_detection_output.cpp index 302c23f4b71..4ddbe6f196e 100644 --- a/src/plugins/template/backend/ops/experimental_detectron_detection_output.cpp +++ b/src/plugins/template/backend/ops/experimental_detectron_detection_output.cpp @@ -149,7 +149,7 @@ bool evaluate_node(std::sh outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/experimental_detectron_prior_grid_generator.cpp b/src/plugins/template/backend/ops/experimental_detectron_prior_grid_generator.cpp index b14ad90f25f..71e30d0fb27 100644 --- a/src/plugins/template/backend/ops/experimental_detectron_prior_grid_generator.cpp +++ b/src/plugins/template/backend/ops/experimental_detectron_prior_grid_generator.cpp @@ -178,7 +178,7 @@ bool evaluate_node(std: outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/experimental_detectron_proposal_single_image.cpp b/src/plugins/template/backend/ops/experimental_detectron_proposal_single_image.cpp index b0c3c367277..c8796bd46b6 100644 --- a/src/plugins/template/backend/ops/experimental_detectron_proposal_single_image.cpp +++ b/src/plugins/template/backend/ops/experimental_detectron_proposal_single_image.cpp @@ -15,9 +15,9 @@ bool evaluate(const std::shared_ptr(attrs.post_nms_count); } @@ -158,7 +158,7 @@ bool evaluate_nodeget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/experimental_detectron_roi_feature_extractor.cpp b/src/plugins/template/backend/ops/experimental_detectron_roi_feature_extractor.cpp index 5085b8c023d..d8b8ad31ac1 100644 --- a/src/plugins/template/backend/ops/experimental_detectron_roi_feature_extractor.cpp +++ b/src/plugins/template/backend/ops/experimental_detectron_roi_feature_extractor.cpp @@ -172,7 +172,7 @@ bool evaluate_node(std outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/experimental_detectron_topk_rois.cpp b/src/plugins/template/backend/ops/experimental_detectron_topk_rois.cpp index 27afece3f9b..ed745e7afed 100644 --- a/src/plugins/template/backend/ops/experimental_detectron_topk_rois.cpp +++ b/src/plugins/template/backend/ops/experimental_detectron_topk_rois.cpp @@ -112,7 +112,7 @@ bool evaluate_node(std::shared_pt outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/extract_image_patches.cpp b/src/plugins/template/backend/ops/extract_image_patches.cpp index 4937554f6bf..cb237c394b9 100644 --- a/src/plugins/template/backend/ops/extract_image_patches.cpp +++ b/src/plugins/template/backend/ops/extract_image_patches.cpp @@ -93,7 +93,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/fft.cpp b/src/plugins/template/backend/ops/fft.cpp index 12ade5b83ad..8fdbb1aea35 100644 --- a/src/plugins/template/backend/ops/fft.cpp +++ b/src/plugins/template/backend/ops/fft.cpp @@ -133,8 +133,8 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -180,7 +180,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/gather.cpp b/src/plugins/template/backend/ops/gather.cpp index 235cabd1da9..8d1cfa16a77 100644 --- a/src/plugins/template/backend/ops/gather.cpp +++ b/src/plugins/template/backend/ops/gather.cpp @@ -30,7 +30,7 @@ bool evaluate(const std::shared_ptr& op, op->get_axis(), op->get_batch_dims()); } else { - throw ngraph::ngraph_error("Unexpected indices type for Gather operation"); + OPENVINO_THROW("Unexpected indices type for Gather operation"); } return true; } @@ -79,7 +79,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/gather_elements.cpp b/src/plugins/template/backend/ops/gather_elements.cpp index 8ded6fa35d9..c1a51f4addb 100644 --- a/src/plugins/template/backend/ops/gather_elements.cpp +++ b/src/plugins/template/backend/ops/gather_elements.cpp @@ -33,7 +33,7 @@ bool evaluate(const std::shared_ptr& op, outputs[0]->get_shape(), op->get_axis()); } else { - throw ngraph::ngraph_error("Unexpected indices type"); + OPENVINO_THROW("Unexpected indices type"); } return true; @@ -113,7 +113,7 @@ bool evaluate_node(std::shared_ptr outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/gather_nd.cpp b/src/plugins/template/backend/ops/gather_nd.cpp index 5132f9839d8..53a3e85c70a 100644 --- a/src/plugins/template/backend/ops/gather_nd.cpp +++ b/src/plugins/template/backend/ops/gather_nd.cpp @@ -28,7 +28,7 @@ bool evaluate(const std::shared_ptr& op, outputs[0]->get_shape(), static_cast(op->get_batch_dims())); } else { - throw ngraph::ngraph_error("Unexpected indices type for GatherND operation"); + OPENVINO_THROW("Unexpected indices type for GatherND operation"); } return true; } @@ -55,7 +55,7 @@ bool evaluate(const std::shared_ptr& op, outputs[0]->get_shape(), static_cast(op->get_batch_dims())); } else { - throw ngraph::ngraph_error("Unexpected indices type for GatherND operation"); + OPENVINO_THROW("Unexpected indices type for GatherND operation"); } return true; } @@ -106,8 +106,8 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -157,7 +157,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/gather_tree.cpp b/src/plugins/template/backend/ops/gather_tree.cpp index a3a41c3310c..b4244ca4d4c 100644 --- a/src/plugins/template/backend/ops/gather_tree.cpp +++ b/src/plugins/template/backend/ops/gather_tree.cpp @@ -97,7 +97,7 @@ bool evaluate_node(std::shared_ptr nod outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/gelu.cpp b/src/plugins/template/backend/ops/gelu.cpp index dab74e10aa9..86eee2411f7 100644 --- a/src/plugins/template/backend/ops/gelu.cpp +++ b/src/plugins/template/backend/ops/gelu.cpp @@ -72,8 +72,8 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -119,7 +119,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/generate_proposal.cpp b/src/plugins/template/backend/ops/generate_proposal.cpp index 787f77fc838..a29a5ada513 100644 --- a/src/plugins/template/backend/ops/generate_proposal.cpp +++ b/src/plugins/template/backend/ops/generate_proposal.cpp @@ -14,9 +14,9 @@ bool evaluate(const std::shared_ptr& op, const auto& attrs = op->get_attrs(); if (attrs.post_nms_count < 0) { - throw ngraph::ngraph_error("The attribute post_nms_count of the operation " - "GenerateProposals must be a " - "nonnegative integer."); + OPENVINO_THROW("The attribute post_nms_count of the operation " + "GenerateProposals must be a " + "nonnegative integer."); } const auto& output_type = op->get_input_element_type(0); @@ -151,7 +151,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/greater.cpp b/src/plugins/template/backend/ops/greater.cpp index 50196a1c3a2..24598fec81d 100644 --- a/src/plugins/template/backend/ops/greater.cpp +++ b/src/plugins/template/backend/ops/greater.cpp @@ -71,7 +71,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/grid_sample.cpp b/src/plugins/template/backend/ops/grid_sample.cpp index 5665ec521e8..6b02f1b6769 100644 --- a/src/plugins/template/backend/ops/grid_sample.cpp +++ b/src/plugins/template/backend/ops/grid_sample.cpp @@ -103,7 +103,7 @@ bool evaluate_node(std::shared_ptr nod outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/grn.cpp b/src/plugins/template/backend/ops/grn.cpp index f53f3c22c18..3c4a912d0c6 100644 --- a/src/plugins/template/backend/ops/grn.cpp +++ b/src/plugins/template/backend/ops/grn.cpp @@ -60,7 +60,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/group_convolution.cpp b/src/plugins/template/backend/ops/group_convolution.cpp index 08c583992bc..468dbfc3b26 100644 --- a/src/plugins/template/backend/ops/group_convolution.cpp +++ b/src/plugins/template/backend/ops/group_convolution.cpp @@ -104,7 +104,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/group_convolution_backprop_data.cpp b/src/plugins/template/backend/ops/group_convolution_backprop_data.cpp index ed789041775..87e04b1e81b 100644 --- a/src/plugins/template/backend/ops/group_convolution_backprop_data.cpp +++ b/src/plugins/template/backend/ops/group_convolution_backprop_data.cpp @@ -121,7 +121,7 @@ bool evaluate_node(std::shared_ptr outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/gru_cell.cpp b/src/plugins/template/backend/ops/gru_cell.cpp index d1ac8d973c4..3b21397ce5b 100644 --- a/src/plugins/template/backend/ops/gru_cell.cpp +++ b/src/plugins/template/backend/ops/gru_cell.cpp @@ -98,8 +98,8 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -177,7 +177,7 @@ bool evaluate_node(std::shared_ptr no outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/hard_sigmoid.cpp b/src/plugins/template/backend/ops/hard_sigmoid.cpp index 90b1c5ae3e1..b0cbbb78742 100644 --- a/src/plugins/template/backend/ops/hard_sigmoid.cpp +++ b/src/plugins/template/backend/ops/hard_sigmoid.cpp @@ -94,7 +94,7 @@ bool evaluate_node(std::shared_ptr no outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/if.cpp b/src/plugins/template/backend/ops/if.cpp index 5791e530fdb..432f2a5db95 100644 --- a/src/plugins/template/backend/ops/if.cpp +++ b/src/plugins/template/backend/ops/if.cpp @@ -212,7 +212,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/interpolate.cpp b/src/plugins/template/backend/ops/interpolate.cpp index 3bda2009153..31fb71aa042 100644 --- a/src/plugins/template/backend/ops/interpolate.cpp +++ b/src/plugins/template/backend/ops/interpolate.cpp @@ -120,8 +120,8 @@ bool evaluate_node(std::shared_ptr no outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -424,7 +424,7 @@ bool evaluate_node(std::shared_ptr n outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } diff --git a/src/plugins/template/backend/ops/irdft.cpp b/src/plugins/template/backend/ops/irdft.cpp index 41cc273c596..e55af44664d 100644 --- a/src/plugins/template/backend/ops/irdft.cpp +++ b/src/plugins/template/backend/ops/irdft.cpp @@ -130,7 +130,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/is_finite.cpp b/src/plugins/template/backend/ops/is_finite.cpp index 0face34d4fb..2bfe8e509fe 100644 --- a/src/plugins/template/backend/ops/is_finite.cpp +++ b/src/plugins/template/backend/ops/is_finite.cpp @@ -105,7 +105,7 @@ bool evaluate_node(std::shared_ptr node outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/is_inf.cpp b/src/plugins/template/backend/ops/is_inf.cpp index 02369f9e193..a76aa74111d 100644 --- a/src/plugins/template/backend/ops/is_inf.cpp +++ b/src/plugins/template/backend/ops/is_inf.cpp @@ -87,7 +87,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/is_nan.cpp b/src/plugins/template/backend/ops/is_nan.cpp index 62bcfc71c01..adccf954d37 100644 --- a/src/plugins/template/backend/ops/is_nan.cpp +++ b/src/plugins/template/backend/ops/is_nan.cpp @@ -83,7 +83,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/log.cpp b/src/plugins/template/backend/ops/log.cpp index 55fea3e2f38..05bcb0abf29 100644 --- a/src/plugins/template/backend/ops/log.cpp +++ b/src/plugins/template/backend/ops/log.cpp @@ -59,7 +59,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/log_softmax.cpp b/src/plugins/template/backend/ops/log_softmax.cpp index dc208c70cda..6daa9e2a6a2 100644 --- a/src/plugins/template/backend/ops/log_softmax.cpp +++ b/src/plugins/template/backend/ops/log_softmax.cpp @@ -96,7 +96,7 @@ bool evaluate_node(std::shared_ptr nod outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/lrn.cpp b/src/plugins/template/backend/ops/lrn.cpp index 2a8c28b75bb..7a9b1148ed7 100644 --- a/src/plugins/template/backend/ops/lrn.cpp +++ b/src/plugins/template/backend/ops/lrn.cpp @@ -64,7 +64,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/lstm_cell.cpp b/src/plugins/template/backend/ops/lstm_cell.cpp index 5c4edb90f5f..b26b100eee1 100644 --- a/src/plugins/template/backend/ops/lstm_cell.cpp +++ b/src/plugins/template/backend/ops/lstm_cell.cpp @@ -109,8 +109,8 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -160,7 +160,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/matrix_nms.cpp b/src/plugins/template/backend/ops/matrix_nms.cpp index 1c3bf6de66e..fb8c8abdfc7 100644 --- a/src/plugins/template/backend/ops/matrix_nms.cpp +++ b/src/plugins/template/backend/ops/matrix_nms.cpp @@ -202,7 +202,7 @@ bool evaluate_node(std::shared_ptr node outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/mod.cpp b/src/plugins/template/backend/ops/mod.cpp index 408971095cb..4712e4a60d3 100644 --- a/src/plugins/template/backend/ops/mod.cpp +++ b/src/plugins/template/backend/ops/mod.cpp @@ -62,7 +62,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/multiclass_nms.cpp b/src/plugins/template/backend/ops/multiclass_nms.cpp index 6dbe7946585..74ff3a8477f 100644 --- a/src/plugins/template/backend/ops/multiclass_nms.cpp +++ b/src/plugins/template/backend/ops/multiclass_nms.cpp @@ -183,8 +183,8 @@ bool evaluate_node(std::shared_ptr outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -262,7 +262,7 @@ bool evaluate_node(std::shared_ptr outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/mvn.cpp b/src/plugins/template/backend/ops/mvn.cpp index 3eb361b1b21..62928864fc1 100644 --- a/src/plugins/template/backend/ops/mvn.cpp +++ b/src/plugins/template/backend/ops/mvn.cpp @@ -29,7 +29,7 @@ ngraph::AxisSet mvn_6_reduction_axes(const ngraph::HostTensorPtr& axes_input, si for (size_t i = 0; i < v.size(); i++) { if (v[i] < 0) { if (rank + v[i] < 0) { - throw ngraph::ngraph_error("Unexpected axis"); + OPENVINO_THROW("Unexpected axis"); } axes[i] = (size_t)(rank + v[i]); } else { @@ -52,7 +52,7 @@ bool evaluate(const std::shared_ptr& op, } else if (inputs[1]->get_element_type() == ngraph::element::i32) { reduction_axes = mvn_6_axes::mvn_6_reduction_axes(inputs[1], rank); } else { - throw ngraph::ngraph_error("Unexpected indices type"); + OPENVINO_THROW("Unexpected indices type"); } ngraph::runtime::reference::mvn_6(inputs[0]->get_data_ptr(), outputs[0]->get_data_ptr(), @@ -106,8 +106,8 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -153,7 +153,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/non_max_suppression.cpp b/src/plugins/template/backend/ops/non_max_suppression.cpp index 5c544977a2d..0923b0ff306 100644 --- a/src/plugins/template/backend/ops/non_max_suppression.cpp +++ b/src/plugins/template/backend/ops/non_max_suppression.cpp @@ -942,8 +942,8 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -1021,8 +1021,8 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -1100,8 +1100,8 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -1179,8 +1179,8 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -1258,7 +1258,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/normalize_l2.cpp b/src/plugins/template/backend/ops/normalize_l2.cpp index 522549da8d4..17cacfa9f03 100644 --- a/src/plugins/template/backend/ops/normalize_l2.cpp +++ b/src/plugins/template/backend/ops/normalize_l2.cpp @@ -94,7 +94,7 @@ bool evaluate_node(std::shared_ptr no outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/pad.cpp b/src/plugins/template/backend/ops/pad.cpp index 0784ffbe636..74270685584 100644 --- a/src/plugins/template/backend/ops/pad.cpp +++ b/src/plugins/template/backend/ops/pad.cpp @@ -64,7 +64,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/prelu.cpp b/src/plugins/template/backend/ops/prelu.cpp index 3202a9d7f0f..a5e615484df 100644 --- a/src/plugins/template/backend/ops/prelu.cpp +++ b/src/plugins/template/backend/ops/prelu.cpp @@ -63,7 +63,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/proposal.cpp b/src/plugins/template/backend/ops/proposal.cpp index 3b4b476d5dd..c802a250d75 100644 --- a/src/plugins/template/backend/ops/proposal.cpp +++ b/src/plugins/template/backend/ops/proposal.cpp @@ -88,8 +88,8 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -139,7 +139,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/psroi_pooling.cpp b/src/plugins/template/backend/ops/psroi_pooling.cpp index a3934b037bc..2279c87f2c5 100644 --- a/src/plugins/template/backend/ops/psroi_pooling.cpp +++ b/src/plugins/template/backend/ops/psroi_pooling.cpp @@ -71,7 +71,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/rdft.cpp b/src/plugins/template/backend/ops/rdft.cpp index c44103fc427..f97c2e35dea 100644 --- a/src/plugins/template/backend/ops/rdft.cpp +++ b/src/plugins/template/backend/ops/rdft.cpp @@ -119,7 +119,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/read_value.cpp b/src/plugins/template/backend/ops/read_value.cpp index 2109e9c3cb2..4a1926568d4 100644 --- a/src/plugins/template/backend/ops/read_value.cpp +++ b/src/plugins/template/backend/ops/read_value.cpp @@ -78,7 +78,7 @@ bool evaluate_node(std::shared_ptr node outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/region_yolo.cpp b/src/plugins/template/backend/ops/region_yolo.cpp index b3b33f65a3a..eb6c0d62402 100644 --- a/src/plugins/template/backend/ops/region_yolo.cpp +++ b/src/plugins/template/backend/ops/region_yolo.cpp @@ -96,7 +96,7 @@ bool evaluate_node(std::shared_ptr nod outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/relu.cpp b/src/plugins/template/backend/ops/relu.cpp index adbfb1d2bb5..af33162c06d 100644 --- a/src/plugins/template/backend/ops/relu.cpp +++ b/src/plugins/template/backend/ops/relu.cpp @@ -59,7 +59,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/reorg_yolo.cpp b/src/plugins/template/backend/ops/reorg_yolo.cpp index 94f5a72c904..bfe638204ed 100644 --- a/src/plugins/template/backend/ops/reorg_yolo.cpp +++ b/src/plugins/template/backend/ops/reorg_yolo.cpp @@ -82,7 +82,7 @@ bool evaluate_node(std::shared_ptr node outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/reverse_sequence.cpp b/src/plugins/template/backend/ops/reverse_sequence.cpp index 106c7672232..ebcdae623b3 100644 --- a/src/plugins/template/backend/ops/reverse_sequence.cpp +++ b/src/plugins/template/backend/ops/reverse_sequence.cpp @@ -143,7 +143,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/rnn_cell.cpp b/src/plugins/template/backend/ops/rnn_cell.cpp index 62e0f59dd55..86d80329dbb 100644 --- a/src/plugins/template/backend/ops/rnn_cell.cpp +++ b/src/plugins/template/backend/ops/rnn_cell.cpp @@ -71,7 +71,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/roi_align.cpp b/src/plugins/template/backend/ops/roi_align.cpp index cbb8a76efd5..b3947c00911 100644 --- a/src/plugins/template/backend/ops/roi_align.cpp +++ b/src/plugins/template/backend/ops/roi_align.cpp @@ -89,7 +89,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/roi_pooling.cpp b/src/plugins/template/backend/ops/roi_pooling.cpp index 5be1cc193ac..3631d6565db 100644 --- a/src/plugins/template/backend/ops/roi_pooling.cpp +++ b/src/plugins/template/backend/ops/roi_pooling.cpp @@ -97,7 +97,7 @@ bool evaluate_node(std::shared_ptr nod outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/roll.cpp b/src/plugins/template/backend/ops/roll.cpp index 7523bfabd54..40eef65c8cc 100644 --- a/src/plugins/template/backend/ops/roll.cpp +++ b/src/plugins/template/backend/ops/roll.cpp @@ -90,7 +90,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/scatter_nd_update.cpp b/src/plugins/template/backend/ops/scatter_nd_update.cpp index 114c88b56ba..c412e2d119b 100644 --- a/src/plugins/template/backend/ops/scatter_nd_update.cpp +++ b/src/plugins/template/backend/ops/scatter_nd_update.cpp @@ -29,7 +29,7 @@ bool evaluate(const std::shared_ptr& op, op->get_input_shape(1), op->get_input_shape(2)); } else { - throw ngraph::ngraph_error("ScatterNDUpdate layer support only i32 and i64 'indices' input precision!"); + OPENVINO_THROW("ScatterNDUpdate layer support only i32 and i64 'indices' input precision!"); } return true; } @@ -108,7 +108,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/selu.cpp b/src/plugins/template/backend/ops/selu.cpp index 637f2d5f85b..32749566392 100644 --- a/src/plugins/template/backend/ops/selu.cpp +++ b/src/plugins/template/backend/ops/selu.cpp @@ -63,7 +63,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/sequences.cpp b/src/plugins/template/backend/ops/sequences.cpp index 501aef548cd..d9e2499e669 100644 --- a/src/plugins/template/backend/ops/sequences.cpp +++ b/src/plugins/template/backend/ops/sequences.cpp @@ -331,8 +331,8 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -410,8 +410,8 @@ bool evaluate_node(std::shared_ptr no outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -489,8 +489,8 @@ bool evaluate_node(std::shared_ptr n outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -568,8 +568,8 @@ bool evaluate_node(std::shared_ptr n outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } @@ -647,7 +647,7 @@ bool evaluate_node(std::shared_ptr no outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/sigmoid.cpp b/src/plugins/template/backend/ops/sigmoid.cpp index 69e6e6e5438..81ee4c65562 100644 --- a/src/plugins/template/backend/ops/sigmoid.cpp +++ b/src/plugins/template/backend/ops/sigmoid.cpp @@ -61,7 +61,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/sign.cpp b/src/plugins/template/backend/ops/sign.cpp index 459b4f678ee..28b94df0d1a 100644 --- a/src/plugins/template/backend/ops/sign.cpp +++ b/src/plugins/template/backend/ops/sign.cpp @@ -59,7 +59,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/softsign.cpp b/src/plugins/template/backend/ops/softsign.cpp index e9e6786e33f..cdd1fff6768 100644 --- a/src/plugins/template/backend/ops/softsign.cpp +++ b/src/plugins/template/backend/ops/softsign.cpp @@ -84,7 +84,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/squared_difference.cpp b/src/plugins/template/backend/ops/squared_difference.cpp index 96d0f25cefd..d2749cbe56d 100644 --- a/src/plugins/template/backend/ops/squared_difference.cpp +++ b/src/plugins/template/backend/ops/squared_difference.cpp @@ -94,7 +94,7 @@ bool evaluate_node(std::shared_ptrget_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/tanh.cpp b/src/plugins/template/backend/ops/tanh.cpp index 41a95712988..3d4c654cc8d 100644 --- a/src/plugins/template/backend/ops/tanh.cpp +++ b/src/plugins/template/backend/ops/tanh.cpp @@ -60,7 +60,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/tensor_iterator.cpp b/src/plugins/template/backend/ops/tensor_iterator.cpp index 5fe757f3f31..b3c557a1114 100644 --- a/src/plugins/template/backend/ops/tensor_iterator.cpp +++ b/src/plugins/template/backend/ops/tensor_iterator.cpp @@ -130,7 +130,7 @@ bool evaluate_node(std::shared_ptr outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/plugins/template/backend/ops/unique.cpp b/src/plugins/template/backend/ops/unique.cpp index 109f057d637..9f9c0efd8ca 100644 --- a/src/plugins/template/backend/ops/unique.cpp +++ b/src/plugins/template/backend/ops/unique.cpp @@ -116,7 +116,7 @@ bool evaluate_node(std::shared_ptr node, case ngraph::element::Type_t::u64: return evaluate(ov::as_type_ptr(node), outputs, inputs); default: - throw ngraph::ngraph_error(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + - std::string("in evaluate_node()")); + OPENVINO_THROW(std::string("Unhandled data type ") + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } -} \ No newline at end of file +} diff --git a/src/tests/engines_util/test_case.hpp b/src/tests/engines_util/test_case.hpp index 2862103e98d..9d7bd9d6af0 100644 --- a/src/tests/engines_util/test_case.hpp +++ b/src/tests/engines_util/test_case.hpp @@ -25,7 +25,7 @@ inline std::string backend_name_to_device(const std::string& backend_name) { return "CPU"; if (backend_name == "IE_GPU") return "GPU"; - throw ngraph_error("Unsupported backend name"); + OPENVINO_THROW("Unsupported backend name"); } std::shared_ptr function_from_ir(const std::string& xml_path, const std::string& bin_path = {}); diff --git a/src/tests/functional/shared_test_classes/src/single_layer/experimental_detectron_detection_output.cpp b/src/tests/functional/shared_test_classes/src/single_layer/experimental_detectron_detection_output.cpp index 25c05eeced4..41d50506462 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/experimental_detectron_detection_output.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/experimental_detectron_detection_output.cpp @@ -164,7 +164,7 @@ void ExperimentalDetectronDetectionOutputLayerTest::generate_inputs( const auto& funcInputs = function->inputs(); for (auto i = 0ul; i < funcInputs.size(); ++i) { if (targetInputStaticShapes[i] != inputTensors[i].get_shape()) { - throw Exception("input shape is different from tensor shape"); + OPENVINO_THROW("input shape is different from tensor shape"); } inputs.insert({funcInputs[i].get_node_shared_ptr(), inputTensors[i]}); diff --git a/src/tests/functional/shared_test_classes/src/single_layer/experimental_detectron_generate_proposals_single_image.cpp b/src/tests/functional/shared_test_classes/src/single_layer/experimental_detectron_generate_proposals_single_image.cpp index f539a6b6f85..e499f12c384 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/experimental_detectron_generate_proposals_single_image.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/experimental_detectron_generate_proposals_single_image.cpp @@ -95,7 +95,7 @@ void ExperimentalDetectronGenerateProposalsSingleImageLayerTest::generate_inputs const auto& funcInputs = function->inputs(); for (auto i = 0ul; i < funcInputs.size(); ++i) { if (targetInputStaticShapes[i] != inputTensors.second[i].get_shape()) { - throw Exception("input shape is different from tensor shape"); + OPENVINO_THROW("input shape is different from tensor shape"); } inputs.insert({funcInputs[i].get_node_shared_ptr(), inputTensors.second[i]}); diff --git a/src/tests/functional/shared_test_classes/src/single_layer/experimental_detectron_prior_grid_generator.cpp b/src/tests/functional/shared_test_classes/src/single_layer/experimental_detectron_prior_grid_generator.cpp index 920d8fc4576..091bb5940d3 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/experimental_detectron_prior_grid_generator.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/experimental_detectron_prior_grid_generator.cpp @@ -90,7 +90,7 @@ void ExperimentalDetectronPriorGridGeneratorLayerTest::generate_inputs(const std auto i = 0ul; for (; i < inputTensors.second.size(); ++i) { if (targetInputStaticShapes[i] != inputTensors.second[i].get_shape()) { - throw Exception("input shape is different from tensor shape"); + OPENVINO_THROW("input shape is different from tensor shape"); } inputs.insert({funcInputs[i].get_node_shared_ptr(), inputTensors.second[i]}); diff --git a/src/tests/functional/shared_test_classes/src/single_layer/generate_proposals.cpp b/src/tests/functional/shared_test_classes/src/single_layer/generate_proposals.cpp index a8969ba2b82..aef1ac41cd2 100644 --- a/src/tests/functional/shared_test_classes/src/single_layer/generate_proposals.cpp +++ b/src/tests/functional/shared_test_classes/src/single_layer/generate_proposals.cpp @@ -115,7 +115,7 @@ void GenerateProposalsLayerTest::generate_inputs(const std::vectorinputs(); for (auto i = 0ul; i < funcInputs.size(); ++i) { if (targetInputStaticShapes[i] != inputTensors.second[i].get_shape()) { - throw Exception("input shape is different from tensor shape"); + OPENVINO_THROW("input shape is different from tensor shape"); } inputs.insert({funcInputs[i].get_node_shared_ptr(), inputTensors.second[i]}); diff --git a/src/tests/functional/shared_test_classes/src/subgraph/conv_eltwise_fusion.cpp b/src/tests/functional/shared_test_classes/src/subgraph/conv_eltwise_fusion.cpp index 23ed252de17..25d299211e3 100644 --- a/src/tests/functional/shared_test_classes/src/subgraph/conv_eltwise_fusion.cpp +++ b/src/tests/functional/shared_test_classes/src/subgraph/conv_eltwise_fusion.cpp @@ -59,7 +59,7 @@ void ConvEltwiseFusion::SetUp() { } else if (conv_type == ngraph::opset4::GroupConvolutionBackpropData::get_type_info_static()) { conv = std::make_shared(param, weights, strides, pad_begin, pad_end, strides); } else { - throw ngraph::ngraph_error("Unsupported type"); + OPENVINO_THROW("Unsupported type"); } std::shared_ptr eltwise; @@ -74,7 +74,7 @@ void ConvEltwiseFusion::SetUp() { // manager.register_pass(); // manager.register_pass(); } else { - throw ngraph::ngraph_error("Unsupported type"); + OPENVINO_THROW("Unsupported type"); } function = std::make_shared(ngraph::OutputVector{eltwise}, ngraph::ParameterVector{param}, "conv_eltwise"); diff --git a/src/tests/functional/shared_test_classes/src/subgraph/mul_conv_fusion.cpp b/src/tests/functional/shared_test_classes/src/subgraph/mul_conv_fusion.cpp index f26b1f8dd05..daafff76c72 100644 --- a/src/tests/functional/shared_test_classes/src/subgraph/mul_conv_fusion.cpp +++ b/src/tests/functional/shared_test_classes/src/subgraph/mul_conv_fusion.cpp @@ -50,7 +50,7 @@ void MulConvFusion::SetUp() { } else if (conv_type == ngraph::opset8::GroupConvolutionBackpropData::get_type_info_static()) { conv = std::make_shared(mul, weights, strides, pad_begin, pad_end, strides); } else { - throw ngraph::ngraph_error("Unsupported type"); + OPENVINO_THROW("Unsupported type"); } function = std::make_shared(ngraph::OutputVector{conv}, ngraph::ParameterVector{param}); @@ -116,7 +116,7 @@ void MulConvFusion::SetUp() { ASSERT_NE(nullptr, weights); conv = std::make_shared(param, weights, strides, pad_begin, pad_end, strides); } else { - throw ngraph::ngraph_error("Unsupported type"); + OPENVINO_THROW("Unsupported type"); } auto reference_function = std::make_shared(ngraph::OutputVector{conv}, ngraph::ParameterVector{param}); std::tie(functions_equal, std::ignore) = compare_functions(cloned_function, reference_function, true); diff --git a/src/tests/ie_test_utils/common_test_utils/graph_comparator.cpp b/src/tests/ie_test_utils/common_test_utils/graph_comparator.cpp index d7f978dd04f..8e59437aaae 100644 --- a/src/tests/ie_test_utils/common_test_utils/graph_comparator.cpp +++ b/src/tests/ie_test_utils/common_test_utils/graph_comparator.cpp @@ -857,7 +857,7 @@ void check_rt_info(const std::shared_ptr& f) { auto err_msg = err_log.str(); if (!err_msg.empty()) { - throw ngraph::ngraph_error(err_msg); + OPENVINO_THROW(err_msg); } } diff --git a/src/tests/ie_test_utils/common_test_utils/graph_comparator.hpp b/src/tests/ie_test_utils/common_test_utils/graph_comparator.hpp index d8cd0a4c3d1..40f6c906db1 100644 --- a/src/tests/ie_test_utils/common_test_utils/graph_comparator.hpp +++ b/src/tests/ie_test_utils/common_test_utils/graph_comparator.hpp @@ -193,7 +193,7 @@ public: std::stringstream ss; ss << "Node: " << node->get_type_info() << " with name " << node->get_friendly_name() << " "; ss << "has non unique friendly name."; - throw ngraph_error(ss.str()); + OPENVINO_THROW(ss.str()); } unique_friendly_names.insert(node->get_friendly_name()); @@ -207,7 +207,7 @@ public: std::stringstream ss; ss << "Node: " << node->get_type_info() << " with name " << node->get_friendly_name() << " "; ss << "has non unique tensor name."; - throw ngraph_error(ss.str()); + OPENVINO_THROW(ss.str()); } unique_tensor_names.insert(tensor_names.begin(), tensor_names.end()); } @@ -223,7 +223,7 @@ public: auto node = r->input_value(0).get_node(); ss << "Tensor name: " << ref_name << " is missing in " << node->get_type_info() << " "; ss << "output(" << r->input_value(0).get_index() << ")"; - throw ngraph_error(ss.str()); + OPENVINO_THROW(ss.str()); } } @@ -237,13 +237,13 @@ public: std::stringstream ss; ss << "Output node names mismatch: " << cur_node_name << " and " << ref_node_name << " (reference)"; - throw ngraph_error(ss.str()); + OPENVINO_THROW(ss.str()); } } else if (cur_node_name != ref_node_name) { std::stringstream ss; ss << "Output node names are different: " << cur_node_name << " and " << ref_node_name << " (reference)"; - throw ngraph_error(ss.str()); + OPENVINO_THROW(ss.str()); } } } diff --git a/src/tests/util/all_close_f.cpp b/src/tests/util/all_close_f.cpp index 8bd174f0846..aa9f06c022d 100644 --- a/src/tests/util/all_close_f.cpp +++ b/src/tests/util/all_close_f.cpp @@ -164,7 +164,7 @@ bool test::close_f(double a, double b, int tolerance_bits, double min_signal) { vector float_distances(const vector& a, const vector& b, float min_signal) { if (a.size() != b.size()) { - throw ngraph_error("a.size() != b.size() for float_distances comparison."); + OPENVINO_THROW("a.size() != b.size() for float_distances comparison."); } vector distances(a.size()); for (size_t i = 0; i < a.size(); ++i) { @@ -176,7 +176,7 @@ vector float_distances(const vector& a, const vector& b, vector float_distances(const vector& a, const vector& b, double min_signal) { if (a.size() != b.size()) { - throw ngraph_error("a.size() != b.size() for float_distances comparison."); + OPENVINO_THROW("a.size() != b.size() for float_distances comparison."); } vector distances(a.size()); for (size_t i = 0; i < a.size(); ++i) { diff --git a/src/tests/util/float_util.cpp b/src/tests/util/float_util.cpp index f086d6bf046..4787b27b976 100644 --- a/src/tests/util/float_util.cpp +++ b/src/tests/util/float_util.cpp @@ -94,7 +94,7 @@ ngraph::bfloat16 ngraph::test::bits_to_bfloat16(const std::string& s) { unformatted.erase(remove_if(unformatted.begin(), unformatted.end(), ::isspace), unformatted.end()); if (unformatted.size() != 16) { - throw ngraph_error("Input length must be 16"); + OPENVINO_THROW("Input length must be 16"); } std::bitset<16> bs(unformatted); return bfloat16::from_bits(static_cast(bs.to_ulong())); @@ -105,7 +105,7 @@ ngraph::float16 ngraph::test::bits_to_float16(const std::string& s) { unformatted.erase(remove_if(unformatted.begin(), unformatted.end(), ::isspace), unformatted.end()); if (unformatted.size() != 16) { - throw ngraph_error("Input length must be 16"); + OPENVINO_THROW("Input length must be 16"); } std::bitset<16> bs(unformatted); return float16::from_bits(static_cast(bs.to_ulong())); @@ -116,7 +116,7 @@ float ngraph::test::bits_to_float(const std::string& s) { unformatted.erase(remove_if(unformatted.begin(), unformatted.end(), ::isspace), unformatted.end()); if (unformatted.size() != 32) { - throw ngraph_error("Input length must be 32"); + OPENVINO_THROW("Input length must be 32"); } std::bitset<32> bs(unformatted); FloatUnion fu; @@ -129,7 +129,7 @@ double ngraph::test::bits_to_double(const std::string& s) { unformatted.erase(remove_if(unformatted.begin(), unformatted.end(), ::isspace), unformatted.end()); if (unformatted.size() != 64) { - throw ngraph_error("Input length must be 64"); + OPENVINO_THROW("Input length must be 64"); } std::bitset<64> bs(unformatted); DoubleUnion du; diff --git a/src/tests/util/test_common.cpp b/src/tests/util/test_common.cpp index 183ae4fdba0..17ff8a78063 100644 --- a/src/tests/util/test_common.cpp +++ b/src/tests/util/test_common.cpp @@ -90,13 +90,13 @@ std::shared_ptr ModelAccessor::get_shared_info() const { if (auto f = m_function.lock()) { return f->m_shared_rt_info; } - throw ngraph::ngraph_error("Original model is not available"); + OPENVINO_THROW("Original model is not available"); } std::set> NodeAccessor::get_shared_info() const { if (auto node = m_node.lock()) { return node->m_shared_rt_info; } - throw ngraph::ngraph_error("Original node is not available"); + OPENVINO_THROW("Original node is not available"); } } // namespace ov