skillfed

torchinfo

Model summary in PyTorch, based off of the original torchsummary.

torchinfo v1.8.0 653.1K downloads/30d#5,538 on PyPI2,946
Permissive license MIT Active released

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 torchinfo

uv

uv add torchinfo

poetry

poetry add torchinfo

Installing 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

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

pytorch model summaryinspect neural network layerspytorch model visualizationlayer parameter analysismodel architecture debuggingpytorch model statisticsnetwork complexity analysis
pytorch-debuggingmodel-inspectiondeep-learning-tools

More Artificial Intelligence packages