Skip to main content

PyTorchViz

A small package to create visualizations of PyTorch execution graphs and traces.

Open In Colab

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()))

image

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)

image

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.

Metadata

Release files for torchviz 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for torchviz 0.0.3
File Size Uploaded
torchviz-0.0.3.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for torchviz 0.0.3
File Interpreter ABI Platform
torchviz-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 11.4 kB

Release files / torchviz-0.0.3.tar.gz

Download URL torchviz-0.0.3.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2e95f2fea7a31ec9549f2d6bbf446d75aeb6a9880fcf13e7dd843fdcdb4a3725
BLAKE2b-256 checksum
How to use checksums
5c80a84e0e8877630262c3f4c8d2e7fd0647c6751afeca301cfc04a1b65ac820
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2024.

Transparency log

Release files / torchviz-0.0.3-py3-none-any.whl

Download URL torchviz-0.0.3-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5eab98d17cbe8a54727cfa6a527681cff613430fff8fc68f52302ca5fa26cdf1
BLAKE2b-256 checksum
How to use checksums
5e06bea648249802b65282414caf5e7bc94fcb6e5a3e311b537845417d19edb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2024.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page