Function arm_svdf_f16

Function Documentation

arm_cmsis_nn_status arm_svdf_f16(const cmsis_nn_context *ctx, const cmsis_nn_context *input_ctx, const cmsis_nn_context *output_ctx, const cmsis_nn_svdf_params_f16 *svdf_params, const cmsis_nn_dims *input_dims, const float16_t *input_data, const cmsis_nn_dims *state_dims, float16_t *state_data, const cmsis_nn_dims *weights_feature_dims, const float16_t *weights_feature_data, const cmsis_nn_dims *weights_time_dims, const float16_t *weights_time_data, const cmsis_nn_dims *bias_dims, const float16_t *bias_data, const cmsis_nn_dims *output_dims, float16_t *output_data)

Stateful singular value decomposition filter, float16 variant.

Note

Sizing an f16 layer with the arm_svdf_f32() queries over-allocates and is safe. Sizing an f32 layer with the arm_svdf_f16() queries under-allocates by half: arm_svdf_f32() returns ARM_CMSIS_NN_ARG_ERROR if ctx->size carries that undersized figure, but corrupts memory if ctx->size is left at 0, which opts out of the check.

Note

NaN propagates through the activation clamps that take the bit-classified scalar clamp of #380, at every optimization level on the gated toolchains, including the shipped -Ofast: the input-activation clamp is that scalar clamp on EVERY build, and the output-activation clamp is on non-MVE builds. On MVE builds the output-activation clamp is vmaxnmq/vminnmq with no NaN restore, so a NaN resolves to a clamp bound there instead.

Parameters:
  • ctx[inout] Unused by this function. Reserved for future use; may be NULL.

  • input_ctx[inout]

    Mandatory, not optional: a NULL input_ctx, or a NULL input_ctx->buf, is diagnosed with ARM_CMSIS_NN_ARG_ERROR on every build. Staging buffer written by this function, holding one element per (input batch, 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. Sized by arm_svdf_f16_input_ctx_get_buffer_size(input_dims,

    weights_feature_dims): input_dims->n * weights_feature_dims->n * sizeof(float16_t) bytes. Note this is float16_t, half the

    arm_svdf_f32() figure for the same shape. Setting input_ctx->size lets this function reject an undersized buffer with ARM_CMSIS_NN_ARG_ERROR; leaving it at zero opts out of that check. The caller is expected to clear the buffer, if applicable, for security reasons.

  • output_ctx[inout]

    Mandatory, not optional: a NULL output_ctx, or a NULL output_ctx->buf, is diagnosed with ARM_CMSIS_NN_ARG_ERROR on every build. Staging buffer written by this function, holding one element per (input batch, 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. Sized by arm_svdf_f16_output_ctx_get_buffer_size(svdf_params, input_dims,

    weights_feature_dims): input_dims->n * (weights_feature_dims->n / svdf_params->rank) * sizeof(float16_t) bytes, truncating division. Note this is float16_t, half the

    arm_svdf_f32() figure for the same shape. Setting output_ctx->size lets this function reject an undersized buffer with ARM_CMSIS_NN_ARG_ERROR; leaving it at zero opts out of that check. The caller is expected to clear the buffer, if applicable, for security reasons.

  • svdf_params[in] SVDF operator parameters.

  • input_dims[in] Input tensor dimensions.

  • input_data[in] Pointer to the input tensor data.

  • state_dims[in] State tensor dimensions.

  • state_data[inout] Pointer to the mutable state tensor.

  • weights_feature_dims[in] Feature-weight tensor dimensions.

  • weights_feature_data[in] Pointer to the feature-weight tensor.

  • weights_time_dims[in] Time-weight tensor dimensions.

  • weights_time_data[in] Pointer to the time-weight tensor.

  • bias_dims[in] Bias tensor dimensions.

  • bias_data[in] Optional bias tensor data.

  • output_dims[in] Output tensor dimensions.

  • output_data[out] Pointer to the output tensor data.

Returns:

ARM_CMSIS_NN_SUCCESS on success or ARM_CMSIS_NN_ARG_ERROR on invalid arguments.