coder.CMSISNNConfig - Parameters to configure deep learning code generation with the CMSIS-NN library for

  Cortex-M targets - MATLAB ([original](https://in.mathworks.com/help/coder/ref/coder.cmsisnnconfig.html)) ([raw](?raw))

Main Content

Parameters to configure deep learning code generation with the CMSIS-NN library for Cortex-M targets

Since R2022a

Description

The coder.CMSISNNConfig object contains CMSIS-NN library and associated ARMĀ® Cortex-M target specific parameters that codegen uses for generating C code for deep neural networks.

To use a coder.CMSISNNConfig object for code generation, assign it to the DeepLearningConfig property of a code generation configuration object that you pass to codegen.

Creation

Create a CMSIS-NN configuration object by using the coder.DeepLearningConfig function with target library set as'cmsis-nn'.

Properties

expand all

Precision of inference computations in supported layers. For more information, seeData type (CMSIS-NN).

Name of target library, specified as a character vector.

Examples

collapse all

Create an entry-point function net_predict that uses thecoder.loadDeepLearningNetwork function to load the network objectnet from the MAT file netFile. The function then performs prediction using this model object.

function out = net_predict(netFile, in) net = coder.loadDeepLearningNetwork(netFile); out = predict(net,in); end

Create a coder.config configuration object for generation of a C static library.

cfg = coder.config('lib');

Create a coder.CMSISNNConfig deep learning configuration object and specify the location of the calibration MAT file. Assign it to theDeepLearningConfig property of the cfg configuration object.

dlcfg = coder.DeepLearningConfig('cmsis-nn'); dlcfg.CalibrationResultFile = 'calibration.mat'; cfg.DeepLearningConfig = dlcfg;

Use the -config option of the codegen function to specify the cfg configuration object. The codegen function must determine the size, class, and complexity of MATLABĀ® function inputs. Use the -args option to specify the size of the input to the entry-point function.

codegen -config cfg net_predict -args {coder.Constant('calibration.mat'), exampleinput}

The codegen command places all the generated files in thecodegen folder.

Version History

Introduced in R2022a