Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[TF FE] Fix coverity issues (#30603)

Roman Kazantsev5561c207aba8
diff --git a/src/frontends/tensorflow/src/op/variable.cpp b/src/frontends/tensorflow/src/op/variable.cpp
index 1fee9bfa98a..d14f73f3447 100644
--- a/src/frontends/tensorflow/src/op/variable.cpp
+++ b/src/frontends/tensorflow/src/op/variable.cpp
@@ -47,7 +47,7 @@ OutputVector translate_variable_op(const NodeContext& node) {
const_node = make_shared<v0::Constant>(ov_tensor);
} else {
// data of unknown type
- auto const_node = make_shared<UnsupportedConstant>("Variable of unsupported type", node.get_decoder());
+ const_node = make_shared<UnsupportedConstant>("Variable of unsupported type", node.get_decoder());
}
set_node_name(variable_name, const_node);
diff --git a/src/frontends/tensorflow_common/src/op/addN.cpp b/src/frontends/tensorflow_common/src/op/addN.cpp
index 678663d793f..a86453e8e91 100644
--- a/src/frontends/tensorflow_common/src/op/addN.cpp
+++ b/src/frontends/tensorflow_common/src/op/addN.cpp
@@ -18,6 +18,7 @@ namespace op {
OutputVector translate_add_n_op(const NodeContext& node) {
default_op_checks(node, 1, {"AddN", "ADD_N"}, true);
int num_size = static_cast<int>(node.get_input_size());
+ auto op_type = node.get_op_type();
auto result = node.get_input(0);
auto complex_type_mark = as_type_ptr<ComplexTypeMark>(result.get_node_shared_ptr());
if (complex_type_mark) {
@@ -27,6 +28,10 @@ OutputVector translate_add_n_op(const NodeContext& node) {
// converting all the inputs to complex type (simulating complex type) and adding them
for (int ind = 1; ind < num_size; ++ind) {
auto complex_type_mark_ind = as_type_ptr<ComplexTypeMark>(node.get_input(ind).get_node_shared_ptr());
+ TENSORFLOW_OP_VALIDATION(
+ node,
+ complex_type_mark_ind,
+ "Missing ComplexTypeMark for input #" + std::to_string(ind) + " to operation " + op_type);
result = make_shared<v1::Add>(result, complex_type_mark_ind->get_data());
}
auto complex_add_n = make_shared<ComplexTypeMark>(result, complex_part_type);
diff --git a/src/frontends/tensorflow_common/src/op/bias_add.cpp b/src/frontends/tensorflow_common/src/op/bias_add.cpp
index f9168cb4f2b..7356331e881 100644
--- a/src/frontends/tensorflow_common/src/op/bias_add.cpp
+++ b/src/frontends/tensorflow_common/src/op/bias_add.cpp
@@ -23,7 +23,7 @@ OutputVector translate_bias_add_op(const NodeContext& node) {
auto complex_type_mark_value = as_type_ptr<ComplexTypeMark>(value.get_node_shared_ptr());
auto complex_type_mark_bias = as_type_ptr<ComplexTypeMark>(bias.get_node_shared_ptr());
- auto complex_type_inputs = (complex_type_mark_value || complex_type_mark_bias) ? true : false;
+ auto complex_type_inputs = (complex_type_mark_value && complex_type_mark_bias) ? true : false;
// validations prior to processing
if (complex_type_inputs) {
// extractions for complex processing
diff --git a/src/frontends/tensorflow_common/src/op/pad.cpp b/src/frontends/tensorflow_common/src/op/pad.cpp
index 77b19a7cef9..074a8227007 100644
--- a/src/frontends/tensorflow_common/src/op/pad.cpp
+++ b/src/frontends/tensorflow_common/src/op/pad.cpp
@@ -84,6 +84,7 @@ OutputVector translate_pad_op(const NodeContext& node) {
OutputVector translate_padv2_op(const NodeContext& node) {
default_op_checks(node, 3, {"PadV2", "PADV2"}, true);
+ auto op_type = node.get_op_type();
auto input = node.get_input(0);
auto paddings = node.get_input(1);
auto constant_value = node.get_input(2);
@@ -98,6 +99,9 @@ OutputVector translate_padv2_op(const NodeContext& node) {
auto x_imag = make_shared<v8::Gather>(input, gather_index_imag, minus_one)->output(0);
auto constant_complex_type_mark = as_type_ptr<ComplexTypeMark>(constant_value.get_node_shared_ptr());
+ TENSORFLOW_OP_VALIDATION(node,
+ constant_complex_type_mark,
+ "Missing ComplexTypeMark for padding value to operation " + op_type);
auto constant_input = constant_complex_type_mark->get_data();
auto constant_value_real = make_shared<v8::Gather>(constant_input, gather_index_real, minus_one)->output(0);
auto constant_value_imag = make_shared<v8::Gather>(constant_input, gather_index_imag, minus_one)->output(0);