18#ifndef __NNFW_CKER_ROUND_H__
19#define __NNFW_CKER_ROUND_H__
33 auto floor_val = std::floor(value);
34 auto diff = value - floor_val;
35 if ((diff < 0.5f) || ((diff == 0.5f) && (
static_cast<int>(floor_val) % 2 == 0)))
41 return floor_val = floor_val + 1.0f;
49#if defined(__aarch64__) || defined(__SSSE3__)
51 return vcvtnq_s32_f32(input);
53 static const float32x4_t zero_val_dup = vdupq_n_f32(0.0f);
54 static const float32x4_t point5_val_dup = vdupq_n_f32(0.5f);
55 static const float32x4_t minus_point5_val_dup = vdupq_n_f32(-0.5f);
57 const uint32x4_t mask = vcltq_f32(input, zero_val_dup);
58 const float32x4_t round = vbslq_f32(mask, minus_point5_val_dup, point5_val_dup);
59 return vcvtq_s32_f32(vaddq_f32(input, round));
69 for (
int i = 0; i < flat_size; ++i)
const luci_interpreter::RuntimeShape output_shape
void Round(const Shape &input_shape, const float *input_data, const Shape &output_shape, float *output_data)
float RoundToNearest(float value)
int MatchingFlatSize(const Shape &shape, Ts... check_shapes)