深度学习代码生成基础知识
您可以将 MATLAB® Coder™ 与 Deep Learning Toolbox™ 结合使用,从经过训练的 CNN 生成 C++ 代码。然后您可以将生成的代码部署到使用 Intel® 或 ARM® 处理器的嵌入式平台。您还可以从不依赖任何第三方库的经过训练的 CNN 生成泛型 C 或 C++ 代码。
函数
codegen | 从 MATLAB 代码生成 C/C++ 代码 |
coder.loadDeepLearningNetwork | 加载深度学习网络模型 |
coder.DeepLearningConfig | 创建深度学习代码生成配置对象 |
coder.DeepLearningCodeConfig | Parameters to configure deep learning code generation that does not depend on third-party libraries (自 R2021a 起) |
coder.ai.enableParameterUpdate | Enables run-time update of network parameters (自 R2025a 起) |
coder.ARMNEONConfig | Parameters to configure deep learning code generation with the ARM Compute Library |
coder.CMSISNNConfig | Parameters to configure deep learning code generation with the CMSIS-NN library for Cortex-M targets (自 R2022a 起) |
coder.MklDNNConfig | Parameters to configure deep learning code generation with the Intel Math Kernel Library for Deep Neural Networks |
analyzeNetworkForCodegen | 分析深度学习网络以进行代码生成 (自 R2022b 起) |
coder.regenerateDeepLearningParameters | Regenerate files containing network learnables and states parameters (自 R2021b 起) |
代码配置参数
深度学习目标库 | Target library for deep learning code generation |
可学习参数压缩 | Compression type |
ARM Compute Library 版本 | Version of ARM Compute Library |
ARM Compute 架构 | ARM architecture supported in the target hardware |
数据类型(ARM Compute) | Inference computation precision |
标定结果文件路径(ARM Compute) | Location of calibration MAT file |
数据类型(CMSIS-NN) | Inference computation precision |
标定结果文件路径(CMSIS-NN) | Location of calibration MAT file |
主题
- 使用 MATLAB Coder 进行深度学习的前提条件
为用于深度学习网络的代码生成安装相关产品并配置环境。
- 使用 MATLAB Coder 生成深度学习代码的工作流
根据预训练网络生成用于预测的代码。
- 加载预训练网络以用于代码生成
创建一个
dlnetwork
对象或用于代码生成的目标检测器。 - Analyze Network for Code Generation
Check code generation compatibility of a deep learning network.
- 代码生成支持的网络和层
选择目标处理器支持的卷积神经网络。
- Code Generation for dlarray
Use deep learning arrays in MATLAB code intended for code generation.
- dlarray Limitations for Code Generation
Adhere to code generation limitations for deep learning arrays.
- 为深度学习网络生成泛型 C/C++ 代码
从不依赖第三方库的深度学习网络中生成用于预测的 C/C++ 代码。
- Update Network Parameters at Run Time
Update deep learning network parameters at run-time without regenerating code.
- Compress Networks Learnables in bfloat16 Format
Perform learnables compression and generate C/C++ code in Brain Floating Point format, bfloat16.
- Optimize C/C++ Code Performance for Deep Learning Applications without Deep Learning Libraries
Code generation configuration settings that optimize the performance of the generated C/C++ code for a deep learning network.
- 使用 MKL-DNN 的深度学习网络的代码生成
从深度学习网络生成用于预测的 C++ 代码,以 Intel CPU 为目标。
- Code Generation for Deep Learning Networks with ARM Compute Library
Generate C++ code for prediction from a deep learning network, targeting an ARM processor.
- Cross-Compile Deep Learning Code That Uses ARM Compute Library
Generate library or executable code on host computer for deployment on ARM hardware target.
- Generate int8 Code for Deep Learning Networks
Quantize and generate code for a pretrained convolutional neural network.
- Update Network Parameters After Code Generation
Perform post code generation updates of deep learning network parameters.
相关信息
- Deep Learning Toolbox 快速入门 (Deep Learning Toolbox)
- Deep Learning with GPU Coder (GPU Coder)