What problem does it solve?
Deploying a trained PyTorch or LiteRT model as standalone C/C++ or CUDA code requires navigating multiple MATLAB APIs, data layouts, and verification steps, and choosing the wrong import path (e.g., dlnetwork converters) breaks the code generation workflow.
Core Features & Use Cases
- Model Loading and Code Generation: Load .pt2 files with loadPyTorchExportedProgram or .tflite files with loadLiteRTModel, write a codegen entry-point, and generate MEX, static/dynamic libraries, or executables with MATLAB Coder or GPU Coder.
- Numeric Verification: Compare MATLAB inference output against the original PyTorch or LiteRT model using pyrun, then verify MEX output with matlab.unittest tolerances before generating production code.
- Simulink Integration: Use the dedicated PyTorch ExportedProgram or LiteRT blocks from dlosslib, or a MATLAB Function block, with slbuild code generation support.
- Use Case: You have a ResNet model exported as model.pt2 and need a CUDA-accelerated library for deployment. This Skill walks you through loading the model, writing the entry-point with coder.Constant, verifying MEX numerics, and generating the final CUDA library.
Quick Start
Ask your agent to generate a verified MEX and then a C++ static library from your PyTorch .pt2 or LiteRT .tflite model file using MATLAB Coder.