What problem does it solve?
Bringing trained deep learning models from PyTorch, ONNX, or Keras/TensorFlow into MATLAB is error-prone: wrong export formats, missing input sizes, unsupported operators, and silent numeric mismatches can waste hours. This Skill guides the full import pipeline and verifies numerical correctness against the source framework.
Core Features & Use Cases
- PyTorch Import: Export models with torch.export.export to .pt2 and import via importNetworkFromPyTorch, with guidance for traced .pt files requiring PyTorchInputSizes.
- ONNX Import: Import .onnx models with importNetworkFromONNX, resolve uninitialized networks using InputDataFormats, and validate outputs against ONNX Runtime.
- Keras 3 Import: Choose between matlabsaver + importNetworkFromKeras (R2026a+), tf_keras downgrade, or ONNX fallback based on MATLAB release and model features.
- Use Case: You have a ResNet model trained in PyTorch. Export it as .pt2, import it into MATLAB as a dlnetwork, implement any placeholder custom layers, and confirm the MATLAB output matches PyTorch within 1e-4 tolerance.
Quick Start
Import my PyTorch model file model.pt2 into MATLAB and verify its outputs match the original PyTorch model.