From fa4c5e8e383fc7b64d9b354993065c8bb9866bed Mon Sep 17 00:00:00 2001 From: Ivan Tikhonov Date: Mon, 22 Jun 2020 23:37:54 +0300 Subject: [PATCH] Fix ARM build: explicit type conversion (#1061) * fix arm build: explicit type conversion * Use explicit conversion in prior_box_ie.cpp --- .../src/transformations/src/ngraph_ops/prior_box_ie.cpp | 2 +- .../src/transformations/depth_to_space_fusion.cpp | 8 ++++---- .../dynamic_to_static_shape_binary_elementwise.cpp | 2 +- ngraph/src/ngraph/op/prior_box.cpp | 4 +++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/inference-engine/src/transformations/src/ngraph_ops/prior_box_ie.cpp b/inference-engine/src/transformations/src/ngraph_ops/prior_box_ie.cpp index 8a34ab79daa..03800160c4a 100644 --- a/inference-engine/src/transformations/src/ngraph_ops/prior_box_ie.cpp +++ b/inference-engine/src/transformations/src/ngraph_ops/prior_box_ie.cpp @@ -27,7 +27,7 @@ void op::PriorBoxIE::validate_and_infer_types() { auto image_shape = get_input_shape(1); set_output_type(0, element::f32, Shape { - 1, 2, 4 * input_shape[2] * input_shape[3] * op::PriorBox::number_of_priors(m_attrs)}); + 1, 2, 4 * input_shape[2] * input_shape[3] * static_cast(op::PriorBox::number_of_priors(m_attrs))}); } shared_ptr op::PriorBoxIE::copy_with_new_args(const NodeVector& new_args) const { diff --git a/inference-engine/src/transformations/src/transformations/depth_to_space_fusion.cpp b/inference-engine/src/transformations/src/transformations/depth_to_space_fusion.cpp index d6c98e55e2d..da0b41a60ff 100644 --- a/inference-engine/src/transformations/src/transformations/depth_to_space_fusion.cpp +++ b/inference-engine/src/transformations/src/transformations/depth_to_space_fusion.cpp @@ -30,7 +30,7 @@ bool check_block_first(const ngraph::Shape& shape_input, const ngraph::Shape& sh is_transformation_valid &= (expected_shape == shape_reshape_before); // x'' = transpose(x', [0, K + 1, K + 2, 1, K + 3, 2, K + 4, 3, ..., K + (K + 1), K]) - ngraph::AxisVector expected_permutation = {0, spatial_dims + 1}; + ngraph::AxisVector expected_permutation = {0, static_cast(spatial_dims + 1)}; for (uint64_t i = 2; i < shape_input.size(); ++i) { expected_permutation.push_back(spatial_dims + i); expected_permutation.push_back(i - 1); @@ -38,7 +38,7 @@ bool check_block_first(const ngraph::Shape& shape_input, const ngraph::Shape& sh is_transformation_valid &= (expected_permutation == permutation); // y = reshape(x'', [N, C / (block_size ^ K), D1 * block_size, D2 * block_size, D3 * block_size, ..., DK * block_size]) - expected_shape = {shape_input[0], c_dim}; + expected_shape = {shape_input[0], static_cast(c_dim)}; for (uint64_t i = 2; i < shape_input.size(); ++i) expected_shape.push_back(shape_input[i] * possible_block_size); is_transformation_valid &= (expected_shape == shape_reshape_after); @@ -57,7 +57,7 @@ bool check_depth_first(const ngraph::Shape& shape_input, const ngraph::Shape& sh uint64_t c_dim = shape_input[1] / std::pow(possible_block_size, spatial_dims); // x' = reshape(data, [N, C / (block_size ^ K), block_size, block_size, ..., block_size, D1, D2, ..., DK]) - ngraph::Shape expected_shape = {shape_input[0], c_dim}; + ngraph::Shape expected_shape = {shape_input[0], static_cast(c_dim)}; for (uint64_t i = 0; i < spatial_dims; ++i) expected_shape.push_back(possible_block_size); for (uint64_t i = 2; i < shape_input.size(); ++i) @@ -73,7 +73,7 @@ bool check_depth_first(const ngraph::Shape& shape_input, const ngraph::Shape& sh is_transformation_valid &= (expected_permutation == permutation); // y = reshape(x'', [N, C / (block_size ^ K), D1 * block_size, D2 * block_size, D3 * block_size, ..., DK * block_size]) - expected_shape = {shape_input[0], c_dim}; + expected_shape = {shape_input[0], static_cast(c_dim)}; for (uint64_t i = 2; i < shape_input.size(); ++i) expected_shape.push_back(shape_input[i] * possible_block_size); is_transformation_valid &= (expected_shape == shape_reshape_after); diff --git a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_binary_elementwise.cpp b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_binary_elementwise.cpp index 4cc013b0c7d..c4d80fec1e9 100644 --- a/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_binary_elementwise.cpp +++ b/inference-engine/src/vpu/common/src/ngraph/transformations/dynamic_to_static_shape_binary_elementwise.cpp @@ -39,7 +39,7 @@ void dynamicToStaticShapeBinaryEltwise(std::shared_ptr eltwise) { const auto diff = std::abs(lhsRank.get_length() - rhsRank.get_length()); if (diff) { auto & broadcastInput = lhsRank.get_length() < rhsRank.get_length() ? lhsInput : rhsInput; - const auto broadcastConst = ngraph::opset3::Constant::create(broadcastInput.get_element_type(), {static_cast(diff)}, {1}); + const auto broadcastConst = ngraph::opset3::Constant::create(broadcastInput.get_element_type(), {static_cast(diff)}, {1}); broadcastInput = std::make_shared(ngraph::OutputVector{broadcastConst, broadcastInput}, 0); } diff --git a/ngraph/src/ngraph/op/prior_box.cpp b/ngraph/src/ngraph/op/prior_box.cpp index 755c8700e29..a879aff4d4a 100644 --- a/ngraph/src/ngraph/op/prior_box.cpp +++ b/ngraph/src/ngraph/op/prior_box.cpp @@ -69,7 +69,9 @@ void op::PriorBox::validate_and_infer_types() set_output_type(0, element::f32, - Shape{2, 4 * layer_shape[0] * layer_shape[1] * number_of_priors(m_attrs)}); + Shape{2, + 4 * layer_shape[0] * layer_shape[1] * + static_cast(number_of_priors(m_attrs))}); } else {