Skip to content

Commit

Permalink
[onert-micro] Fix types for building
Browse files Browse the repository at this point in the history
This pr adds static casts to fix types.

ONE-DCO-1.0-Signed-off-by: Artem Balyshev <[email protected]>
  • Loading branch information
Artem Balyshev committed Jun 18, 2024
1 parent da89844 commit a1bb298
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ OMStatus AveragePool(const core::Pool2DParams &params, 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<int32_t>(params.filter_w),
static_cast<int32_t>(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<int32_t>(params.filter_h),
static_cast<int32_t>(input_height - in_y_origin));

float total = 0.f;
float filter_count = 0;
Expand Down
6 changes: 4 additions & 2 deletions onert-micro/onert-micro/include/pal/mcu/PALAveragePool2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ OMStatus AveragePool(const core::Pool2DParams &params, 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<int32_t>(params.filter_w),
static_cast<int32_t>(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<int32_t>(params.filter_h),
static_cast<int32_t>(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)
Expand Down
4 changes: 2 additions & 2 deletions onert-micro/onert-micro/include/pal/mcu/PALConv2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ OMStatus ConvPerChannel(const core::ConvQuant &params, const core::OMRuntimeShap
const int pad_height = params.pad_h;
const int32_t output_offset = params.output_offset;

const std::vector<int32_t> &output_multiplier = params.per_channel_output_multiplier;
const std::vector<int32_t> &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;
Expand Down

0 comments on commit a1bb298

Please sign in to comment.