Architecture visualization of Torch models
Project description
VisualTorch aims to help visualize Torch-based neural network architectures. It currently supports generating flow-style, graph-style, and LeNet-style architectures for PyTorch Sequential and Custom models. This tool is adapted from visualkeras, pytorchviz, and pytorch-summary.
Note: 1.0+ is a major release with breaking API changes, but with significantly better features and algorithms - upgrading is recommended. For the old API, use 0.2.5 or older.
Limitation: VisualTorch traces a real forward pass to build the diagram, which has two inherent limitations shared by any tracing-based approach (not bugs, and not fixable without full symbolic execution): (1) models with data-dependent control flow (e.g. a branch only taken if a tensor value crosses some threshold) only show whichever branch the traced dummy input happened to take; (2) a layer that returns multiple meaningful output tensors (e.g. a custom multi-task head) only has its first tensor's shape reflected in that node's size/label - its downstream connections are still correct either way. Contributions are welcome!
Documentation
Online documentation is available at visualtorch.readthedocs.io.
The docs include usage examples, API references, and other useful information.
Installation
See the Installation page.
Used in Research
VisualTorch has been used in published research, including works published in Nature, IEEE, and MDPI.
See the Research Showcase page for the full list.
Examples
See the Usage Examples page.
Contributing
Please feel free to send a pull request to contribute to this project by following this guideline.
License
This poject is available as open source under the terms of the MIT License.
Originally, this project was based on the visualkeras (under the MIT license), with additional modifications inspired by pytorchviz, and pytorch-summary, both of which are also licensed under the MIT license.
Citation
Please cite this project in your publications if it helps your research.
Note: the paper below describes the API as of its publication date (2024). VisualTorch has since had breaking API changes (see the documentation for the current API) - the DOI always resolves to what was actually reviewed and published, so it isn't updated to match.
@article{Hendria2024,
doi = {10.21105/joss.06678},
url = {https://doi.org/10.21105/joss.06678},
year = {2024},
publisher = {The Open Journal},
volume = {9},
number = {102},
pages = {6678},
author = {Willy Fitra Hendria and Paul Gavrikov},
title = {VisualTorch: Streamlining Visualization for PyTorch Neural Network Architectures},
journal = {Journal of Open Source Software}
}
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file visualtorch-1.1.0.tar.gz.
File metadata
- Download URL: visualtorch-1.1.0.tar.gz
- Upload date:
- Size: 51.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38ad854f602e64f38fc38dfa6a0a38615fde28751ae17b95445dbcdc609a8665
|
|
| MD5 |
6fb0cc9873cb8f179afd6b7d612c6341
|
|
| BLAKE2b-256 |
26980dbb3ed63125938359980f06bdc28bd213a32e4da784c21d3a901049bccb
|
File details
Details for the file visualtorch-1.1.0-py3-none-any.whl.
File metadata
- Download URL: visualtorch-1.1.0-py3-none-any.whl
- Upload date:
- Size: 43.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b99df6342c9f0846fa1405abf6ff2f7ab85b18ec3985248e82b23c2de258fac
|
|
| MD5 |
1c741c407d2e458d4030381635966615
|
|
| BLAKE2b-256 |
dad888e091314ce6acc570dd554e8243a2d00ed0a25a5ff7f5801cb8b4cca7ed
|