matlab/matlab-agentic-toolkit / skills-catalog/ai-and-statistics/matlab-deploy-embedded-ai
matlab-deploy-embedded-ai
VerifiedDeploy AI models to embedded hardware using MathWorks tools (MATLAB, Simulink, Embedded Coder). Covers two workflow patterns: (1) MathWorks-native or imported models rebuilt as dlnetwork for lean hardware, (2) direct C/C++ code generation from PyTorch and LiteRT models. Both patterns support all targets (Cortex-M/A/R, x86, GPU). Trigger when: user wants to deploy AI to embedded targets; generate C/CUDA from neural networks; compress AI models for MCU; integrate AI in Simulink for system-level simulation; import PyTorch/ONNX/TensorFlow models for embedded deployment; optimize AI for resource-constrained hardware; or use loadPyTorchExportedProgram, loadLiteRTModel, importNetworkFromPyTorch, importNetworkFromONNX, importNetworkFromTensorFlow, importNetworkFromKeras, dlquantizer, exportNetworkToSimulink, or Embedded Coder with AI models.
references/pattern1/compression-pruning.md
View on GitHub# Pruning (Structured Weight Removal)
Pruning removes the least important convolutional filters to reduce model size and
computation. Use `compressNetworkUsingTaylorPruning` — it handles the full iterative
workflow (score calculation, filter removal, fine-tuning) in a single call.
```matlab
% Define fine-tuning options for the pruning loop
options = trainingOptions("adam", ...
MaxEpochs=10, ...
MiniBatchSize=32, ...
InitialLearnRate=1e-4, ...
Verbose=false);
% Prune: remove 30% of learnable parameters
[prunedNet, info] = compressNetworkUsingTaylorPruning(net, XTrain, YTrain, ...
"crossentropy", options, ...
LearnablesReductionGoal=0.3, ...
LearnablesReductionIncrement=0.05, ...
Plots="pruning-progress");
% Inspect results
fprintf("Achieved reduction: %.1f%%\n", info.LearnablesReduction * 100);
fprintf("Pruned layers: %s\n", strjoin(info.PrunedLayerNames, ", "));
fprintf("Stop reason: %s\n", info.StopReason);
```
For the full list of name-value arguments, defaults, and behavior, consult the
function's help (`help compressNetworkUsingTaylorPruning`) or the
[reference page](https://www.mathworks.com/help/deeplearning/ref/compressnetworkusingtaylorpruning.html)
rather than relying on a list in this file. Two name-value arguments that are
worth flagging because they affect the recipe:
- `LearnablesReductionGoal` — target proportion of parameters to remove. Drives
the trade-off between flash savings and accuracy.
- `ValidationThreshold` — stops the iterative pruning loop when the validation
metric at the end of a fine-tuning cycle drops below the threshold. Use this
when accuracy is the primary constraint (see the "Maximize accuracy" recipe in [`compression-decision.md`](compression-decision.md)).
**Notes:**
- Requires the Deep Learning Toolbox Model Compression Library (support package). If
`which compressNetworkUsingTaylorPruning` returns "not found" on a system
with the support package installed, the SPKG is on a stale build — ask the
user to update the support package via Add-On Explorer.
- **Which API to use:**
- `compressNetworkUsingTaylorPruning` — use when the network can be trained
with `trainnet` (single-network training, including custom loss functions).
Output is a standard `dlnetwork` — no conversion step needed. The function
iteratively scores filters, removes lowest-scoring, and fine-tunes.
- `taylorPrunableNetwork` / `updateScore` / `updatePrunables` — use when
training requires a custom training loop (e.g., GANs, multi-network
encoder-decoder setups). Output is a `taylorPrunableNetwork` object.
- Operates on convolutional layers only; for FC/LSTM/GRU reduction (or for additional conv-layer reduction), use projection
Copyright 2026 The MathWorks, Inc.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |