Re-build tensorflow lite model in cmsis-nn

Hi,

Is it possible to rebuild a tensorflow lite model with cmsis-nn to run on a MCU with a Cortex-M? 

We have followed the guide posted on arm:s website for converting neural networks for ARM Cortex-M using CMSIS-NN although it is not for the tflite model we found that it gave a good example for how to start. We then found the s8 layers made specifically for the Tensorflow Lite model (for examplearm_depthwise_conv_s8). However, the documentation is rather poor and we are having troubles understanding all the parameters for the layer function calls. 

Is there any more documentation available for these parameters than in the arm_nnfunctions.h file?

Are there any existing examples for using cmsis-nn with a tflite model?

We are currently using the layers  arm_depthwise_conv_s8, arm_convolve_s8, arm_max_pool_s8_opt, arm_relu_q7 and arm_fully_connected_s8.

Could someone please explain the parameters listed in the code blocks bellow for us?

* @brief S8 basic fully-connected and matrix multiplication layer function for TF Lite
   [...]
   * @param[in]       nb_batches                   number of batches
   * @param[in]       input_offset                 tensor offset for input. Range: -127 to 128
   * @param[in]       filter_offset                tensor offset for filter. Range: -127 to 128
   * @param[in]       out_mult                     requantization parameter
   * @param[in]       out_shift                    requantization parameter
   * @param[in]       output_offset                tensor offset for output. Range: int8
   [...]
   * @param[in]       output_activation_min        for clamping
   * @param[in]       output_activation_max        for clamping
   
   arm_status arm_fully_connected_s8(...);

* @brief Basic s8 convolution function
   [...]
   * @param[in]       output_shift    pointer to per output channel requantization shift parameter.
   * @param[in]       output_mult     pointer to per output channel requantization multiplier parameter.
   * @param[in]       out_offset      output tensor offset. Range: int8
   * @param[in]       input_offset    input tensor offset. Range: int8
   * @param[in]       output_activation_min   Minimum value to clamp the output to. Range: int8
   * @param[in]       output_activation_max   Minimum value to clamp the output to. Range: int8
   
    arm_status arm_convolve_s8(...);

* @brief Basic s8 depthwise convolution function
   [...]
   * @param[in]       output_shift pointer to per output channel requantization shift parameter.
   * @param[in]       output_mult  pointer to per output channel requantization multiplier parameter.
   [...]
   * @param[in]       output_offset   offset to elements of output tensor
   * @param[in]       input_offset    offset to elements of input tensor
   * @param[in]       output_activation_min   Minimum value to clamp the output to. Range: int8
   * @param[in]       output_activation_max   Minimum value to clamp the output to. Range: int8
   [...]
   
   arm_status arm_depthwise_conv_s8_opt();

Thank you!

Parents Reply Children
No data
More questions in this forum