coder.ARMNEONConfig

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

Description

example

deepLearningCfg = coder.DeepLearningConfig('arm-compute') creates a coder.ARMNEONConfig object for deep learning code generation by using the ARM Compute Library.

Properties

expand all

Version of ARM Compute Library used on the target hardware, specified as a character vector or string scalar. If you set ArmComputeVersion to a version later than '19.05', ArmComputeVersion is set to '19.05'.

ARM architecture supported in the target hardware, specified as a character vector or string scalar. The specified architecture must be the same as the architecture for the ARM Compute Library on the target hardware.

ARMArchitecture must be specified for these cases:

  • You do not use a hardware support package (the Hardware property of the code generation configuration object is empty).

  • You use a hardware support package, but generate code only.

Name of target library, specified as a character vector.

Examples

collapse all

Create an entry-point function squeezenet that uses the coder.loadDeepLearningNetwork function to load the squeezenet (Deep Learning Toolbox) object.

function out = squeezenet_predict(in)

persistent mynet;
if isempty(mynet)
    mynet = coder.loadDeepLearningNetwork('squeezenet', 'squeezenet');
end

out = predict(mynet,in);

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 the cfg configuration object.

dlcfg = coder.DeepLearningConfig('arm-compute');
dlcfg.ArmArchitecture = 'armv8';
dlcfg.ArmComputeVersion = '19.05';
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 the codegen 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 convolutional neural network (CNN), weight, and bias files.

Introduced in R2019a