# Lyken17/pytorch-OpCounter

Count the MACs / FLOPs of your PyTorch model.

Repository: https://github.com/Lyken17/pytorch-OpCounter
Canonical: https://ross.abutalabs.com/products/pytorch-opcounter
Language: Python
License: MIT
License Family: permissive
Last push: 2024-07-08T06:44:15+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 3141, "days_push": 786, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 5078, forks 535 (observed 2026-08-28T04:09:09.500461+00:00)

## What it is
THOP (PyTorch-OpCounter) is a Python library that counts the MACs/FLOPs and parameters of PyTorch models. It profiles arbitrary nn.Modules with support for custom operations and includes benchmarks for popular torchvision models.

## Use cases
- count flops of a pytorch model
- measure macs of resnet50
- estimate model computational complexity
- count parameters in a neural network
- compare compute cost of different model architectures
- profile custom pytorch modules for flop counting

## When to choose
- you need quick MACs/FLOPs and parameter counts for PyTorch models
- you want to benchmark standard torchvision architectures
- you need custom counting rules for third-party modules

## When to avoid
- you need runtime latency or memory profiling rather than static op counts
- you work outside PyTorch (e.g., TensorFlow or JAX)
- you need highly accurate hardware-aware performance measurement

## Facets
- artifact type: library
- maturity: maintenance
- function: machine-learning, benchmarking, developer-tools
- domain: deep-learning, machine-learning, developer-tools
- platform: python
- tags: pytorch, flops, macs, model-complexity, profiling

## Member repositories
- Lyken17/pytorch-OpCounter (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:09.500461+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:02:35.942745+00:00, confidence not recorded.
  - readme: https://github.com/Lyken17/pytorch-OpCounter (fetched 2026-08-28T04:09:09.500461+00:00, sha 027e35d64863)
- Data as of 2026-08-30T08:39:29.467469+00:00.
