A small package to create visualizations of PyTorch execution graphs
Project description
PyTorchViz
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 torchviz
Usage
Example usage of 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)
Acknowledgements
The script was moved from functional-zoo where it was created with the help of Adam Paszke, Soumith Chintala, Anton Osokin, and uses bits from tensorboard-pytorch. Other contributors are @willprice, @soulitzer, @albanD.
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
Built Distribution
File details
Details for the file torchviz-0.0.3.tar.gz
.
File metadata
- Download URL: torchviz-0.0.3.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e95f2fea7a31ec9549f2d6bbf446d75aeb6a9880fcf13e7dd843fdcdb4a3725 |
|
MD5 | b4597c4122d9b515036273bf40f6c673 |
|
BLAKE2b-256 | 5c80a84e0e8877630262c3f4c8d2e7fd0647c6751afeca301cfc04a1b65ac820 |
Provenance
The following attestation bundles were made for torchviz-0.0.3.tar.gz
:
Publisher:
workflow.yml
on albanD/pytorchviz
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
torchviz-0.0.3.tar.gz
- Subject digest:
2e95f2fea7a31ec9549f2d6bbf446d75aeb6a9880fcf13e7dd843fdcdb4a3725
- Sigstore transparency entry: 152766128
- Sigstore integration time:
- Permalink:
albanD/pytorchviz@2592bb4e808b2e63078bc8eb14728bc7ceea45eb
- Branch / Tag:
refs/tags/v0.0.3
- Owner: https://github.com/albanD
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
workflow.yml@2592bb4e808b2e63078bc8eb14728bc7ceea45eb
- Trigger Event:
push
- Statement type:
File details
Details for the file torchviz-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: torchviz-0.0.3-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5eab98d17cbe8a54727cfa6a527681cff613430fff8fc68f52302ca5fa26cdf1 |
|
MD5 | 6e6c4d2f92d0a4c0a2264b8f2ee0f9e9 |
|
BLAKE2b-256 | 5e06bea648249802b65282414caf5e7bc94fcb6e5a3e311b537845417d19edb9 |
Provenance
The following attestation bundles were made for torchviz-0.0.3-py3-none-any.whl
:
Publisher:
workflow.yml
on albanD/pytorchviz
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
torchviz-0.0.3-py3-none-any.whl
- Subject digest:
5eab98d17cbe8a54727cfa6a527681cff613430fff8fc68f52302ca5fa26cdf1
- Sigstore transparency entry: 152766129
- Sigstore integration time:
- Permalink:
albanD/pytorchviz@2592bb4e808b2e63078bc8eb14728bc7ceea45eb
- Branch / Tag:
refs/tags/v0.0.3
- Owner: https://github.com/albanD
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
workflow.yml@2592bb4e808b2e63078bc8eb14728bc7ceea45eb
- Trigger Event:
push
- Statement type: