PyTorchViz
==========
A small package to create visualizations of PyTorch execution graphs and traces.
[](https://colab.research.google.com/github/szagoruyko/pytorchviz/blob/master/examples.ipynb)
## 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](https://github.com/szagoruyko/functional-zoo) where it was created with the help of Adam Paszke, Soumith Chintala, Anton Osokin, and uses bits from [tensorboard-pytorch](https://github.com/lanpa/tensorboard-pytorch).
Other contributors are [@willprice](https://github.com/willprice), [@soulitzer](https://github.com/soulitzer), [@albanD](https://github.com/albanD).
Raw data
{
"_id": null,
"home_page": "https://github.com/pytorch/pytorchviz",
"name": "torchviz",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Sergey Zagoruyko",
"author_email": "sergey.zagoruyko@enpc.fr",
"download_url": "https://files.pythonhosted.org/packages/5c/80/a84e0e8877630262c3f4c8d2e7fd0647c6751afeca301cfc04a1b65ac820/torchviz-0.0.3.tar.gz",
"platform": null,
"description": "PyTorchViz\n==========\n\nA small package to create visualizations of PyTorch execution graphs and traces.\n\n[](https://colab.research.google.com/github/szagoruyko/pytorchviz/blob/master/examples.ipynb)\n\n## Installation\n\nInstall graphviz, e.g.:\n\n```\nbrew install graphviz\n```\n\nInstall the package itself:\n\n```\npip install torchviz\n```\n\n\n## Usage\nExample usage of `make_dot`:\n```\nmodel = nn.Sequential()\nmodel.add_module('W0', nn.Linear(8, 16))\nmodel.add_module('tanh', nn.Tanh())\nmodel.add_module('W1', nn.Linear(16, 1))\n\nx = torch.randn(1, 8)\ny = model(x)\n\nmake_dot(y.mean(), params=dict(model.named_parameters()))\n```\n\n\nSet `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.)\n```\nmodel = nn.Sequential()\nmodel.add_module('W0', nn.Linear(8, 16))\nmodel.add_module('tanh', nn.Tanh())\nmodel.add_module('W1', nn.Linear(16, 1))\n\nx = torch.randn(1, 8)\ny = model(x)\n\nmake_dot(y.mean(), params=dict(model.named_parameters()), show_attrs=True, show_saved=True)\n```\n\n\n## Acknowledgements\n\nThe script was moved from [functional-zoo](https://github.com/szagoruyko/functional-zoo) where it was created with the help of Adam Paszke, Soumith Chintala, Anton Osokin, and uses bits from [tensorboard-pytorch](https://github.com/lanpa/tensorboard-pytorch).\nOther contributors are [@willprice](https://github.com/willprice), [@soulitzer](https://github.com/soulitzer), [@albanD](https://github.com/albanD).\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "A small package to create visualizations of PyTorch execution graphs",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/pytorch/pytorchviz"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5e06bea648249802b65282414caf5e7bc94fcb6e5a3e311b537845417d19edb9",
"md5": "6e6c4d2f92d0a4c0a2264b8f2ee0f9e9",
"sha256": "5eab98d17cbe8a54727cfa6a527681cff613430fff8fc68f52302ca5fa26cdf1"
},
"downloads": -1,
"filename": "torchviz-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6e6c4d2f92d0a4c0a2264b8f2ee0f9e9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5708,
"upload_time": "2024-12-02T02:46:52",
"upload_time_iso_8601": "2024-12-02T02:46:52.838950Z",
"url": "https://files.pythonhosted.org/packages/5e/06/bea648249802b65282414caf5e7bc94fcb6e5a3e311b537845417d19edb9/torchviz-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5c80a84e0e8877630262c3f4c8d2e7fd0647c6751afeca301cfc04a1b65ac820",
"md5": "b4597c4122d9b515036273bf40f6c673",
"sha256": "2e95f2fea7a31ec9549f2d6bbf446d75aeb6a9880fcf13e7dd843fdcdb4a3725"
},
"downloads": -1,
"filename": "torchviz-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "b4597c4122d9b515036273bf40f6c673",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5705,
"upload_time": "2024-12-02T02:46:54",
"upload_time_iso_8601": "2024-12-02T02:46:54.671106Z",
"url": "https://files.pythonhosted.org/packages/5c/80/a84e0e8877630262c3f4c8d2e7fd0647c6751afeca301cfc04a1b65ac820/torchviz-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-02 02:46:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pytorch",
"github_project": "pytorchviz",
"github_not_found": true,
"lcname": "torchviz"
}