torchinfo
Model summary in PyTorch, based off of the original torchsummary.
What it is and what it does
Torchinfo is a PyTorch utility that generates human-readable summaries of neural network models. It displays layer-by-layer information including input and output shapes, parameter counts, and multiply-accumulate operations (Mult-Adds), helping developers understand and debug their model architectures. Unlike the basic print(model) output, torchinfo provides a structured, Keras-like summary view.
The package accepts either input tensor shapes or actual input data, performs a forward pass through the model to gather statistics, and returns a ModelStatistics object with configurable output columns. It supports RNNs, LSTMs, branching architectures, and nested layers, with options for verbose mode, custom display widths, and Jupyter Notebook integration.
Use it for:
- Debug neural network architecture by viewing layer-by-layer shapes and parameter counts during model development
- Estimate model memory footprint and computational cost before training on expensive hardware
- Document model structure for papers or reports by capturing formatted summary output
- Verify that model layers are connected correctly and data flows as expected through the network
- Compare parameter efficiency across different model designs or architectures
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates detailed summaries of PyTorch neural network models, showing layer names, input/output shapes, parameter counts, and computational operations—similar to Keras's model.summary() API.
Yes. Torchinfo is a lightweight, actively maintained debugging tool with no dependencies, permissive licensing, and broad PyTorch version support. Install it if you develop or analyze PyTorch models and want structured visibility into layer structure and computational cost.
Install
torchinfo on PyPI
pip
pip install torchinfouv
uv add torchinfopoetry
poetry add torchinfoInstalling torchinfo
Before you install
Low friction: pure Python wheel with no runtime dependencies. Active maintenance with recent commits and 2946 GitHub stars. Last release was over a year ago, but the repository remains actively maintained.
License in practice
MIT license is permissive; you can use, modify, and distribute torchinfo freely in commercial and private projects with minimal restrictions.
Quickstart
pip install torchinfo
from torchinfo import summary
model = ConvNet()
summary(model, input_size=(16, 1, 28, 28))
Requires PyTorch 1.4.0 or later; model must be instantiated before calling summary().
Verify before relying
- Whether the package works correctly with PyTorch versions newer than the latest release date (2023-05-14)
- Performance characteristics when summarizing very large or deeply nested models
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 1,188 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 653,131/month — #5,538 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: torchinfo-1.8.0-py3-none-any.whl
Keywords: torch, pytorch, torchsummary, torch-summary, summary, keras, deep-learning, ml, torchinfo, torch-info, visualize, model, statistics, layer, stats
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
torchsummaryDisplays a Keras-style summary of PyTorch…
unclear · top 15,000 on PyPI
torch-geometricPyTorch Geometric is a library for building and…
permissive · top 5,000 on PyPI
torchevalTorchEval provides a collection of PyTorch…
permissive · top 15,000 on PyPI
ai-edge-model-explorerVisualizes and debugs machine learning model…
permissive · top 15,000 on PyPI
rotary-embedding-torchImplements rotary positional embeddings for…
permissive · top 15,000 on PyPI
pytorch-lightningPyTorch Lightning wraps PyTorch training code…
permissive · top 5,000 on PyPI
edge-mdt-clProvides custom neural network layers for…
permissive · top 15,000 on PyPI
lovely-tensorsMonkey-patches PyTorch tensors to display…
permissive · top 15,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI