fixed additional warnings (#18209)

This commit is contained in:
Ryszard Jezierski 2023-06-23 17:42:26 +02:00 committed by GitHub
parent a3e4a1f730
commit 8a2af2418f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 12 deletions

View File

@ -443,7 +443,7 @@ inline Rank::value_type get_max_input_rank(const std::shared_ptr<ov::Node>& node
inline Shape::value_type get_dim_by_axis(const Shape& shape, int64_t axis) {
if (axis < 0)
axis += shape.size();
if (axis < 0 || axis >= shape.size())
if (axis < 0 || axis >= static_cast<int64_t>(shape.size()))
throw std::runtime_error("get_dim_by_axis invalid axis");
return shape[axis];
}
@ -452,7 +452,7 @@ inline Shape::value_type get_dim_by_axis(const Shape& shape, int64_t axis) {
* @brief unsqueezes shape to rank
*/
inline Shape unsqueeze_shape(const Shape& shape, ov::Rank::value_type rank) {
const int rank_delta = rank - shape.size();
const int rank_delta = static_cast<int>(rank) - static_cast<int>(shape.size());
if (rank_delta <= 0)
return shape;

View File

@ -86,11 +86,11 @@ GatherSinkingMatmulBackward::GatherSinkingMatmulBackward() {
auto indices_const = as_type_ptr<Constant>(pattern_to_output.at(indices_const_label).get_node_shared_ptr());
auto gather = as_type_ptr<Gather>(pattern_to_output.at(gather_label).get_node_shared_ptr());
int gather_negative_axis =
int64_t gather_negative_axis =
get_normalized_negative_gather_axis(axis_const, gather->get_input_partial_shape(0).rank().get_length());
const int matmul_insert_input_idx =
convert_axis_to_positive(gather_negative_axis, gather->get_input_partial_shape(0).rank().get_length());
if (is_matmul_input_transposed(matmul, gather_negative_axis))
const int matmul_insert_input_idx = static_cast<int>(
convert_axis_to_positive(gather_negative_axis, gather->get_input_partial_shape(0).rank().get_length()));
if (is_matmul_input_transposed(matmul, static_cast<size_t>(gather_negative_axis)))
gather_negative_axis = get_another_input_negative_axis(gather_negative_axis);
auto new_axis_const = std::make_shared<Constant>(axis_const->get_element_type(), Shape{}, gather_negative_axis);
for (auto& new_node : sink_backward::insert_gather_before_node(matmul,

View File

@ -28,8 +28,8 @@ namespace {
using NodePtr = std::shared_ptr<ov::Node>;
int get_shapes_squeeze_shift(const Shape& shape1, const Shape& shape2) {
const int index_1 = get_first_valuable_dim_id(shape1);
const int index_2 = get_first_valuable_dim_id(shape2);
const int index_1 = static_cast<int>(get_first_valuable_dim_id(shape1));
const int index_2 = static_cast<int>(get_first_valuable_dim_id(shape2));
if (index_1 < 0 || index_2 < 0)
return 0;

View File

@ -57,7 +57,7 @@ OutputGather find_first_output_gather(NodePtr node) {
output_gather.gather = gather_node;
output_gather.gather_indices = indices_node;
output_gather.gather_axis = axis_node;
output_gather.output_idx = output_idx;
output_gather.output_idx = static_cast<int>(output_idx);
return output_gather;
}

View File

@ -118,8 +118,8 @@ bool AreFlattenShapes(const ov::Shape& shape1, const ov::Shape& shape2) {
if (shape1.size() - 1 != i && shape2.size() - 1 != i)
return false;
// min_shape.back() == MULTIPLY(max_shape.begin() + i, max_shape.end())
const size_t mult1 = std::accumulate(shape1.begin() + i, shape1.end(), 1, std::multiplies<size_t>());
const size_t mult2 = std::accumulate(shape2.begin() + i, shape2.end(), 1, std::multiplies<size_t>());
const size_t mult1 = std::accumulate(shape1.begin() + i, shape1.end(), std::size_t{1}, std::multiplies<size_t>());
const size_t mult2 = std::accumulate(shape2.begin() + i, shape2.end(), std::size_t{1}, std::multiplies<size_t>());
return mult1 == mult2;
}

View File

@ -80,7 +80,7 @@ TSSplitBackward::TSSplitBackward() {
const Shape& split_input_shape = split_node->get_input_shape(0);
const size_t split_input_dims = std::accumulate(split_input_shape.begin(),
split_input_shape.end(),
1,
std::size_t{1},
std::multiplies<Shape::value_type>());
const Shape reshape_input_shape = {1, split_input_dims};