How do I optimize memory usage for a neural network running on an ARM Cortex-M4 using CMSIS-NN?
@Middleware & OS How do I optimize memory usage for a neural network running on an ARM Cortex-M4 using CMSIS-NN? My current model runs out of memory. Here's my code:
#include "arm_nnfunctions.h"void run_nn(const q7_t* input_data) { q7_t intermediate_buffer[INTERMEDIATE_SIZE]; q7_t output_data[OUTPUT_SIZE]; // Run the network layers arm_convolve_HWC_q7_basic(input_data, CONV1_WEIGHT, CONV1_BIAS, intermediate_buffer
#include "arm_nnfunctions.h"void run_nn(const q7_t* input_data) { q7_t intermediate_buffer[INTERMEDIATE_SIZE]; q7_t output_data[OUTPUT_SIZE]; // Run the network layers arm_convolve_HWC_q7_basic(input_data, CONV1_WEIGHT, CONV1_BIAS, intermediate_buffer
Solution
Did you consider reuse buffers for intermediate and output data