Function arm_transpose_conv_wrapper_s8

Function Documentation

arm_cmsis_nn_status arm_transpose_conv_wrapper_s8(const cmsis_nn_context *ctx, const cmsis_nn_context *weight_sum_ctx, const cmsis_nn_context *reverse_conv_ctx, const cmsis_nn_transpose_conv_params *transpose_conv_params, const cmsis_nn_per_channel_quant_params *quant_params, const cmsis_nn_dims *input_dims, const int8_t *input_data, const cmsis_nn_dims *filter_dims, const int8_t *filter_data, const cmsis_nn_dims *bias_dims, const int32_t *bias_data, const cmsis_nn_dims *output_dims, int8_t *output_data)

Wrapper to select optimal transposed convolution algorithm depending on parameters.

  1. Supported framework: TensorFlow Lite micro

  2. Additional memory is required for optimization. Refer to arguments ‘ctx’ and ‘reverse_conv_ctx’ for details.

  3. Dilation is not supported: transpose_conv_params->dilation must be 1 in both dimensions, otherwise ARM_CMSIS_NN_ARG_ERROR is returned.

Parameters:
  • ctx[inout] Function context that contains the additional buffer if required by the function. arm_transpose_conv_s8_get_buffer_size() will return the buffer_size if required. The caller is expected to clear the buffer, if applicable, for security reasons.

  • weight_sum_ctx[in] Per-output-channel weight sums, supplied by the caller. The function only reads this buffer and never writes it, so it is filled once and may then be reused for as long as filter_data, bias_data and transpose_conv_params->input_offset are unchanged - see arm_convolve_weight_sum() for the layout and the full reuse rules. Fill it with arm_convolve_weight_sum(), passing transpose_conv_params->input_offset as lhs_offset and the same bias_data given here, so that entry j holds input_offset * sum(weights of output channel j) + bias_data[j]. That helper returns ARM_CMSIS_NN_NO_IMPL_ERROR on non-MVE builds, which is not a failure. Compute the sums over filter_data exactly as passed to this function: this wrapper guarantees that whatever filter preparation it performs internally preserves the per-output-channel sums, so no reversed or otherwise rearranged copy of the weights is needed for this step. Pass a valid context on every build. Currently the contents are read only on builds with the MVE extension (ARM_MATH_MVEI), where the reverse-convolution route forwards this context to arm_convolve_s8(); an unfilled buffer there yields wrong output while still returning ARM_CMSIS_NN_SUCCESS, and a NULL buf is currently reported as ARM_CMSIS_NN_ARG_ERROR. On other builds the contents are currently not read. None of this is a guarantee about future versions. Sized by arm_convolve_s8_get_weights_sum_size(): output_dims->c * sizeof(int32_t) where the sums are used, 0 otherwise. The caller is expected to clear the buffer, if applicable, for security reasons.

  • reverse_conv_ctx[inout] Function context for the reversed filter used when this wrapper routes to the reverse convolution. Holds filter height * filter width * input channels * output channels int8 values; arm_transpose_conv_s8_get_reverse_conv_buffer_size() returns the required size (0 when the reverse-convolution route is not taken). The caller is expected to clear the buffer, if applicable, for security reasons.

  • transpose_conv_params[in] Convolution parameters (e.g. strides, dilations, pads,…). Range of transpose_conv_params->input_offset : [-127, 128] Range of transpose_conv_params->output_offset : [-128, 127]

  • quant_params[in] Per-channel quantization info. It contains the multiplier and shift values to be applied to each out channel.

  • input_dims[in] Input (activation) tensor dimensions. Format: [N, H, W, C_IN]

  • input_data[in] Input (activation) data pointer. Data type: int8

  • filter_dims[in] Filter tensor dimensions. Format: [C_OUT, HK, WK, C_IN] where HK and WK are the spatial filter dimensions

  • filter_data[in] Filter data pointer. Data type: int8

  • bias_dims[in] Bias tensor dimensions. Format: [C_OUT]

  • bias_data[in] Optional bias data pointer. Data type: int32

  • output_dims[in] Output tensor dimensions. Format: [N, H, W, C_OUT]

  • output_data[out] Output data pointer. Data type: int8

Returns:

The function returns either ARM_CMSIS_NN_ARG_ERROR if argument constraints fail. or, ARM_CMSIS_NN_SUCCESS on successful completion.