Practical overview
When it fits
Use it when a PyTorch project needs an MLP-Mixer-style classifier and the model dimensions can be configured for its image or video input.
Who it is for
- PyTorch developers adding an MLP-based image classifier to an application or experiment.
- Researchers or developers prototyping classification on rectangular images or video tensors.
Documented uses
- Configure an image-classification model with chosen image dimensions and class count.
- Generate class predictions from square or rectangular image tensors.
- Configure a 3D model for video inputs and generate class predictions.
Requirements & limits
The repository is public and lists an MIT license. The README documents installation through pip.
- The library exposes separate MLPMixer and MLPMixer3D classes for image and video inputs.
- The documented image examples support both square and rectangular dimensions.
- Model configuration includes patch size, dimension, depth and number of classes; video configuration also includes temporal size and patching.
- The README demonstrates prediction calls but does not document training or pretrained weights.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Create an image classifier and obtain predictions
Install the package, configure an MLPMixer for square or rectangular image input, and call it on a PyTorch tensor.
Before you start
- Python environment with PyTorch available.
- Install the package with
pip install mlp-mixer-pytorch.
Steps
Import
torchandMLPMixerfrommlp_mixer_pytorch.Configure
MLPMixerwith image size, channels, patch size, dimension, depth and number of classes.Create an input tensor matching the configured image dimensions and call the model with that tensor.
Expected outcome
The example returns a prediction tensor whose final dimension corresponds to the configured number of classes.
Guide limitations
- The documented example uses a randomly generated tensor, not a dataset or trained-model workflow.
Configure a video classifier and obtain predictions
Install the package, configure MLPMixer3D for video dimensions, and call it on a PyTorch video tensor.
Before you start
- Python environment with PyTorch available.
- Install the package with
pip install mlp-mixer-pytorch.
Steps
Import
torchandMLPMixer3Dfrommlp_mixer_pytorch.Set image size, time size, time patch size, channels, patch size, dimension, depth and number of classes.
Create a video tensor matching the documented channel, time, height and width dimensions, then call the model.
Expected outcome
The example returns a prediction tensor with one class-score vector per input batch item.
Guide limitations
- The documented example uses a randomly generated tensor; it does not describe data preparation, training or evaluation.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 4 November 2026
- Original website title
- lucidrains/mlp-mixer-pytorch · Official homepage title · retained in its source language

