36 const InputT *input_data, OutputT *output_data)
38 const int32_t zero_point = op_params.
zero_point;
39 const double scale = op_params.
scale;
40 static constexpr int32_t min_val = std::numeric_limits<OutputT>::min();
41 static constexpr int32_t max_val = std::numeric_limits<OutputT>::max();
43 for (
int i = 0; i < flat_size; i++)
45 const InputT val = input_data[i];
47 static_cast<int32_t
>(std::round(val /
static_cast<float>(scale))) + zero_point;
48 int32_t clamped = std::min(std::max(unclamped, min_val), max_val);
49 output_data[i] = clamped;