快速入门
学习 MATLAB® Coder™ Support Package for PyTorch® and LiteRT Models 的基础知识
自 R2026a 起
自 R2026a 起
使用 MATLAB Coder Support Package for PyTorch and LiteRT Models,您可以:
将 PyTorch ExportedProgram 和 LiteRT(TensorFlow Lite 或 TFLite)模型加载到 MATLAB 代码和 Simulink® 模型中。您可以加载各种预训练的深度学习网络,包括 YOLOv11、Whisper、DINOv2、Depth Anything 和 SAM2。
通过将 TensorFlow 或 Keras 模型转换为 LiteRT 格式来为其生成代码。
为 PyTorch ExportedProgram 和 LiteRT 模型生成独立于目标的 C 和 C++ 代码并部署这些代码。
使用 GPU Coder™ 生成优化的纯 CUDA® 代码。
使用代码替换库为目标硬件合并特定于处理器的固有函数。
要获得此支持包,请执行 Install MATLAB Coder Support Package for PyTorch and LiteRT Models 中所述的步骤。
函数
coder.torchSetup | Install third-party tools for PyTorch code generation |
主题
- Install MATLAB Coder Support Package for PyTorch and LiteRT Models
Install the support package and tools for code generation for PyTorch and LiteRT models.
- Prepare PyTorch Models for MATLAB and Simulink Code Generation
Export a PyTorch model as a ExportedProgram file to be loaded with loadPyTorchExportedProgram.
- Verify Numerical Consistency of a LiteRT or PyTorch ExportedProgram Model in Python
Verify numerical consistency between Python® and MATLAB.