Skip to main content

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.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torchviz-0.0.3.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

torchviz-0.0.3-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

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

Hashes for torchviz-0.0.3.tar.gz
Algorithm Hash digest
SHA256 2e95f2fea7a31ec9549f2d6bbf446d75aeb6a9880fcf13e7dd843fdcdb4a3725
MD5 b4597c4122d9b515036273bf40f6c673
BLAKE2b-256 5c80a84e0e8877630262c3f4c8d2e7fd0647c6751afeca301cfc04a1b65ac820

See more details on using hashes here.

Provenance

The following attestation bundles were made for torchviz-0.0.3.tar.gz:

Publisher: workflow.yml on albanD/pytorchviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for torchviz-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5eab98d17cbe8a54727cfa6a527681cff613430fff8fc68f52302ca5fa26cdf1
MD5 6e6c4d2f92d0a4c0a2264b8f2ee0f9e9
BLAKE2b-256 5e06bea648249802b65282414caf5e7bc94fcb6e5a3e311b537845417d19edb9

See more details on using hashes here.

Provenance

The following attestation bundles were made for torchviz-0.0.3-py3-none-any.whl:

Publisher: workflow.yml on albanD/pytorchviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page