Contenuto principale

Deep Learning Code Generation Fundamentals

R2026b
Functions, objects, and workflows that you can use to generate code for deep learning networks

You can use GPU Coder™ in tandem with the Deep Learning Toolbox™ to generate code and deploy CNN on multiple embedded platforms that use NVIDIA® or ARM® GPU processors. The Deep Learning Toolbox provides simple MATLAB® commands for creating and interconnecting the layers of a deep neural network. The availability of pretrained networks and examples such as image recognition and driver assistance applications enable you to use GPU Coder for deep learning, without expert knowledge on neural networks, deep learning, or advanced computer vision algorithms.

Apps

expand all

GPU CoderGenerate CUDA code from MATLAB code
GPU Environment CheckVerify and set up GPU code generation environment

Functions

expand all

codegenGenerate C or C++ code from MATLAB code
cnncodegen(To be removed) Generate code for a deep learning network to target the ARM Mali GPU
coder.gpuConfigCreate GPU code generation configuration
coder.loadDeepLearningNetworkLoad deep learning network model
coder.DeepLearningConfigCreate deep learning code generation configuration objects
analyzeNetworkForCodegenAnalyze deep learning network for code generation (Since R2022b)
coder.ai.enableParameterUpdateEnables run-time update of network parameters (Since R2025a)
coder.regenerateDeepLearningParametersRegenerate files containing network learnables and states parameters
gpucoder.installTensorRTInstall NVIDIA TensorRT library in MATLAB (Since R2025a)

Objects

expand all

coder.GpuCodeConfigConfiguration parameters for CUDA code generation from MATLAB code
coder.CuDNNConfigParameters to configure deep learning code generation with the CUDA Deep Neural Network library
coder.TensorRTConfigParameters to configure deep learning code generation with the NVIDIA TensorRT library
coder.gpuEnvConfigConfiguration object for checking GPU code generation environment

Code Configuration Parameters

expand all

Deep learning target libraryTarget library for deep learning code generation
Enable auto tuningEnable auto tuning
Data type (cuDNN)Inference computation precision
Calibration result file path (cuDNN)Location of calibration MAT file
Data type (TensorRT)Inference computation precision
Calibration data pathImage dataset location
Number of calibration batchesNumber of calibration batches
Compute precisionCompute precision

Topics

Basics

Code Generation

Optimization and Quantization

Parameter Updates

Code Generation for Third-Party Libraries

Featured Examples