# sovrasov/flops-counter.pytorch

Flops counter for neural networks in pytorch framework

Repository: https://github.com/sovrasov/flops-counter.pytorch
Canonical: https://ross.abutalabs.com/products/flops-counterpytorch
Language: Python
License: MIT
License Family: permissive
Topics: pytorch, pytorch-cnn, deep-neural-networks, deeplearning, pytorch-utils, flops-counter, transformer, transformer-models
Last push: 2025-08-20T17:23:29+00:00

## Health v2 (maintenance only)
Score: 41/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 37, release rhythm 12, longevity 100
- inputs: {"age_days": 2938, "days_push": 378, "days_rel": 378, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2982, forks 306 (observed 2026-08-28T04:07:33.172209+00:00)

## What it is
A Python library (ptflops) that computes the theoretical number of multiply-add operations (FLOPs) and parameter counts for neural network models in PyTorch. It supports two backends (aten and pytorch) and can print per-layer computational cost breakdowns.

## Use cases
- count FLOPs of a PyTorch model
- estimate computational complexity of a CNN or transformer
- count the number of parameters in a neural network
- get per-layer computational cost breakdown of a model
- compare efficiency of model architectures
- measure inference cost of a vision transformer
- profile model complexity for a research paper

## When to choose
- you need theoretical FLOPs or MACs estimates for PyTorch models including transformers
- you want per-layer cost analytics for CNNs
- you need a lightweight pip-installable complexity counter with MIT license

## When to avoid
- you need runtime latency or actual measured speed rather than theoretical operation counts
- you work outside PyTorch (e.g., TensorFlow, JAX)
- you need GPU memory profiling or training-time cost estimation

## Facets
- artifact type: library
- maturity: active
- function: benchmarking, machine-learning, deep-learning, developer-tools
- domain: deep-learning, machine-learning, performance, developer-tools
- platform: python, cross-platform
- tags: flops-counter, pytorch, model-complexity, ptflops, neural-networks, transformers, cnn, parameter-counting

## Member repositories
- sovrasov/flops-counter.pytorch (main) score 41

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:33.172209+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-30T07:31:28.697920+00:00, confidence not recorded.
  - readme: https://github.com/sovrasov/flops-counter.pytorch (fetched 2026-08-28T04:07:33.172209+00:00, sha 3dd494fe3dd6)
- Data as of 2026-08-30T08:39:29.467469+00:00.
