Function arm_svdf_f32_input_ctx_get_buffer_size

Function Documentation

int32_t arm_svdf_f32_input_ctx_get_buffer_size(const cmsis_nn_dims *input_dims, const cmsis_nn_dims *weights_feature_dims)

Get size of the input_ctx staging buffer required by arm_svdf_f32().

Note

This query reports an out-of-range shape as -1, following the SVDF family (arm_svdf_s8_get_buffer_size()). That differs from the float convolution and fully-connected queries in this header, which report an out-of-range size as 0. The reason is that arm_svdf_f32() reads ctx->size, and size == 0 is the opt-out signal for its scratch-size check: a 0-on-overflow answer fed straight back as buf = alloc(0), size = 0 would silently disable the check over a zero-byte allocation, whereas alloc((size_t)-1) fails and the NULL check catches it.

Note

0 is still a valid return for a degenerate shape (input_dims->n == 0). Unlike the general rule in README.md, a 0 here does NOT mean you may pass { NULL, 0 }: arm_svdf_f32() rejects a NULL input_ctx->buf with ARM_CMSIS_NN_ARG_ERROR regardless of the size. Allocate a non-NULL pointer, or do not call the kernel for a shape that produces no output.

Parameters:
Returns:

Required buffer size in bytes: input_dims->n * weights_feature_dims->n * sizeof(float32_t). Returns -1 if either pointer is NULL, if input_dims->n or weights_feature_dims->n is negative, or if the product would not fit in an int32_t. The figure and the validation are the same on every build target, since arm_svdf_f32() stages this buffer on every build rather than only under MVE.