EDGE FDE
IntermediatePyTorch to Core AI in Xcode
On a Mac, train a small clothing model on Fashion-MNIST. Use MPS if you have it, or CPU if you do not. Convert it to .aimodel, then show the top label in a SwiftUI app with Core AI.
This course is for you if you can write Python and Swift, and you are new to Core AI.
Lessons
Key concepts
- Train
ClothingCNNon Fashion-MNIST on a Mac with MPS or CPU. Never CUDA. - Save
clothing.pt, export, then convert withcoreai-torchtoclothing.aimodel. - Fixed contract: input
imageis NCHW[1, 1, 28, 28]float32. Outputlogitsis[1, 10]float32. - Xcode 27 loads function
main. Prepare once. Softmax is for display only.
Takeaways
- You can train, convert, and show a clothing label in a SwiftUI Core AI app.
- You can profile load, specialisation, and inference on a real device.
- You can check held-out accuracy, Mac versus Core AI labels, and a yes or no top-label rule.
Agent briefs
Related courses
PyTorch to Android with LiteRT · From the metal to the model · Model architectures in plain English · Diffusion LoRA to Core AI on device