# Torch Vis
**Enhanced PyTorch neural network architecture visualization with professional flowchart diagrams**. Transform your PyTorch models into beautiful, informative flowchart visualizations with comprehensive layer analysis.
[](https://www.python.org/downloads/)
[](https://pytorch.org/)
[](https://opensource.org/licenses/MIT)
## Features
- **Enhanced Flowchart Diagrams**: Professional vertical flowchart visualization (default)
- **Comprehensive Layer Analysis**: Parameter counts, memory usage, and tensor shapes
- **Activation Function Indicators**: Visual highlights for activation layers
- **Data Flow Visualization**: Tensor sizes displayed on connection arrows
- **Multiple Styles**: Flowchart (default), standard, and research paper styles
- **Memory Analysis**: Per-layer and total memory usage estimates
- **Model Complexity Assessment**: Color-coded size indicators (Small/Medium/Large)
- **High-Quality Exports**: PNG diagrams with customizable DPI
- **Pure Python**: No external dependencies beyond standard ML stack
## Installation
```bash
pip install torch-vis
```
### Optional Dependencies
```bash
# For enhanced features
pip install torch-vis[full]
# For development
pip install torch-vis[dev]
```
## Quick Start
### Basic Usage (Enhanced Flowchart - Default)
```python
import torch
import torch.nn as nn
import torch_vis
# Define your PyTorch model
model = nn.Sequential(
nn.Linear(784, 128),
nn.ReLU(),
nn.Linear(128, 64),
nn.ReLU(),
nn.Linear(64, 10)
)
# Generate enhanced flowchart diagram (default style)
torch_vis.generate_architecture_diagram(
model=model,
input_shape=(1, 784),
output_path="my_model.png",
title="My Neural Network"
)
```
### One-Line Visualization
```python
# Minimal code - outputs enhanced flowchart by default
torch_vis.generate_architecture_diagram(model, (1, 784), "model.png")
```
## Diagram Styles
### Enhanced Flowchart (Default)
```python
# Default - no style parameter needed
torch_vis.generate_architecture_diagram(model, input_shape, "flowchart.png")
```
**Features:**
- Lightning bolt icons for activation functions
- Memory usage per layer (e.g., "~1.2MB")
- Data flow indicators on arrows (e.g., "128K elements")
- Summary panel with total parameters, memory, layer counts
- Color-coded model complexity (Small/Medium/Large)
### Other Styles
```python
# Standard style
torch_vis.generate_architecture_diagram(model, input_shape, "standard.png", style="standard")
# Research paper style
torch_vis.generate_architecture_diagram(model, input_shape, "paper.png", style="research_paper")
```
## Model Analysis
```python
# Analyze model statistics
analysis = torch_vis.analyze_model(model, input_shape=(1, 784))
print(f"Parameters: {analysis.get('total_params', 'N/A')}")
# Multiple convenient functions
torch_vis.generate_flowchart_diagram(model, input_shape, "flowchart.png")
torch_vis.generate_research_paper_diagram(model, input_shape, "paper.png")
```
## Advanced Features
### Custom Titles and Paths
```python
torch_vis.generate_architecture_diagram(
model=model,
input_shape=(3, 224, 224),
output_path="models/resnet_architecture.png",
title="ResNet-18 Architecture",
style="flowchart" # or "standard", "research_paper"
)
```
### Model Analysis
```python
# Get detailed model information
analysis = torch_vis.analyze_model(model, input_shape=(1, 784), detailed=True)
```
## What Makes Torch Vis Special
### Enhanced Information Display
- **Parameter Counts**: Exact count per layer
- **Memory Usage**: Estimated memory consumption (float32)
- **Tensor Shapes**: Input → Output shape transformations
- **Layer Types**: Color-coded layer categories
- **Model Size**: Automatic complexity assessment
### Professional Quality
- **Clean Layout**: Minimal, focused design
- **High DPI**: Publication-ready image quality
- **Consistent Styling**: Professional appearance
- **Compact Output**: Efficient use of space
### Developer Friendly
- **Simple API**: Sensible defaults, minimal configuration
- **PyTorch Native**: Built specifically for PyTorch models
- **Fast Generation**: Optimized rendering pipeline
- **No External Services**: Fully offline operation
## Requirements
- Python ≥ 3.8
- PyTorch ≥ 1.8.0
- matplotlib ≥ 3.3.0
- numpy ≥ 1.19.0
## License
MIT License - see [LICENSE](LICENSE) file for details.
## Contributing
Contributions welcome! Please feel free to submit a Pull Request.
## More Examples
```python
# CNN Example
cnn_model = nn.Sequential(
nn.Conv2d(3, 32, 3, padding=1),
nn.ReLU(),
nn.MaxPool2d(2),
nn.Conv2d(32, 64, 3, padding=1),
nn.ReLU(),
nn.MaxPool2d(2),
nn.Flatten(),
nn.Linear(64 * 8 * 8, 128),
nn.ReLU(),
nn.Linear(128, 10)
)
torch_vis.generate_architecture_diagram(
cnn_model,
input_shape=(1, 3, 32, 32),
output_path="cnn_architecture.png",
title="CNN for CIFAR-10"
)
```
**Torch Vis** - Making PyTorch model visualization simple, beautiful, and informative!
Raw data
{
"_id": null,
"home_page": "https://github.com/pluvioxo/torch-vis",
"name": "pytorch-graph",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "pytorch, neural-network, visualization, flowchart, architecture, diagram, machine-learning, deep-learning",
"author": "Torch Vis Team",
"author_email": "Torch Vis Team <contact@torchvis.com>",
"download_url": "https://files.pythonhosted.org/packages/f2/14/901f614cbefa2739af4f9cf0d44f82a437b592213df8011f9d73e27c4cec/pytorch_graph-0.2.0.tar.gz",
"platform": null,
"description": "# Torch Vis\n\n**Enhanced PyTorch neural network architecture visualization with professional flowchart diagrams**. Transform your PyTorch models into beautiful, informative flowchart visualizations with comprehensive layer analysis.\n\n[](https://www.python.org/downloads/)\n[](https://pytorch.org/)\n[](https://opensource.org/licenses/MIT)\n\n## Features\n\n- **Enhanced Flowchart Diagrams**: Professional vertical flowchart visualization (default)\n- **Comprehensive Layer Analysis**: Parameter counts, memory usage, and tensor shapes\n- **Activation Function Indicators**: Visual highlights for activation layers\n- **Data Flow Visualization**: Tensor sizes displayed on connection arrows\n- **Multiple Styles**: Flowchart (default), standard, and research paper styles\n- **Memory Analysis**: Per-layer and total memory usage estimates\n- **Model Complexity Assessment**: Color-coded size indicators (Small/Medium/Large)\n- **High-Quality Exports**: PNG diagrams with customizable DPI\n- **Pure Python**: No external dependencies beyond standard ML stack\n\n## Installation\n\n```bash\npip install torch-vis\n```\n\n### Optional Dependencies\n```bash\n# For enhanced features\npip install torch-vis[full]\n\n# For development\npip install torch-vis[dev]\n```\n\n## Quick Start\n\n### Basic Usage (Enhanced Flowchart - Default)\n\n```python\nimport torch\nimport torch.nn as nn\nimport torch_vis\n\n# Define your PyTorch model\nmodel = nn.Sequential(\n nn.Linear(784, 128),\n nn.ReLU(),\n nn.Linear(128, 64),\n nn.ReLU(),\n nn.Linear(64, 10)\n)\n\n# Generate enhanced flowchart diagram (default style)\ntorch_vis.generate_architecture_diagram(\n model=model,\n input_shape=(1, 784),\n output_path=\"my_model.png\",\n title=\"My Neural Network\"\n)\n```\n\n### One-Line Visualization\n\n```python\n# Minimal code - outputs enhanced flowchart by default\ntorch_vis.generate_architecture_diagram(model, (1, 784), \"model.png\")\n```\n\n## Diagram Styles\n\n### Enhanced Flowchart (Default)\n```python\n# Default - no style parameter needed\ntorch_vis.generate_architecture_diagram(model, input_shape, \"flowchart.png\")\n```\n\n**Features:**\n- Lightning bolt icons for activation functions\n- Memory usage per layer (e.g., \"~1.2MB\")\n- Data flow indicators on arrows (e.g., \"128K elements\")\n- Summary panel with total parameters, memory, layer counts\n- Color-coded model complexity (Small/Medium/Large)\n\n### Other Styles\n```python\n# Standard style\ntorch_vis.generate_architecture_diagram(model, input_shape, \"standard.png\", style=\"standard\")\n\n# Research paper style\ntorch_vis.generate_architecture_diagram(model, input_shape, \"paper.png\", style=\"research_paper\")\n```\n\n## Model Analysis\n\n```python\n# Analyze model statistics\nanalysis = torch_vis.analyze_model(model, input_shape=(1, 784))\nprint(f\"Parameters: {analysis.get('total_params', 'N/A')}\")\n\n# Multiple convenient functions\ntorch_vis.generate_flowchart_diagram(model, input_shape, \"flowchart.png\")\ntorch_vis.generate_research_paper_diagram(model, input_shape, \"paper.png\")\n```\n\n## Advanced Features\n\n### Custom Titles and Paths\n```python\ntorch_vis.generate_architecture_diagram(\n model=model,\n input_shape=(3, 224, 224),\n output_path=\"models/resnet_architecture.png\",\n title=\"ResNet-18 Architecture\",\n style=\"flowchart\" # or \"standard\", \"research_paper\"\n)\n```\n\n### Model Analysis\n```python\n# Get detailed model information\nanalysis = torch_vis.analyze_model(model, input_shape=(1, 784), detailed=True)\n```\n\n## What Makes Torch Vis Special\n\n### Enhanced Information Display\n- **Parameter Counts**: Exact count per layer\n- **Memory Usage**: Estimated memory consumption (float32)\n- **Tensor Shapes**: Input \u2192 Output shape transformations \n- **Layer Types**: Color-coded layer categories\n- **Model Size**: Automatic complexity assessment\n\n### Professional Quality\n- **Clean Layout**: Minimal, focused design\n- **High DPI**: Publication-ready image quality\n- **Consistent Styling**: Professional appearance\n- **Compact Output**: Efficient use of space\n\n### Developer Friendly\n- **Simple API**: Sensible defaults, minimal configuration\n- **PyTorch Native**: Built specifically for PyTorch models\n- **Fast Generation**: Optimized rendering pipeline\n- **No External Services**: Fully offline operation\n\n## Requirements\n\n- Python \u2265 3.8\n- PyTorch \u2265 1.8.0\n- matplotlib \u2265 3.3.0\n- numpy \u2265 1.19.0\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions welcome! Please feel free to submit a Pull Request.\n\n## More Examples\n\n```python\n# CNN Example\ncnn_model = nn.Sequential(\n nn.Conv2d(3, 32, 3, padding=1),\n nn.ReLU(),\n nn.MaxPool2d(2),\n nn.Conv2d(32, 64, 3, padding=1),\n nn.ReLU(),\n nn.MaxPool2d(2),\n nn.Flatten(),\n nn.Linear(64 * 8 * 8, 128),\n nn.ReLU(),\n nn.Linear(128, 10)\n)\n\ntorch_vis.generate_architecture_diagram(\n cnn_model, \n input_shape=(1, 3, 32, 32),\n output_path=\"cnn_architecture.png\",\n title=\"CNN for CIFAR-10\"\n)\n```\n\n**Torch Vis** - Making PyTorch model visualization simple, beautiful, and informative! \n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Enhanced PyTorch neural network architecture visualization with flowchart diagrams",
"version": "0.2.0",
"project_urls": {
"Bug Tracker": "https://github.com/pluvioxo/torch-vis/issues",
"Documentation": "https://torch-vis.readthedocs.io/",
"Homepage": "https://github.com/pluvioxo/torch-vis",
"Source Code": "https://github.com/pluvioxo/torch-vis"
},
"split_keywords": [
"pytorch",
" neural-network",
" visualization",
" flowchart",
" architecture",
" diagram",
" machine-learning",
" deep-learning"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "e20d2737f401dc7e3b463046120229b24f6a7ffae90d8b6098ba97fc3fcc3004",
"md5": "5d2b8ebdea04cf9c9e61698d0c74bada",
"sha256": "a51834cf9c4e2d88e9af88409cb1bd31dd288b48b7e52ca29ec687739355143c"
},
"downloads": -1,
"filename": "pytorch_graph-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5d2b8ebdea04cf9c9e61698d0c74bada",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 39732,
"upload_time": "2025-07-11T16:23:43",
"upload_time_iso_8601": "2025-07-11T16:23:43.926455Z",
"url": "https://files.pythonhosted.org/packages/e2/0d/2737f401dc7e3b463046120229b24f6a7ffae90d8b6098ba97fc3fcc3004/pytorch_graph-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f214901f614cbefa2739af4f9cf0d44f82a437b592213df8011f9d73e27c4cec",
"md5": "430b1119220e4e867ee350711184a76d",
"sha256": "5d236d249e6307a9ac1790e3d08238118b185c2ed67815053b96a4bc1c7a5431"
},
"downloads": -1,
"filename": "pytorch_graph-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "430b1119220e4e867ee350711184a76d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 35130,
"upload_time": "2025-07-11T16:23:45",
"upload_time_iso_8601": "2025-07-11T16:23:45.429741Z",
"url": "https://files.pythonhosted.org/packages/f2/14/901f614cbefa2739af4f9cf0d44f82a437b592213df8011f9d73e27c4cec/pytorch_graph-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-11 16:23:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pluvioxo",
"github_project": "torch-vis",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pytorch-graph"
}