Function arm_nn_requantize

Function Documentation

static int32_t arm_nn_requantize(const int32_t val, const int32_t multiplier, const int32_t shift)

Requantize a given value.

Essentially returns (val * multiplier)/(2 ^ shift) with different rounding depending if CMSIS_NN_USE_SINGLE_ROUNDING is defined or not.

Parameters:
  • val[in] Value to be requantized

  • multiplier[in] Multiplier. Range {NN_Q31_MIN + 1, Q32_MAX}

  • shift[in] Shift. Range: {-31, 30} Default branch: If shift is positive left shift ‘val * multiplier’ with shift If shift is negative right shift ‘val * multiplier’ with abs(shift) Single round branch: Input for total_shift in divide by ‘2 ^ total_shift’

Returns:

Default branch: Returns (val * multiplier) with rounding divided by (2 ^ shift) with rounding Single round branch: Returns (val * multiplier)/(2 ^ (31 - shift)) with rounding