Function arm_hard_swish_precise_s8¶
Defined in File arm_nnfunctions.h
Function Documentation¶
-
arm_cmsis_nn_status arm_hard_swish_precise_s8(const int8_t *input, const int32_t input_offset, const int32_t output_offset, const int32_t output_multiplier, const int32_t output_shift, const int32_t relu_q3, const int32_t relu_q6, const int32_t prescale, int8_t *output, const int32_t output_size)¶
S8 Hard-Swish activation function (precise version)
This version uses int32_t for intermediate computations to provide better accuracy. relu_q3, relu_q6 = round(3 / input_scale), round(6 / input_scale) prescale = min value to multiply input by to avoid overflow in intermediate computations M = ((input_scale**2) / (6.0 * output_scale)) * (1 << prescale) output_multiplier, output_shift = quantize_multiplier(M)
- Parameters:
input – [in] Pointer to the input buffer
input_offset – [in] Input tensor zero offset
output_offset – [in] Output tensor zero offset
output_multiplier – [in] Output multiplier
output_shift – [in] Output shift
relu_q3 – [in] ReLU6 Q3 value
relu_q6 – [in] ReLU6 Q6 value
prescale – [in] Prescale to apply to input
output – [out] Pointer to the output buffer
output_size – [in] Number of elements in the tensor
- Returns:
The function returns ARM_MATH_SUCCESS