Unverified Commit f5598012 authored by Scott Cyphers's avatar Scott Cyphers Committed by GitHub

Fix klocwork issues (#3020)

* Fix klocwork issues

* Need dynamic cast
parent c00553ba
...@@ -113,8 +113,8 @@ namespace ngraph ...@@ -113,8 +113,8 @@ namespace ngraph
Strides m_window_movement_strides; Strides m_window_movement_strides;
Shape m_padding_below; Shape m_padding_below;
Shape m_padding_above; Shape m_padding_above;
bool m_include_padding_in_avg_computation; bool m_include_padding_in_avg_computation{false};
PadType m_pad_type; PadType m_pad_type{PadType::EXPLICIT};
}; };
class AvgPoolBackprop : public Op class AvgPoolBackprop : public Op
...@@ -155,7 +155,7 @@ namespace ngraph ...@@ -155,7 +155,7 @@ namespace ngraph
Strides m_window_movement_strides; Strides m_window_movement_strides;
Shape m_padding_below; Shape m_padding_below;
Shape m_padding_above; Shape m_padding_above;
bool m_include_padding_in_avg_computation; bool m_include_padding_in_avg_computation{false};
}; };
} }
} }
...@@ -60,7 +60,7 @@ void op::ShuffleChannels::pre_validate_and_infer_types() ...@@ -60,7 +60,7 @@ void op::ShuffleChannels::pre_validate_and_infer_types()
size_t axis_zb = get_zero_based_axis(); size_t axis_zb = get_zero_based_axis();
NODE_VALIDATION_CHECK(this, NODE_VALIDATION_CHECK(this,
axis_zb >= 0 && axis_zb < shape.size(), axis_zb < shape.size(),
"The 'axis' parameter for ShuffleChannels has to point to one of the " "The 'axis' parameter for ShuffleChannels has to point to one of the "
"input tensor's shape dimensions."); "input tensor's shape dimensions.");
......
...@@ -64,11 +64,8 @@ NodeVector op::Unsqueeze::decompose_op() const ...@@ -64,11 +64,8 @@ NodeVector op::Unsqueeze::decompose_op() const
for (auto axis : axes) for (auto axis : axes)
{ {
NODE_VALIDATION_CHECK(this, NODE_VALIDATION_CHECK(
axis >= 0 && axis <= data_shape.size(), this, axis <= data_shape.size(), "provided 'axes' value ", axis, " is not valid.");
"provided 'axes' value ",
axis,
" is not valid.");
data_shape.insert(next(begin(data_shape), axis), 1); data_shape.insert(next(begin(data_shape), axis), 1);
} }
......
...@@ -54,7 +54,7 @@ namespace ngraph ...@@ -54,7 +54,7 @@ namespace ngraph
void set_index_element_type(const element::Type& index_element_type); void set_index_element_type(const element::Type& index_element_type);
protected: protected:
size_t m_axis; size_t m_axis{0};
element::Type m_index_element_type; element::Type m_index_element_type;
void validate_and_infer_types() override; void validate_and_infer_types() override;
......
...@@ -24,7 +24,7 @@ namespace ngraph ...@@ -24,7 +24,7 @@ namespace ngraph
namespace pass namespace pass
{ {
template <typename T> template <typename T>
NodeVector static explicit_broadcast(std::shared_ptr<T>& node) NodeVector explicit_broadcast(std::shared_ptr<T>& node)
{ {
NodeVector rc; NodeVector rc;
......
...@@ -2252,7 +2252,7 @@ void ngraph::runtime::cpu::pass::CPUQuantFusion::construct_quantized_matmul() ...@@ -2252,7 +2252,7 @@ void ngraph::runtime::cpu::pass::CPUQuantFusion::construct_quantized_matmul()
NGRAPH_DEBUG << "In callback for Qdot against node = " << m.get_match_root()->get_name(); NGRAPH_DEBUG << "In callback for Qdot against node = " << m.get_match_root()->get_name();
auto pattern_map = m.get_pattern_map(); auto pattern_map = m.get_pattern_map();
auto qdot = std::dynamic_pointer_cast<ngraph::op::QuantizedDot>(m.get_match_root()); auto qdot = std::static_pointer_cast<ngraph::op::QuantizedDot>(m.get_match_root());
auto input_0 = pattern_map[input0]; auto input_0 = pattern_map[input0];
auto input_1 = pattern_map[input1]; auto input_1 = pattern_map[input1];
auto scale_new = pattern_map[scale]; auto scale_new = pattern_map[scale];
......
...@@ -103,6 +103,10 @@ namespace ngraph ...@@ -103,6 +103,10 @@ namespace ngraph
auto updates_inner_coord_iter = updates_inner_transform.begin(); auto updates_inner_coord_iter = updates_inner_transform.begin();
for (const Coordinate& out_coord : out_transform) for (const Coordinate& out_coord : out_transform)
{ {
if (updates_inner_coord_iter == updates_inner_transform.end())
{
break;
}
out[out_transform.index(out_coord)] += out[out_transform.index(out_coord)] +=
updates[updates_inner_transform.index(*updates_inner_coord_iter)]; updates[updates_inner_transform.index(*updates_inner_coord_iter)];
updates_inner_coord_iter++; updates_inner_coord_iter++;
......
...@@ -81,6 +81,11 @@ namespace ngraph ...@@ -81,6 +81,11 @@ namespace ngraph
auto updates_outer_coord_iter = updates_outer_transform.begin(); auto updates_outer_coord_iter = updates_outer_transform.begin();
for (const Coordinate& indices_coord : indices_outer_transform) for (const Coordinate& indices_coord : indices_outer_transform)
{ {
if (updates_outer_coord_iter == updates_outer_transform.end())
{
break;
}
Coordinate out_start_corner(out_ndim, 0); Coordinate out_start_corner(out_ndim, 0);
Coordinate out_end_corner(out_shape); Coordinate out_end_corner(out_shape);
auto indices_index = indices_outer_transform.index(indices_coord); auto indices_index = indices_outer_transform.index(indices_coord);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment