Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Klockwork issues: (#3883)
Browse files Browse the repository at this point in the history
Comparing size_t >= 0
|= for bools
  • Loading branch information
diyessi authored Nov 13, 2019
1 parent e5bc085 commit 66ce838
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/ngraph/op/gather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void op::v1::Gather::validate_and_infer_types()
if (input_rank.is_static() && axis != AXIS_NOT_SET_VALUE)
{
NODE_VALIDATION_CHECK(this,
axis >= 0 && axis < static_cast<size_t>(input_rank),
axis < static_cast<size_t>(input_rank),
"The axis must => 0 and <= input_rank (axis: ",
axis,
").");
Expand Down
6 changes: 2 additions & 4 deletions src/ngraph/op/pad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,7 @@ void op::v1::Pad::validate_and_infer_types()
{
NODE_VALIDATION_CHECK(
this,
static_cast<size_t>(pads_begin_shape[0]) >= 0 &&
static_cast<size_t>(pads_begin_shape[0]) <= static_cast<size_t>(arg_shape_rank),
static_cast<size_t>(pads_begin_shape[0]) <= static_cast<size_t>(arg_shape_rank),
"Number of elements of pads_begin must be >= 0 and <= arg rank (pads_begin_shape[0]: ",
pads_begin_shape[0],
").");
Expand All @@ -296,8 +295,7 @@ void op::v1::Pad::validate_and_infer_types()
{
NODE_VALIDATION_CHECK(
this,
static_cast<size_t>(pads_end_shape[0]) >= 0 &&
static_cast<size_t>(pads_end_shape[0]) <= static_cast<size_t>(arg_shape_rank),
static_cast<size_t>(pads_end_shape[0]) <= static_cast<size_t>(arg_shape_rank),
"Number of elements of pads_end must be >= 0 and <= arg rank (pads_end_shape[0]: ",
pads_end_shape[0],
").");
Expand Down
2 changes: 1 addition & 1 deletion src/ngraph/op/softmax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void op::v0::Softmax::validate_and_infer_types()
for (auto axis : m_axes)
{
NODE_VALIDATION_CHECK(this,
axis >= 0 && axis < static_cast<size_t>(input_shape.rank()),
axis < static_cast<size_t>(input_shape.rank()),
"Reduction axis (",
axis,
") is out of bounds (argument shape: ",
Expand Down
10 changes: 8 additions & 2 deletions test/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,14 @@ TEST(util, clone_function_op_annotations)
{
if (auto op_annotation = parameter->get_op_annotations())
{
found_A |= op_annotation->is_cacheable();
found_B |= !op_annotation->is_cacheable();
if (op_annotation->is_cacheable())
{
found_A = true;
}
else
{
found_B = true;
}
}
}
EXPECT_TRUE(found_A);
Expand Down

0 comments on commit 66ce838

Please sign in to comment.