From a1bb29857fa93fec81d4bd30b0529669b193dcbd Mon Sep 17 00:00:00 2001 From: Artem Balyshev Date: Tue, 18 Jun 2024 18:09:16 +0300 Subject: [PATCH] [onert-micro] Fix types for building This pr adds static casts to fix types. ONE-DCO-1.0-Signed-off-by: Artem Balyshev --- .../onert-micro/include/pal/common/PALAveragePool2DCommon.h | 6 ++++-- onert-micro/onert-micro/include/pal/mcu/PALAveragePool2D.h | 6 ++++-- onert-micro/onert-micro/include/pal/mcu/PALConv2D.h | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/onert-micro/onert-micro/include/pal/common/PALAveragePool2DCommon.h b/onert-micro/onert-micro/include/pal/common/PALAveragePool2DCommon.h index 0f72f56fa95..16579557ddb 100644 --- a/onert-micro/onert-micro/include/pal/common/PALAveragePool2DCommon.h +++ b/onert-micro/onert-micro/include/pal/common/PALAveragePool2DCommon.h @@ -55,9 +55,11 @@ OMStatus AveragePool(const core::Pool2DParams ¶ms, const core::OMRuntimeShap // Compute the boundaries of the filter region clamped so as to // ensure that the filter window fits in the input array. const int filter_x_start = std::max(0, -in_x_origin); - const int filter_x_end = std::min(params.filter_w, input_width - in_x_origin); + const int filter_x_end = std::min(static_cast(params.filter_w), + static_cast(input_width - in_x_origin)); const int filter_y_start = std::max(0, -in_y_origin); - const int filter_y_end = std::min(params.filter_h, input_height - in_y_origin); + const int filter_y_end = std::min(static_cast(params.filter_h), + static_cast(input_height - in_y_origin)); float total = 0.f; float filter_count = 0; diff --git a/onert-micro/onert-micro/include/pal/mcu/PALAveragePool2D.h b/onert-micro/onert-micro/include/pal/mcu/PALAveragePool2D.h index 0d054e596a4..62fe4602196 100644 --- a/onert-micro/onert-micro/include/pal/mcu/PALAveragePool2D.h +++ b/onert-micro/onert-micro/include/pal/mcu/PALAveragePool2D.h @@ -58,9 +58,11 @@ OMStatus AveragePool(const core::Pool2DParams ¶ms, const core::OMRuntimeShap // Compute the boundaries of the filter region clamped so as to // ensure that the filter window fits in the input array. const int filter_x_start = std::max(0, -in_x_origin); - const int filter_x_end = std::min(params.filter_w, input_width - in_x_origin); + const int filter_x_end = std::min(static_cast(params.filter_w), + static_cast(input_width - in_x_origin)); const int filter_y_start = std::max(0, -in_y_origin); - const int filter_y_end = std::min(params.filter_h, input_height - in_y_origin); + const int filter_y_end = std::min(static_cast(params.filter_h), + static_cast(input_height - in_y_origin)); int32_t acc = 0; int filter_count = 0; for (int filter_y = filter_y_start; filter_y < filter_y_end; ++filter_y) diff --git a/onert-micro/onert-micro/include/pal/mcu/PALConv2D.h b/onert-micro/onert-micro/include/pal/mcu/PALConv2D.h index 1c850e85be2..3bca5a902ec 100644 --- a/onert-micro/onert-micro/include/pal/mcu/PALConv2D.h +++ b/onert-micro/onert-micro/include/pal/mcu/PALConv2D.h @@ -46,8 +46,8 @@ OMStatus ConvPerChannel(const core::ConvQuant ¶ms, const core::OMRuntimeShap const int pad_height = params.pad_h; const int32_t output_offset = params.output_offset; - const std::vector &output_multiplier = params.per_channel_output_multiplier; - const std::vector &output_shift = params.per_channel_output_shift; + const auto &output_multiplier = params.per_channel_output_multiplier; + const auto &output_shift = params.per_channel_output_shift; // Set min and max value of the output. const int32_t output_activation_min = params.quantized_activation_min;