Main Content

Large constant generation in MATLAB functions

Whether to write large deep learning constants to binary data files

Since R2024a

Model Configuration Pane: Code Generation

Description

The Large constant generation in MATLAB functions parameter determines whether the code generator embeds large constants for a deep neural network (DNN) in the generated source code or writes these constants to binary data files.

To specify the threshold (in bytes) above which the DNN constants are written to binary data files, set the Large constant threshold in MATLAB functions (bytes) parameter. The default value of this parameter is 131072.

This parameter is applicable only if you generate code that does not depend on third-party deep learning libraries.

The generated binary files are located in the code generation folder and are loaded by the generated code at run time. If you relocate these files, set the environment variable CODER_DATA_PATH to this new location before running the generated code.

The code generator always embeds the non-DNN constants in the generated source code, irrespective of the sizes of these constants.

Dependencies

This parameter is enabled by Dynamic memory allocation in MATLAB functions.

Settings

Keep in source files (default) | Write only deep learning constants to data files
Keep in source files

Embed large constants for a deep neural network (DNN) in the generated source code.

Write only deep learning constants to data files

Write large constants for a deep neural network (DNN) in binary data files.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyWrite only deep learning constants to data files
Safety precautionNo impact

Programmatic Use

Parameter: LargeConstantGeneration
Type: character vector
Values:'KeepInSourceFiles' |'WriteOnlyDNNConstantsToDataFiles'
Default:'KeepInSourceFiles'

Version History

Introduced in R2024a