在 MATLAB 中为 PyTorch 和 LiteRT 模型生成代码
从 MATLAB® 代码生成通用 C、C++ 和纯 CUDA 代码
自 R2026a 起
自 R2026a 起
您可以将 PyTorch® ExportedProgram 或 LiteRT 模型加载到 MATLAB 中,并生成通用 C/C++ 代码。
如果您拥有 GPU Coder™ 许可证,您还可以生成 CUDA® 代码。
函数
loadLiteRTModel | Load pretrained LiteRT model file |
loadPyTorchExportedProgram | Load PyTorch ExportedProgram model file |
summary | Display input and output specifications of PyTorch ExportedProgram or LiteRT model |
inputSpecifications | Return input specifications for functions in PyTorch ExportedProgam or LiteRT model |
outputSpecifications | Return output specifications for functions in PyTorch ExportedProgram or LiteRT model |
invoke | Run inference on a PyTorch ExportedProgram or LiteRT model input to compute output |
对象
PyTorchExportedProgram | PyTorch ExportedProgram model |
LiteRTModel | LiteRT model |


