Unverified Commit 66ce838c authored by Scott Cyphers's avatar Scott Cyphers Committed by GitHub

Klockwork issues: (#3883)

Comparing size_t >= 0
|= for bools
parent e5bc0854
...@@ -134,7 +134,7 @@ void op::v1::Gather::validate_and_infer_types() ...@@ -134,7 +134,7 @@ void op::v1::Gather::validate_and_infer_types()
if (input_rank.is_static() && axis != AXIS_NOT_SET_VALUE) if (input_rank.is_static() && axis != AXIS_NOT_SET_VALUE)
{ {
NODE_VALIDATION_CHECK(this, 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: ", "The axis must => 0 and <= input_rank (axis: ",
axis, axis,
")."); ").");
......
...@@ -286,8 +286,7 @@ void op::v1::Pad::validate_and_infer_types() ...@@ -286,8 +286,7 @@ void op::v1::Pad::validate_and_infer_types()
{ {
NODE_VALIDATION_CHECK( NODE_VALIDATION_CHECK(
this, 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]: ", "Number of elements of pads_begin must be >= 0 and <= arg rank (pads_begin_shape[0]: ",
pads_begin_shape[0], pads_begin_shape[0],
")."); ").");
...@@ -296,8 +295,7 @@ void op::v1::Pad::validate_and_infer_types() ...@@ -296,8 +295,7 @@ void op::v1::Pad::validate_and_infer_types()
{ {
NODE_VALIDATION_CHECK( NODE_VALIDATION_CHECK(
this, 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]: ", "Number of elements of pads_end must be >= 0 and <= arg rank (pads_end_shape[0]: ",
pads_end_shape[0], pads_end_shape[0],
")."); ").");
......
...@@ -96,7 +96,7 @@ void op::v0::Softmax::validate_and_infer_types() ...@@ -96,7 +96,7 @@ void op::v0::Softmax::validate_and_infer_types()
for (auto axis : m_axes) for (auto axis : m_axes)
{ {
NODE_VALIDATION_CHECK(this, NODE_VALIDATION_CHECK(this,
axis >= 0 && axis < static_cast<size_t>(input_shape.rank()), axis < static_cast<size_t>(input_shape.rank()),
"Reduction axis (", "Reduction axis (",
axis, axis,
") is out of bounds (argument shape: ", ") is out of bounds (argument shape: ",
......
...@@ -678,8 +678,14 @@ TEST(util, clone_function_op_annotations) ...@@ -678,8 +678,14 @@ TEST(util, clone_function_op_annotations)
{ {
if (auto op_annotation = parameter->get_op_annotations()) if (auto op_annotation = parameter->get_op_annotations())
{ {
found_A |= op_annotation->is_cacheable(); if (op_annotation->is_cacheable())
found_B |= !op_annotation->is_cacheable(); {
found_A = true;
}
else
{
found_B = true;
}
} }
} }
EXPECT_TRUE(found_A); EXPECT_TRUE(found_A);
......
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