pypi visualtorchstdioMITupdated 8d ago
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. Its original visual styles were inspired by visualkeras, pytorchviz, pytorch-summary, and torchview; since then, it has grown its own unified tracing backend and architecture-handling logic well beyond its origins.
VisualTorch で何ができる?
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. Its original visual styles were inspired by visualkeras, pytorchviz, pytorch-summary, and torchview; since then, it has grown its own unified tracing backend and architecture-handling logic well beyond its origins.
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 an inherent
limitation shared by any tracing-based approach (not a bug, and not fixable without full symbolic
execution): 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.
Separately, a layer that returns multiple meaningful output tensors (e.g. a custom multi-task
head, or nn.LSTM's (output, (h_n, c_n))) still has its node's size based on only its first
tensor; with show_dimension=True, every output tensor's shape is shown in the label, not just
the first. Downstream connections are correct either way. Contributions are welcome!

Animated Reveal
Every style can also render as an animated GIF, revealing the model one layer/column at a time,
via visualtorch.animate(model, input_shape, style=...) - see it in action for
flow,
graph, and
lenet styles.

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.
MCP integration
VisualTorch includes an optional, client-neutral stdio MCP server for generating static PNG
diagrams and animated GIF reveals from PyTorch model source. It exposes capability discovery,
structured output metadata, documentation resources, subprocess timeouts, and all three canonical
styles (graph, flow, and lenet). Install it with pip install "visualtorch[mcp]" and see the
MCP integration guide
for the tool schemas, generic stdio configuration, examples, and trusted-code security boundary.
No client-specific plugin or extension is required.
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.
Used VisualTorch in your research, built something with it, or found a paper that cites it? Tell us about it or open a pull request to add it directly - we'd love to hear.
Examples
See the Usage Examples page.
Contributing
Please feel free to send a pull request to contribute to this project by following this guideline.
Releases
See GOVERNANCE.md for release methodology and cadence, and the PyPI release history for past releases.
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, pytorch-summary, and torchview, all 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 VisualTorch as of its publication date (2024). The project has since been substantially refactored, including breaking API changes (see the documentation for the current API) - the DOI always resolves to what was actually reviewed and published.
@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}
}
Star History
インストール
VisualTorch をクライアントに追加します。お使いのものを選んでください。
claude mcp add visualtorch -- uvx visualtorchcodex mcp add visualtorch -- uvx visualtorchamp mcp add visualtorch -- uvx visualtorch{
"mcpServers": {
"visualtorch": {
"command": "uvx",
"args": [
"visualtorch"
]
}
}
}Add to `claude_desktop_config.json`, then restart Claude Desktop.
{
"mcpServers": {
"visualtorch": {
"command": "uvx",
"args": [
"visualtorch"
]
}
}
}Add to `~/.cursor/mcp.json`, or `.cursor/mcp.json` for a single project.
code --add-mcp '{"name":"visualtorch","command":"uvx","args":["visualtorch"]}'Or add the block manually to `.vscode/mcp.json` under `servers`.
{
"mcpServers": {
"visualtorch": {
"command": "uvx",
"args": [
"visualtorch"
]
}
}
}Add to `~/.codeium/windsurf/mcp_config.json`.
{
"mcpServers": {
"visualtorch": {
"command": "uvx",
"args": [
"visualtorch"
]
}
}
}Add to `cline_mcp_settings.json` via the MCP Servers panel.
{
"mcpServers": {
"visualtorch": {
"command": "uvx",
"args": [
"visualtorch"
]
}
}
}Add to `~/.gemini/settings.json`.
{
"mcpServers": {
"visualtorch": {
"type": "local",
"command": "uvx",
"args": [
"visualtorch"
],
"tools": [
"*"
]
}
}
}Add to `~/.copilot/mcp-config.json`, or run `/mcp add` inside the CLI.
{
"context_servers": {
"visualtorch": {
"command": {
"path": "uvx",
"args": [
"visualtorch"
]
}
}
}
}Add to your Zed `settings.json`.
uvx visualtorchRun `goose configure`, choose **Add Extension → Command-line Extension**, and paste this command.
スコア
39 / 100
情報不足
- ドキュメント25/25
- メンテナンス19/25
- 信頼性13/20
- 機能0/15
- 導入のしやすさ12/15
- Documents what it does and how to connect
- Has a resolvable package or endpoint
- Exposes at least one tool, prompt or resource
- README has substantive content
- Includes a code example
- Documents its configuration
- Mentions credentials or security posture
- Last commit 0 days ago
- Has a release history
- Repository is not archived
- Licensed MIT
- Namespace verified in the official MCP registry
- Claimed by its owner
- Published under an organisation
- 0 tool(s) documented
- Provides prompt templates
- Provides resources
- 12 documented install method(s)
- Published to a package registry
- Offers a hosted endpoint — no local install
バージョン履歴
| バージョン | 公開日 |
|---|---|
| 1.4.1最新 | 2026年7月28日 |