ShuffleNetV2 (fastforks)
ShuffleNet V2 (Ma et al. 2018): channel split and shuffle units.
This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/pytorch/vision at 1f1a920d685d.
Task: classification. Tier: stable. Outputs: logits. Backends: portable, kernels.
Input: one RGB image. Output: ImageNet-1k class logits.
Variants
Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|---|---|---|---|---|
shufflenet_v2_x1_0.tv_in1k@1 |
shufflenetv2_x1-5666bf0f80.pth | 5666bf0f80d1 |
BSD-3-Clause (assumed from code) | yes |
Licence
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: BSD-3-Clause.
Code licence: BSD-3-Clause; the authors do not state a separate weights licence.
Training data: ImageNet-1k (ILSVRC 2012 classification).
Licence evidence: https://github.com/pytorch/vision/blob/1f1a920d685d46dfbe187934b785b7ecb7a182f2/LICENSE
Input size
fixed 224x224: the input is resized (short side 256) and centre-cropped to it
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): shufflenet_v2_x1_0.tv_in1k 224x224 (0.0 GiB peak allocated, 0.1 reserved)
Speed and memory
Classification, synthetic
| model | input | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
|---|---|---|---|---|---|---|---|---|---|---|
shufflenet_v2_x1_0.tv_in1k |
224x224 | 4.79 | 6.53 | 5.01 | 0.804 | 6.0x | 6.2x | 47 / 48 | 39 / 48 | 55 / 76 |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
shufflenet_v2_x1_0.tv_in1k |
1.13 | 1.54 | 1.30 | 1.15 | 0.46 | 0.11 |
torch.compile and TensorRT
| model | input | time: portable | compile | TensorRT fp16 | kernels | preparation: compile (cold first call) | ONNX + engine build | peak MiB (alloc / reserved): portable | compile | kernels | TensorRT (engine + torch) |
|---|---|---|---|---|---|---|---|---|---|---|---|
shufflenet_v2_x1_0.tv_in1k |
224x224 | 5.01 ms | 1.98 ms | 0.329 ms | 0.804 ms | 7.73 s | 16.9 s | 39 / 48 | 71 / 88 | 55 / 76 | 70 / 80 |
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.
Accuracy
On public datasets
fastforks: the model's own resize / crop on the GPU; original: the library's pretrained loader and its PIL eval transform. Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | original fp16 | portable | kernels | note |
|---|---|---|---|---|---|---|
shufflenet_v2_x1_0.tv_in1k |
ImageNet-1k val, 5000 random images, top-1 / top-5 % | 71.00 / 88.72 | 71.06 / 88.74 | 71.04 / 88.80 | 71.10 / 88.78 |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.
Parity with the original code
Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.02 and p99 <= 0.08 (absolute error of the output logits).
Limitations
- At 224 x 224 portable runs 5.0 ms / 39 MB (fp32 original 4.8 ms / 45 MB, fp16 original 6.5 ms / 47 MB); kernels run 0.80 ms but peak 55 MB allocated / 76 MB reserved (original 47 / 45 MB) from cuDNN workspaces of the small convolutions.
Usage
from fastforks import classification
model = classification.load("shufflenet_v2_x1_0.tv_in1k") # mode="auto": the preferred backend from recorded measurements
result = model("photo.jpg")
result.top(5) # top-5 classes
result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: shufflenet_v2_x1_0.tv_in1k.
Kernels backend
classification.load("shufflenet_v2_x1_0.tv_in1k", mode="kernels") runs our CUDA kernels (cudnn_hacc, fvm_conv, fvm_extra, fvm_mb, fvm_r3). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.