Function arm_svdf_s8¶
Defined in File arm_nnfunctions.h
Function Documentation¶
-
arm_cmsis_nn_status arm_svdf_s8(const cmsis_nn_context *ctx, const cmsis_nn_context *input_ctx, const cmsis_nn_context *output_ctx, const cmsis_nn_svdf_params *svdf_params, const cmsis_nn_per_tensor_quant_params *input_quant_params, const cmsis_nn_per_tensor_quant_params *output_quant_params, const cmsis_nn_dims *input_dims, const int8_t *input_data, const cmsis_nn_dims *state_dims, int8_t *state_data, const cmsis_nn_dims *weights_feature_dims, const int8_t *weights_feature_data, const cmsis_nn_dims *weights_time_dims, const int8_t *weights_time_data, const cmsis_nn_dims *bias_dims, const int32_t *bias_data, const cmsis_nn_dims *output_dims, int8_t *output_data)¶
s8 SVDF function with 8 bit state tensor and 8 bit time weights
Supported framework: TensorFlow Lite micro
- Parameters:
ctx – [in] Precomputed per-feature-batch kernel sums, supplied by the caller. This is an input the function only reads, not scratch it fills: an allocated but unfilled buffer yields wrong output while still returning ARM_CMSIS_NN_SUCCESS. Mandatory on builds with the MVE extension (ARM_MATH_MVEI), where a NULL ctx->buf is diagnosed with ARM_CMSIS_NN_ARG_ERROR. Unused on every other build, where ctx->buf may be NULL. Sized by arm_svdf_s8_get_buffer_size(weights_feature_dims): weights_feature_dims->n * sizeof(int32_t) where the sums are used, 0 otherwise. Note this is weights_feature_dims->n, not a filter_dims->c - do not size this buffer with arm_fully_connected_s8_get_buffer_size(), which reads a different field and under-allocates. Fill it with arm_vector_sum_s8(ctx->buf, input_dims->h, weights_feature_dims->n, weights_feature_data, -svdf_params->input_offset, 0, NULL) so that entry j holds -input_offset * sum(weights_feature row j). The contents depend only on weights_feature_data and svdf_params->input_offset, so they may be computed once at load time and reused across calls until one of those changes. The buffer is specific to one layer’s weights and cannot be shared between layers. Do NOT clear this buffer between calls: zeroing it is indistinguishable from leaving it unfilled, and produces the silently wrong output described above. If it must be cleared for security reasons, clear it after the last call that uses it, and refill it before any further call.
input_ctx – [in] Temporary scratch buffer, used to hold one accumulator per feature batch. Written before it is read, so its contents on entry do not matter, but it is written on EVERY build, not only under MVE. Mandatory: a NULL buf returns ARM_CMSIS_NN_ARG_ERROR. There is no sizing helper for it; the buffer must hold at least input_dims->n * weights_feature_dims->n int32_t elements. The caller is expected to clear the buffer, if applicable, for security reasons.
output_ctx – [in] Temporary output scratch buffer, used to hold one accumulator per output unit. Written before it is read, so its contents on entry do not matter, but it is written on EVERY build, not only under MVE. Mandatory: a NULL buf returns ARM_CMSIS_NN_ARG_ERROR. There is no sizing helper for it; the buffer must hold at least input_dims->n * (weights_feature_dims->n / svdf_params->rank) int32_t elements. The caller is expected to clear the buffer, if applicable, for security reasons.
svdf_params – [in] SVDF Parameters Range of svdf_params->input_offset : [-128, 127] Range of svdf_params->output_offset : [-128, 127]
input_quant_params – [in] Input quantization parameters
output_quant_params – [in] Output quantization parameters
input_dims – [in] Input tensor dimensions
input_data – [in] Pointer to input tensor
state_dims – [in] State tensor dimensions
state_data – [in] Pointer to state tensor
weights_feature_dims – [in] Weights (feature) tensor dimensions
weights_feature_data – [in] Pointer to the weights (feature) tensor
weights_time_dims – [in] Weights (time) tensor dimensions
weights_time_data – [in] Pointer to the weights (time) tensor
bias_dims – [in] Bias tensor dimensions
bias_data – [in] Pointer to bias tensor
output_dims – [in] Output tensor dimensions
output_data – [out] Pointer to the output tensor
- Returns:
The function returns either
ARM_CMSIS_NN_ARG_ERRORif argument constraints fail. or,ARM_CMSIS_NN_SUCCESSon successful completion.