torchsummary
Model summary in PyTorch similar to `model.summary()` in Keras
What it is and what it does
torchsummary provides a quick way to inspect neural network models by printing a formatted table of layers, output shapes, and parameter counts—similar to Keras's built-in `model.summary()` method. It works by running a forward pass through the network with dummy input of the specified size and capturing layer information along the way.
The package has no runtime dependencies and installs easily, but it is no longer actively maintained. The original author's description explicitly directs users to torchinfo as a newer, updated alternative. Use torchsummary only if you are working with legacy code or have a specific reason to avoid migrating.
Use it for:
- Quickly inspect the architecture of a custom neural network during development and debugging.
- Estimate total model size in parameters and memory footprint before training or deployment.
- Verify that layer output shapes match expectations when designing a new network.
- Document model structure in notebooks or reports with a clean, readable summary table.
- Check parameter counts across different model variants to compare complexity.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Displays a Keras-style summary of PyTorch neural network models, showing layer types, output shapes, and parameter counts without requiring manual inspection of the model structure.
No—the package is dormant and its own documentation recommends torchinfo as the maintained successor. Install torchsummary only if you are maintaining legacy code that already depends on it; for new projects, use torchinfo instead.
Install
torchsummary on PyPI
pip
pip install torchsummaryuv
uv add torchsummarypoetry
poetry add torchsummaryInstalling torchsummary
Before you install
Installation is frictionless with no runtime dependencies. However, the package is dormant—last release was 2018-09-26 and last commit 2024-03-02—so it receives no active maintenance. The description itself recommends migrating to torchinfo.
License in practice
License treatment is unclear; the description mentions MIT licensing but the metadata lacks formal SPDX declaration. Verify the actual license terms in the repository before relying on it in proprietary or license-sensitive contexts.
Quickstart
pip install torchsummary
from torchsummary import summary
summary(your_model, input_size=(channels, H, W))
Requires a forward pass through the model; input_size parameter must match the expected tensor dimensions for the model's input.
Verify before relying
- Compatibility with recent PyTorch versions—last release predates many breaking changes in the PyTorch API.
- Whether torchinfo is a direct drop-in replacement or requires code changes for existing torchsummary users.
- Current state of maintenance and whether the archived repository flag affects long-term usability.
Package facts
| License | not declared (unclear) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 2,879 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 101,495/month — #12,930 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: torchsummary-1.5.1-py3-none-any.whl
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
torchinfoGenerates detailed summaries of PyTorch neural…
permissive · top 15,000 on PyPI
ultralytics-thopProfiles PyTorch models by counting…
agpl · top 5,000 on PyPI
thopCounts floating-point operations (MACs) and…
permissive · top 5,000 on PyPI
ema-pytorchMaintains an exponential moving average (EMA)…
permissive · top 15,000 on PyPI
torchvizGenerates visual diagrams of PyTorch neural…
permissive · top 5,000 on PyPI
timmTimm provides a large collection of pretrained…
permissive · top 5,000 on PyPI
vit-pytorchProvides PyTorch implementations of Vision…
permissive · top 15,000 on PyPI
pnnxExports and converts PyTorch neural network…
permissive · top 15,000 on PyPI
torch-model-archiverTorch Model Archiver creates .mar archive files…
permissive · top 15,000 on PyPI
onnx2torchConverts ONNX models to PyTorch modules with a…
permissive · top 15,000 on PyPI