Install & Compatibility
Where this runs
tested against v0.7.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.10
✕ build_error
✓ 73.6s
py 3.11
✕ build_error
✓ 69.5s
py 3.12
✕ build_error
✓ 65.2s
py 3.13
✕ build_error
✓ 56.3s
py 3.9
✕ build_error
✕ timeout
4787MB installed
● package 4787MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
get_model_complexity_info
✓ from ptflops import get_model_complexity_info
✗ from ptflops.flops_counter import get_model_complexity_info
Old import path (pre-0.7) is deprecated.
Compute FLOPs and parameters for ResNet-18 with a 224x224 input.
import torch
from ptflops import get_model_complexity_info
import torchvision.models as models
net = models.resnet18()
macs, params = get_model_complexity_info(net, (3, 224, 224), as_strings=True, print_per_layer_stat=True)
print('{:<30} {:<8}'.format('Computational complexity: ', macs))
print('{:<30} {:<8}'.format('Number of parameters: ', params))
Upgrade
Version history
0.7.5latest on PyPI · released Aug 20, 2025
Audit
Dependencies
torchrequiredPyTorch is required to define models and run flops computation.