loadPyTorchExportedProgram
R2026bSyntax
Description
Add-On Required: This feature requires the MATLAB Coder Support Package for PyTorch and LiteRT Models add-on.
loads a pretrained PyTorch® ExportedProgram model file.model = loadPyTorchExportedProgram(modelFileName)
Note
This function takes a PyTorch ExportedProgram model file as input.
You must first export a PyTorch model to a torch.export.ExportedProgram in PyTorch
version 2.7.1 to version 2.11, and save it as a PT2 PyTorch ExportedProgram file. For more
information, see Prepare PyTorch Models for MATLAB and Simulink Code Generation.
loads a pretrained PyTorch ExportedProgram model file using the specified execution mode.model = loadPyTorchExportedProgram(modelFileName,ExecutionMode=ExecutionMode)
Examples
Input Arguments
Output Arguments
Extended Capabilities
Version History
Introduced in R2026a