$npx skillfedfor your agent

ultralytics-thop

Ultralytics THOP package for fast computation of PyTorch model FLOPs and parameters.

Worth itPyPI Software DevelopmentReleased Jul 20266.5M downloads / moAGPL-3.0Pure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — ultralytics_thop-2.1.6-py3-none-any.whl
v2.1.6 · released 2026-07-30 · Python >=3.8 · 2 runtime deps: numpy, torch

Yes. THOP is actively maintained, has no known vulnerabilities, installs with minimal friction (two common dependencies), and solves a concrete problem in model development. The AGPL-3.0 license is a consideration only if you plan to distribute proprietary modifications; for research, internal tools, or open-source projects, it poses no barrier. Install it if you need to profile PyTorch model efficiency.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires PyTorch and a compatible model instance; the profile() call executes a forward pass so the model must be in a state ready to accept the provided input tensor shape.
  • Low friction installation with only numpy and torch as runtime dependencies.
  • Actively maintained by Ultralytics with a recent release (15 days old) and ongoing repository activity.

License · maintenance · safety

AGPL-3.0 (agpl) — Licensed under AGPL-3.0, which requires derivative works and modifications to remain open-source. An enterprise license is available from Ultralytics for proprietary use without open-source obligations.

last release 2026-07-30 (15 days) · last repo commit 2026-08-02 · 151 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 6,458,146 downloads/mo, #1,907 on PyPI

Verify before relying

pip install ultralytics-thop

import torch
from thop import profile

model = torch.nn.Sequential(torch.nn.Conv2d(3, 64, 3, padding=1))
inputs = (torch.randn(1, 3, 224, 224),)
macs, params = profile(model, inputs=inputs)
print(f"MACs: {macs}, Parameters: {params}")
  • Whether custom counting rules for third-party modules are extensible enough for all common modern architectures beyond the built-in layer types.
  • Performance overhead of profiling on very large models or when profiling is called repeatedly during training.
  • Accuracy of MAC estimates when using the stride parameter for spatial-only models versus actual deployment compute.
Same gist for agents: .md · .json

What it is and what it does

THOP is a PyTorch operation counter that measures model complexity by counting Multiply-Accumulate Operations and parameters. It runs a single forward pass through your model with example inputs and returns MAC and parameter counts, making it useful for comparing architecture efficiency before training or deployment. The package includes built-in counting rules for common layer types (convolutional, normalization, pooling, activation, linear, recurrent) and allows you to define custom counting rules for unsupported modules via forward hooks.

The package is lightweight and maintained by Ultralytics, with support for modern Python versions (3.8 through 3.14) across Linux, macOS, and Windows. It depends only on numpy and torch, keeping installation friction minimal. For image models, you can pass a stride parameter to estimate MACs from smaller stride-aligned profiles, or omit it for exact single-pass profiling. A helper function (clever_format) converts raw counts into human-readable notation.

Use it for

  • Compare computational complexity of different neural network architectures before training to choose the most efficient design.
  • Estimate deployment requirements by profiling model MACs and parameters to predict inference latency and memory usage.
  • Analyze custom or third-party layer implementations by registering custom counting rules to understand their computational cost.
  • Profile models with variable input sizes using the stride parameter to estimate MACs across different spatial dimensions.
  • Convert raw operation counts into human-readable format using clever_format for reporting and documentation.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

THOP is actively maintained, has no known vulnerabilities, installs with minimal friction (two common dependencies), and solves a concrete problem in model development. The AGPL-3.0 license is a consideration only if you plan to distribute proprietary modifications; for research, internal tools, or open-source projects, it poses no barrier. Install it if you need to profile PyTorch model efficiency.

Install

ultralytics-thop on PyPI

Before you install

Low friction installation with only numpy and torch as runtime dependencies. Actively maintained by Ultralytics with a recent release (15 days old) and ongoing repository activity.

Requires PyTorch and a compatible model instance; the profile() call executes a forward pass so the model must be in a state ready to accept the provided input tensor shape.

License in practice

Licensed under AGPL-3.0, which requires derivative works and modifications to remain open-source. An enterprise license is available from Ultralytics for proprietary use without open-source obligations.

Quickstart

pip install ultralytics-thop

import torch
from thop import profile

model = torch.nn.Sequential(torch.nn.Conv2d(3, 64, 3, padding=1))
inputs = (torch.randn(1, 3, 224, 224),)
macs, params = profile(model, inputs=inputs)
print(f"MACs: {macs}, Parameters: {params}")

Verify before relying

  • Whether custom counting rules for third-party modules are extensible enough for all common modern architectures beyond the built-in layer types.
  • Performance overhead of profiling on very large models or when profiling is called repeatedly during training.
  • Accuracy of MAC estimates when using the stride parameter for spatial-only models versus actual deployment compute.

Package facts

LicenseAGPL-3.0 agpl
Python supportSupports the current Python release >=3.8
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
numpytorch
MaintenanceActively maintained 15 days since the last release
Last repo commit
First released
Downloads6,458,146 / month, #1,907 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Science/ResearchLicense :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)Operating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Scientific/Engineering :: Image RecognitionTopic :: Software Development

Evidence: ultralytics_thop-2.1.6-py3-none-any.whl

Tags

Capabilities
pytorch model flops countermac operations profilerneural network complexity analyzerpytorch model parameter counterdeep learning model profilingcompute cost estimationarchitecture efficiency comparison
Topics
model-profilingpytorch-toolsperformance-analysis
PyPI keywords
FLOPsPyTorchModel Analysis

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 model flops counter”

  • ultralytics-thopProfiles PyTorch models by counting Multiply-Accumulate Operations…
  • fvcorefvcore provides shared computer vision utilities for PyTorch,…
  • thopCounts floating-point operations (MACs) and parameters in PyTorch…

Give your agent the search over MCP, or paste the wish link into any chat.

More Software Development packages

typing-extensions Worth it
PyPI · Software Development · released Jul 2026

Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.

PSF-2.0pure Python · 3.9+
1.9Bdownloads / mo
numpy Worth it
PyPI · Software Development · released Aug 2026

NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.

BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0compiled wheel · 3.12+
1.1Bdownloads / mo
fastapi Worth it
PyPI · Software Development · released Jul 2026

FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.

MITpure Python · 3.10+
568.6Mdownloads / mo
annotated-doc With conditions
PyPI · Software Development · released Jul 2026

Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.

MITpure Python · 3.9+
456.2Mdownloads / mo
typer Worth it
PyPI · Software Development · released Aug 2026

Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.

Install it if you are building CLIs in Python.

MITpure Python · 3.10+
369.3Mdownloads / mo
distlib With conditions
PyPI · Software Development · released Jun 2026

Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.

permissive licensepure Python
323.3Mdownloads / mo

See also thop · torchprofile · torchsummary · effdet · torch · ultralytics · pytorchcv · opt-einsum-fx · onnx-tool · torchinfo