Fix Coverity CID 1529136, 1529124 (#21733)

* CID 1529136, fix auto makes a copy of PartialShape
- minor updates to reduce redundant Rank object creation

* CID 1529124 fix copy caused by auto
This commit is contained in:
Pawel Raasz authored and GitHub committed 2023-12-19 07:06:33 +00:00
1 parent a4e8f9d98c
commit 499a9694e5
2 files changed
+10 -9

No files matched your search

+1 -1
View File
@@ -759,7 +759,7 @@ void contract_two_inputs(ov::TensorVector& inputs,
std::vector<int64_t> unsqueeze_axis2;
for (const auto& sep_label2 : separate_labels2) {
OPENVINO_ASSERT(label_to_dim_map2.find(sep_label2) != label_to_dim_map2.end());
auto label_dims = label_to_dim_map2[sep_label2];
const auto& label_dims = label_to_dim_map2[sep_label2];
for (size_t dim_ind = 0; dim_ind < label_dims.size(); ++dim_ind) {
unsqueeze_axis1.push_back(unsqueeze_dim + static_cast<int64_t>(dim_ind));
}
+9 -8
View File
@@ -4,6 +4,7 @@
#include "openvino/op/mvn.hpp"
#include "compare.hpp"
#include "itt.hpp"
#include "openvino/reference/mvn.hpp"
@@ -91,20 +92,20 @@ ov::op::v6::MVN::MVN(const Output<Node>& data,
void ov::op::v6::MVN::validate_and_infer_types() {
OV_OP_SCOPE(v6_MVN_validate_and_infer_types);
const auto data = get_input_partial_shape(0);
const auto axes = get_input_partial_shape(1);
const auto& data = get_input_partial_shape(0);
const auto& axes = get_input_partial_shape(1);
if (axes.is_static()) {
NODE_VALIDATION_CHECK(this, is_vector(axes.to_shape()), "Expected 1D tensor for the 'axes' input. Got: ", axes);
NODE_VALIDATION_CHECK(
this,
data.rank().is_dynamic() || data.rank().get_length() >= static_cast<int64_t>(axes.get_shape()[0]),
"Expected rank for the 'data' input to be higher than axes shape. Got: ",
data);
const auto data_rank = data.rank();
NODE_VALIDATION_CHECK(this,
data_rank.is_dynamic() || cmp::ge(data_rank.get_length(), axes.get_shape()[0]),
"Expected rank for the 'data' input to be higher than axes shape. Got: ",
data);
}
set_output_type(0, get_input_element_type(0), get_input_partial_shape(0));
set_output_type(0, get_input_element_type(0), data);
}
std::shared_ptr<ov::Node> ov::op::v6::MVN::clone_with_new_inputs(const OutputVector& new_args) const {