Function arm_nn_mean_f16¶
Defined in File arm_nnfunctions_flt.h
Function Documentation¶
-
arm_cmsis_nn_status arm_nn_mean_f16(const float16_t *input_data, const cmsis_nn_dims *input_dims, const cmsis_nn_dims *axis_dims, float16_t *output_data, const cmsis_nn_dims *output_dims)¶
Computes the mean of a float16 tensor along the specified axes.
Values are accumulated and divided in float32, then rounded once to float16. NaN and Inf propagate. Vector and scalar builds may differ in final ulps because float accumulation order differs. Builds at -Ofast (the shipped CMSIS_OPTIMIZATION_LEVEL) may additionally differ from lower optimization levels by 1 ulp for non-power-of-two reduction counts: -freciprocal-math turns the divide-by-count into a multiply-by-reciprocal, which rounds differently.
Unlike arm_reduce_sum_f16 (identical signature, null checks only), this kernel validates shapes and returns
ARM_CMSIS_NN_ARG_ERRORwhen any input dimension is less than 1, when anyoutput_dimsentry differs from the input shape with the reduced axes collapsed to 1, or when the input element count or the reduction count does not fit in int32_t.output_datamust not overlapinput_data:each output element is written after reading its whole reduction set, so an aliased write can corrupt inputs still to be read.- Parameters:
input_data – [in] Pointer to input tensor
input_dims – [in] Input tensor dimensions (4D NHWC)
axis_dims – [in] 4D binary axis mask (non-zero = reduce that axis)
output_data – [out] Pointer to output tensor
output_dims – [in] Output tensor dimensions (reduced axes have size 1)
- Returns:
ARM_CMSIS_NN_SUCCESSon success orARM_CMSIS_NN_ARG_ERRORon invalid arguments.