From b5be90a8862c19296c002ca765b0d6611c6121a3 Mon Sep 17 00:00:00 2001 From: Ivan Tikhonov Date: Mon, 22 Jun 2020 23:37:08 +0300 Subject: [PATCH] Fix Android ARM build (#1032) * fix arm build: size_t -> uint64_t * apply static_cast * fix dynamic_to_static_shape_binary_elementwise.cpp file * add static_cast in prior_box.cpp --- .../transformations/src/transformations/depth_to_space_fusion.cpp | 8 ++++---- .../dynamic_to_static_shape_binary_elementwise.cpp | 2 +- ngraph/src/ngraph/op/prior_box.cpp | 4 +++- 3 files changed, 8 insertions(+), 6 deletions(-) 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 d6c98e5..da0b41a 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 4cc013b..c4d80fe 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 ff78d51..74e0724 100644 --- a/ngraph/src/ngraph/op/prior_box.cpp +++ b/ngraph/src/ngraph/op/prior_box.cpp @@ -71,7 +71,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 { -- 2.7.4