Function arm_elementwise_sub_broadcast_f16¶
Defined in File arm_nnfunctions_flt.h
Function Documentation¶
-
arm_cmsis_nn_status arm_elementwise_sub_broadcast_f16(const float16_t *input_1_data, const cmsis_nn_dims *input_1_dims, const float16_t *input_2_data, const cmsis_nn_dims *input_2_dims, float16_t *output_data, const cmsis_nn_dims *output_dims, float16_t out_activation_min, float16_t out_activation_max)¶
Elementwise subtract with TensorFlow Lite NHWC broadcasting and an output clamp.
Broadcasting follows the NumPy / TensorFlow Lite rule per dimension: each of n, h, w and c of the two inputs must be equal or 1, a dimension of 1 is repeated along that axis, and
output_dimsmust be the elementwise maximum of the two input shapes. A dimension of 0 or less is rejected.Numerics are those of arm_elementwise_sub_f32 applied to the materialised broadcast operands: identical arithmetic and clamp on every path, so on the shipped Cortex-M legs (M4, M55) the output is bit-identical to that kernel, NaN payload aside, and its NaN contract holds here unchanged — a NaN in either operand, or one produced by the arithmetic, propagates through the clamp at every optimization level, while non-NaN infinities clamp to the bounds. On other hosts built with -fno-signed-zeros the sign of a zero that ties with a zero clamp bound is compiler-licensed and may differ between this walk and the flat loop. The bounds must be ordered and non-NaN. When input 1 is the broadcast scalar the result is computed as
scalar - element, not as the negation ofelement - scalar, which differs at a zero result; whether the sign of a zero survives is then subject to the same -fno-signed-zeros license the shipped -Ofast grants the compiler on the flat kernels.Half-precision twin: the numerics are those of arm_elementwise_sub_f16 on the materialised operands.
- Parameters:
input_1_data – [in] Minuend, NHWC, sized by
input_1_dims.input_1_dims – [in] Dimensions of input 1.
input_2_data – [in] Subtrahend, NHWC, sized by
input_2_dims.input_2_dims – [in] Dimensions of input 2.
output_data – [out] Output, NHWC, sized by
output_dims.output_dims – [in] Broadcast output dimensions.
out_activation_min – [in] Minimum output clamp value.
out_activation_max – [in] Maximum output clamp value.
- Returns:
ARM_CMSIS_NN_SUCCESSon success, orARM_CMSIS_NN_ARG_ERRORwhen a pointer is NULL, a dimension is not positive, the shapes are not broadcast-compatible, or the output shape is not their broadcast shape. Nothing is written on error.