# Train a PyTorch MNIST digit classifier on Arm

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/cross-platform/pytorch-digit-classification-arch-training/)
- [Prepare a PyTorch Development Environment](https://learn.arm.com/learning-paths/cross-platform/pytorch-digit-classification-arch-training/intro/)
- [Create a PyTorch model for MNIST](https://learn.arm.com/learning-paths/cross-platform/pytorch-digit-classification-arch-training/model/)
- [About PyTorch Model Training](https://learn.arm.com/learning-paths/cross-platform/pytorch-digit-classification-arch-training/intro2/)
- [Perform Training and Save the Model](https://learn.arm.com/learning-paths/cross-platform/pytorch-digit-classification-arch-training/datasets-and-training/)
- [Deploy the Model for Inference](https://learn.arm.com/learning-paths/cross-platform/pytorch-digit-classification-arch-training/inference/)
- [Learn about Inference on Android](https://learn.arm.com/learning-paths/cross-platform/pytorch-digit-classification-arch-training/intro-android/)
- [Create an Android Application](https://learn.arm.com/learning-paths/cross-platform/pytorch-digit-classification-arch-training/user-interface/)
- [Prepare the Test Data](https://learn.arm.com/learning-paths/cross-platform/pytorch-digit-classification-arch-training/prepare-data/)
- [Run the Application](https://learn.arm.com/learning-paths/cross-platform/pytorch-digit-classification-arch-training/app/)
- [Optimizing Neural Network Models in PyTorch](https://learn.arm.com/learning-paths/cross-platform/pytorch-digit-classification-arch-training/intro-opt/)
- [Create an optimized PyTorch model for MNIST](https://learn.arm.com/learning-paths/cross-platform/pytorch-digit-classification-arch-training/model-opt/)
- [Run optimization](https://learn.arm.com/learning-paths/cross-platform/pytorch-digit-classification-arch-training/optimisation/)
- [Update the Android application](https://learn.arm.com/learning-paths/cross-platform/pytorch-digit-classification-arch-training/mobile-app/)
- [Next Steps](https://learn.arm.com/learning-paths/cross-platform/pytorch-digit-classification-arch-training/_next-steps/)

## About this Learning Path

|  |  |
| --- | --- |
| Skill level: | Advanced |
| Reading time: | 2 hrs 40 min |
| Last updated: | 12 Nov 2026 |

|  |  |
| --- | --- |
| Author: | Dawid Borycki<br>[GitHub](https://github.com/dawidborycki) |
| Arm IP: | [Cortex-A](https://support.arm.com/?tab=compute-ip&Product%20Type=Application%20Processors) [Neoverse](https://support.arm.com/?tab=compute-ip&Product%20Type=Infrastructure%20Processors) |
| Tags: | [AI/ML](https://learn.arm.com/tag/ai-ml/) [Windows](https://learn.arm.com/tag/windows) [Linux](https://learn.arm.com/tag/linux) [macOS](https://learn.arm.com/tag/macos) [Android Studio](https://learn.arm.com/tag/android-studio) [Visual Studio Code](https://learn.arm.com/tag/visual-studio-code) |

### Who is this for?
This is an advanced topic for software developers interested in learning how to use PyTorch to create and train a feedforward neural network for digit classification, and also software developers interested in learning how to use and apply optimizations to the trained model in an Android application.

### What will you learn?
After completing this Learning Path, you'll be able to perform the following tasks:
- Prepare a PyTorch development environment.
- Download and prepare the MNIST dataset.
- Create and train a neural network architecture using PyTorch.
- Create an Android app and load the pre-trained model.
- Prepare an input dataset.
- Measure the inference time.
- Optimize a neural network architecture using quantization and fusing.
- Deploy an optimized model in an Android application.

### Prerequisites
Before starting, you'll need the following prerequisites:
- A machine that can run Python3, Visual Studio Code, and Android Studio.
- For the OS, you can use Windows, Linux, or macOS.

### Summary
You’ll build and train a PyTorch feedforward neural network for MNIST digit classification, then use it for inference and Android deployment. You’ll set up Python, prepare the dataset, and train the model. Then, you’ll reload the model’s saved parameters and apply the same preprocessing to new images. You’ll quantize and fuse an optimized variant, integrate it into an Android application, and compare inference times before deployment.
