A small package to create visualizations of PyTorch execution graphs
Project description
PyTorchViz
This is a fork of the original package torchviz
, which is no longer maintained.
A small package to create visualizations of PyTorch execution graphs and traces.
Installation
Install graphviz, e.g.:
brew install graphviz
Install the package itself:
pip install torchviz2
Usage
Example usage of make_dot
:
import torch
from torch import nn
from torchviz import make_dot
model = nn.Sequential()
model.add_module('W0', nn.Linear(8, 16))
model.add_module('tanh', nn.Tanh())
model.add_module('W1', nn.Linear(16, 1))
x = torch.randn(1, 8)
y = model(x)
make_dot(y.mean(), params=dict(model.named_parameters()))
Set show_attrs=True
and show_saved=True
to see what autograd saves for the backward pass. (Note that this is only available for pytorch >= 1.9.)
model = nn.Sequential()
model.add_module('W0', nn.Linear(8, 16))
model.add_module('tanh', nn.Tanh())
model.add_module('W1', nn.Linear(16, 1))
x = torch.randn(1, 8)
y = model(x)
make_dot(y.mean(), params=dict(model.named_parameters()), show_attrs=True, show_saved=True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
torchviz2-0.0.2.tar.gz
(5.7 kB
view details)
Built Distribution
File details
Details for the file torchviz2-0.0.2.tar.gz
.
File metadata
- Download URL: torchviz2-0.0.2.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7db33c6701354dc48944d51fd267fc72df9b141007bfcd7ca7963198ebc26fe5 |
|
MD5 | b5ce97f04ca4bc758c3b2421343fa768 |
|
BLAKE2b-256 | 5b9fc0e0d7e790003c8bc7c7db5ccaf49710a1ccc46de066bbb6b630ef5b55c8 |
File details
Details for the file torchviz2-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: torchviz2-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b81fc6e925136cb97c21893355941c39aa6ce9f0d45e3aef8d54d0ac0eacaa47 |
|
MD5 | eb97770daac503445ab5c275f27816eb |
|
BLAKE2b-256 | 62897aa6ad8acb05a26b83ebfc510fb61eaeb1ca74480ea390d8cd26adba2a5f |