thop
A tool to count the FLOPs of PyTorch model.
Decision gist · record as of 2026-08-14
Yes, if you are actively profiling torch models and can tolerate dormant maintenance. The package is stable for its narrow use case and has no known vulnerabilities, but verify compatibility with your torch version before relying on it in production. Consider alternatives if you need ongoing support or features for very recent model architectures.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires torch as a runtime dependency; model must be a valid PyTorch nn.Module.
- Low friction installation via pip; dormant maintenance status with last commit in July 2024 and no releases since September 2022, though the repository remains active with 5079 stars.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution with minimal legal constraints.
last release 2022-09-07 (1437 days) · last repo commit 2024-07-08 · 5,079 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,035,556 downloads/mo, #4,462 on PyPI
Alternatives
Verify before relying
pip install thop
from thop import profile, clever_format
import torch
model = resnet50()
input_tensor = torch.randn(1, 3, 224, 224)
macs, params = profile(model, inputs=(input_tensor,))
macs, params = clever_format([macs, params], "%.3f")- Whether the package works correctly with recent PyTorch versions given the dormant maintenance status since September 2022.
- Support for modern model architectures beyond those listed in the benchmark results.
- Compatibility with Python versions beyond the unspecified support declaration.
What it is and what it does
THOP is a PyTorch profiling tool that measures the computational cost of neural network models by counting multiply-accumulate operations (MACs) and model parameters. It works by instrumenting torch models during a forward pass to track operations, then reporting aggregate statistics.
The package is designed for model developers and researchers who need to understand the computational footprint of their networks—useful when comparing architectures, optimizing for deployment, or working within compute budgets. It includes built-in counting rules for standard layers and allows custom counting logic for third-party modules. The `clever_format` utility provides readable output formatting.
Use it for
- Compare computational complexity across different neural network architectures before training.
- Profile existing models to identify bottlenecks and guide optimization efforts.
- Estimate deployment feasibility by checking MACs and parameter counts against hardware constraints.
- Benchmark model efficiency for resource-constrained deployment scenarios.
- Validate custom layers by defining counting rules for non-standard torch modules.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are actively profiling torch models and can tolerate dormant maintenance.
The package is stable for its narrow use case and has no known vulnerabilities, but verify compatibility with your torch version before relying on it in production. Consider alternatives if you need ongoing support or features for very recent model architectures.
Install
thop on PyPI
Before you install
Low friction installation via pip; dormant maintenance status with last commit in July 2024 and no releases since September 2022, though the repository remains active with 5079 stars.
Requires torch as a runtime dependency; model must be a valid PyTorch nn.Module.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal legal constraints.
Quickstart
pip install thop
from thop import profile, clever_format
import torch
model = resnet50()
input_tensor = torch.randn(1, 3, 224, 224)
macs, params = profile(model, inputs=(input_tensor,))
macs, params = clever_format([macs, params], "%.3f")
Verify before relying
- Whether the package works correctly with recent PyTorch versions given the dormant maintenance status since September 2022.
- Support for modern model architectures beyond those listed in the benchmark results.
- Compatibility with Python versions beyond the unspecified support declaration.
Package facts
| License | MIT permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagetorch |
| Maintenance | Dormant 1,437 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,035,556 / month, #4,462 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Programming Language :: Python :: 3 |
Evidence: thop-0.1.1.post2209072238-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pytorch flop counter”
- thopCounts floating-point operations (MACs) and parameters in PyTorch…
- torchprofileCounts multiply-accumulate operations (MACs) in PyTorch models by…
- fvcorefvcore provides shared computer vision utilities for PyTorch,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also ultralytics-thop · torchprofile · torchsummary · opt-einsum-fx · torch-tb-profiler · timm · retinaface-py · pretrainedmodels · pnnx · pygount