Function arm_depthwise_conv_f16_get_buffer_size

Function Documentation

int32_t arm_depthwise_conv_f16_get_buffer_size(const cmsis_nn_dw_conv_params_f16 *dw_conv_params, const cmsis_nn_dims *input_dims, const cmsis_nn_dims *filter_dims, const cmsis_nn_dims *output_dims, arm_nn_tensor_layout layout)

Get the temporary buffer size required by depthwise convolution.

Note

Only one route reads scratch: on MVE builds, an NHWC depthwise with a single input channel and at least CONVERT_DW_CONV_WITH_ONE_INPUT_CH_AND_OUTPUT_CH_ABOVE_THRESHOLD output channels runs as a regular convolution, and needs the repacked filter, ROUND_UP(output_dims->c, 4) * filter_dims->h * filter_dims->w * sizeof(float32_t) bytes (ROUND_UP(output_dims->c, 8) and sizeof(float16_t) for _f16), plus arm_convolve_wrapper_f32_get_buffer_size (_f16) for that convolution. Every other route — the exact-shape specializations, the ch_mult == 1 direct kernel and the generic kernel — runs without scratch and the query returns 0 (AmbiqAI/ns-cmsis-nn#448).

Parameters:
  • dw_conv_params[in] Depthwise convolution parameters.

  • input_dims[in] Input tensor dimensions.

  • filter_dims[in] Filter tensor dimensions.

  • output_dims[in] Output tensor dimensions.

  • layout[in] Tensor layout selector.

Returns:

Required buffer size in bytes, or 0 when no scratch buffer is needed.