Contenido principal

Generate Code for PyTorch and LiteRT Models in MATLAB

Generate generic C, C++, and plain CUDA code from MATLAB® code
Since R2026a

You can load a PyTorch® ExportedProgram or LiteRT model into MATLAB and generate generic C/C++ code.

If you have a GPU Coder™ license, you can also generate CUDA® code.

Functions

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

Objects

PyTorchExportedProgramPyTorch ExportedProgram model
LiteRTModelLiteRT model

Featured Examples