Function arm_convolve_f16¶
Defined in File arm_nnfunctions_flt.h
Function Documentation¶
-
arm_cmsis_nn_status arm_convolve_f16(const cmsis_nn_context *ctx, const cmsis_nn_conv_params_f16 *conv_params, const cmsis_nn_dims *input_dims, const float16_t *input_data, const cmsis_nn_dims *filter_dims, const float16_t *filter_data, const cmsis_nn_dims *bias_dims, const float16_t *bias_data, const cmsis_nn_dims *output_dims, float16_t *output_data, arm_nn_tensor_layout layout)¶
Convolution, dispatch by layout.
Note
When
conv_params->weight_formatis set toARM_NN_WEIGHT_FORMAT_NT_N_PACKED, every convolution path, including the 1xN kernels and the generic fallback that runs without scratch, interpretsfilter_dataas an already prepackedNTxNRHS buffer instead of the standard public filter layout.Note
Accumulation width per leg. Scalar leg (non-MVE builds and ARM_MATH_AUTOVECTORIZE): the direct OHWI / NT_N_PACKED fallback accumulates bias and every tap in float32 and rounds to float16 once at the store (AmbiqAI/ns-cmsis-nn#449, #457); the 1x1, 1xN and patch-GEMM paths go through arm_nn_mat_mult_nt_t_f16 / arm_nn_mat_mult_nt_n_packed_f16, whose scalar legs do the same. MVE leg: the direct small-C kernel accumulates in float32 (widened lanes); the direct OHWI / NT_N_PACKED fallback and every matmul-backed path (1x1, 1xN, patch-GEMM) accumulate in float16 lanes, as the two matmul helpers’ notes state.
- Parameters:
ctx – [inout] Function context that may hold a temporary scratch buffer.
conv_params – [in] Convolution parameters (stride, padding, dilation and activation clamp).
input_dims – [in] Input tensor dimensions. Format depends on
layout.input_data – [in] Pointer to the input tensor data.
filter_dims – [in] Filter tensor dimensions. Format depends on
layout.filter_data – [in] Pointer to the filter tensor data.
bias_dims – [in] Bias tensor dimensions. Format: [C_OUT].
bias_data – [in] Optional bias tensor data.
output_dims – [in] Output tensor dimensions. Format depends on
layout.output_data – [out] Pointer to the output tensor data.
layout – [in] Tensor layout selector. Current float APIs require
ARM_NN_LAYOUT_NHWC.
- Returns:
ARM_CMSIS_NN_SUCCESSon success orARM_CMSIS_NN_ARG_ERRORon invalid arguments.