coder.ARMNEONConfig - Parameters to configure deep learning code generation with the ARM Compute Library - MATLAB (original) (raw)
Main Content
Parameters to configure deep learning code generation with the ARM Compute Library
Description
The coder.ARMNEONConfig
object contains ARMĀ® Compute Library and target specific parameters that codegen uses for generating C++ code for deep neural networks.
To use a coder.ARMNEONConfig
object for code generation, assign it to the DeepLearningConfig
property of a code generation configuration object that you pass to codegen
.
Creation
Create an ARM NEON configuration object by using the coder.DeepLearningConfig function with target library set as'arm-compute'
.
Properties
Version of ARM Compute Library used on the target hardware, specified as a character vector or string scalar. For more information, see ARM Compute Library version.
ARM architecture supported in the target hardware, specified as a character vector or string scalar. For more information, see ARM Compute architecture.
Specify the precision of the inference computations in supported layers. For more information, see Data type (ARM Compute).
Name of target library, specified as a character vector.
Examples
Create an entry-point function resnet_predict
that uses thecoder.loadDeepLearningNetwork
function to load thedlnetwork
object that contains the SqueezeNet
network. For more information, see Code Generation for dlarray.
function out = resnet_predict(in)
dlIn = dlarray(in, 'SSCB'); persistent dlnet; if isempty(dlnet) dlnet = imagePretrainedNetwork('resnet50'); end
dlOut = predict(dlnet, dlIn); out = extractdata(dlOut);
Create a coder.config
configuration object for generation of a static library.
cfg = coder.config('lib');
Set the target language to C++. Specify that you want to generate only source code.
cfg.TargetLang = 'C++'; cfg.GenCodeOnly=true;
Create a coder.ARMNEONConfig
deep learning configuration object. Assign it to the DeepLearningConfig
property of thecfg
configuration object.
dlcfg = coder.DeepLearningConfig('arm-compute'); dlcfg.ArmArchitecture = 'armv8'; dlcfg.ArmComputeVersion = '20.02.1'; 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 -args {ones(227,227,3,'single')} -config cfg squeezenet_predict
The codegen
command places all the generated files in thecodegen
folder. The folder contains the C++ code for the entry-point function squeezenet_predict.cpp
, header, and source files containing the C++ class definitions for the neural network, weight, and bias files.
Version History
Introduced in R2019a