主要内容

MATLAB 中为 PyTorch 和 LiteRT 模型生成代码

从 MATLAB® 代码生成通用 C、C++ 和纯 CUDA 代码
自 R2026a 起

您可以将 PyTorch® ExportedProgram 或 LiteRT 模型加载到 MATLAB 中,并生成通用 C/C++ 代码。

如果您拥有 GPU Coder™ 许可证,您还可以生成 CUDA® 代码。

函数

loadLiteRTModelLoad pretrained LiteRT model file
loadPyTorchExportedProgramLoad PyTorch ExportedProgram model file
summaryDisplay input and output specifications of PyTorch ExportedProgram or LiteRT model
inputSpecificationsReturn input specifications for functions in PyTorch ExportedProgam or LiteRT model
outputSpecificationsReturn output specifications for functions in PyTorch ExportedProgram or LiteRT model
invokeRun inference on a PyTorch ExportedProgram or LiteRT model input to compute output

对象

PyTorchExportedProgramPyTorch ExportedProgram model
LiteRTModelLiteRT model

精选示例