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
Strides m_window_movement_strides;
Shape m_padding_below;
Shape m_padding_above;
bool m_include_padding_in_avg_computation;
PadType m_pad_type;
bool m_include_padding_in_avg_computation{false};
PadType m_pad_type{PadType::EXPLICIT};
};
class AvgPoolBackprop : public Op
......@@ -155,7 +155,7 @@ namespace ngraph
Strides m_window_movement_strides;
Shape m_padding_below;
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()
size_t axis_zb = get_zero_based_axis();
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 "
"input tensor's shape dimensions.");
......
......@@ -64,11 +64,8 @@ NodeVector op::Unsqueeze::decompose_op() const
for (auto axis : axes)
{
NODE_VALIDATION_CHECK(this,
axis >= 0 && axis <= data_shape.size(),
"provided 'axes' value ",
axis,
" is not valid.");
NODE_VALIDATION_CHECK(
this, axis <= data_shape.size(), "provided 'axes' value ", axis, " is not valid.");
data_shape.insert(next(begin(data_shape), axis), 1);
}
......
......@@ -54,7 +54,7 @@ namespace ngraph
void set_index_element_type(const element::Type& index_element_type);
protected:
size_t m_axis;
size_t m_axis{0};
element::Type m_index_element_type;
void validate_and_infer_types() override;
......
......@@ -24,7 +24,7 @@ namespace ngraph
namespace pass
{
template <typename T>
NodeVector static explicit_broadcast(std::shared_ptr<T>& node)
NodeVector explicit_broadcast(std::shared_ptr<T>& node)
{
NodeVector rc;
......
......@@ -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();
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_1 = pattern_map[input1];
auto scale_new = pattern_map[scale];
......
......@@ -103,6 +103,10 @@ namespace ngraph
auto updates_inner_coord_iter = updates_inner_transform.begin();
for (const Coordinate& out_coord : out_transform)
{
if (updates_inner_coord_iter == updates_inner_transform.end())
{
break;
}
out[out_transform.index(out_coord)] +=
updates[updates_inner_transform.index(*updates_inner_coord_iter)];
updates_inner_coord_iter++;
......
......@@ -81,6 +81,11 @@ namespace ngraph
auto updates_outer_coord_iter = updates_outer_transform.begin();
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_end_corner(out_shape);
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