--- id: torchviz version: "0.0.3" license: BSD license_treatment: permissive maintenance: dormant --- # torchviz — A small package to create visualizations of PyTorch execution graphs License: permissive · Maintenance: dormant · Downloads: 2.1M/mo ## What it is and what it does torchviz is a small visualization utility for PyTorch that converts neural network computation graphs into diagrams. It takes a PyTorch tensor output and the model's parameters, then uses graphviz to render a visual representation of how data flows through the network's layers and operations during the forward pass. The package can optionally display what autograd saves for the backward pass (available for PyTorch 1.9 and later) by setting `show_attrs=True` and `show_saved=True`. The package is designed for model inspection and debugging—developers use it to understand network architecture visually, verify layer connections, and trace tensor transformations. It depends on torch for the computation graph structure and graphviz for rendering the diagram as an image or PDF. Installation requires both the Python package and the graphviz system library. Use it for: - Visualize a custom neural network architecture to verify layer connections and data flow during forward pass. - Debug autograd computation graphs to understand which operations are tracked for backpropagation. - Generate architecture diagrams for documentation or research papers showing model structure. - Inspect what intermediate tensors and gradients are saved during the forward pass for memory analysis. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Generates visual diagrams of PyTorch neural network computation graphs and autograd traces, showing layer connections and tensor flow through the model. Yes, if you need to visualize PyTorch computation graphs for debugging or documentation. The install is straightforward and the package has no known vulnerabilities. However, maintenance is dormant (620 days since last release), so verify compatibility with your PyTorch version before relying on it for production workflows. The graphviz system dependency is a minor friction point but standard for graph visualization. ## Install pip install torchviz uv add torchviz poetry add torchviz ## Installing torchviz Before you install: Low friction install with a pure Python wheel, but depends on the graphviz system library which must be installed separately. Maintenance is dormant—last release was 620 days ago, though the package remains in the top 5000 by downloads. License in practice: BSD permissive license allows use in most projects without restriction, including commercial and proprietary software. Quickstart: pip install torchviz from torchviz import make_dot import torch from torch import nn model = nn.Sequential(nn.Linear(8, 16), nn.Tanh(), nn.Linear(16, 1)) x = torch.randn(1, 8) y = model(x) make_dot(y.mean(), params=dict(model.named_parameters())) graphviz system library must be installed separately (e.g., `brew install graphviz` on macOS). Verify before relying: - Whether the package works with recent PyTorch versions given 620 days since last release. - Current status of the GitHub repository and whether it is actively maintained by PyTorch maintainers. ## Package facts - License: BSD (permissive) - Python support: unspecified - Install friction: low - Maintenance: dormant - Downloads: 2.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags pytorch graph visualization, neural network architecture diagram, autograd computation graph, pytorch model visualization, tensor flow visualization, pytorch execution trace, pytorch, visualization, debugging [View on SkillFed](https://skillfed.io/packages/torchviz) · [View on PyPI](https://pypi.org/project/torchviz/)