Fix klocwork issues in pruning transformation (#6175)

* Fix klockwork issues in pruning transformation

* Fixed tabs
This commit is contained in:
Maria Kaglinskaya
2021-06-17 16:11:31 +03:00
committed by GitHub
parent 64bc081abc
commit 58dd421d58
2 changed files with 10 additions and 2 deletions

View File

@@ -96,7 +96,8 @@ public:
auto mask_2_iter = mask->rbegin();
while (mask_1_iter != rend() &&
mask_2_iter != mask->rend()) {
mask_2_iter != mask->rend() &&
result_iter != result_mask->rend()) {
// Merge mask dimension values for both masks
// Example: (MaskValue[1,2,3,4], MaskValue[2,3]) -> MaskValue[2,3]
for (const auto & value : *mask_1_iter) {
@@ -119,7 +120,8 @@ public:
auto mask_2_iter = mask->rbegin();
while (mask_1_iter != rend() &&
mask_2_iter != mask->rend()) {
mask_2_iter != mask->rend() &&
result_iter != result_mask->rend()) {
// Union mask dimension values for both masks
// Example: (MaskValue[1,2,3,4], MaskValue[2, 5]) -> MaskValue[1, 2, 3, 4, 5]
for (const auto & value : *mask_1_iter) {

View File

@@ -246,6 +246,9 @@ public:
// To allow pruning on weights (allow reshape input Group (0) dim changing) replace Reshape Shape constant
// [G, 1, 1, X, Y, Z] by [-1, 1, 1, X, Y, Z].
auto old_shape_const = std::dynamic_pointer_cast<opset6::Constant>(m_shape.get_node_shared_ptr());
if (!old_shape_const) {
return false;
}
auto shape_value = old_shape_const.get()->cast_vector<int64_t>();
shape_value[0] = -1;
auto new_const = opset6::Constant::create(old_shape_const->get_element_type(),
@@ -462,6 +465,9 @@ public:
const auto & pattern_map = m.get_pattern_value_map();
const auto & m_output = pattern_map.at(concat);
auto concat_ptr = std::dynamic_pointer_cast<opset6::Concat>(m_output.get_node_shared_ptr());
if (!concat_ptr) {
return false;
}
auto axis = concat_ptr->get_concatenation_axis();
auto inputs = concat_ptr->inputs();