TensorBoard is a suite of web applications for inspecting and understanding your TensorFlow runs and graphs
npx @tessl/cli install tessl/pypi-tensorboard@2.20.00
# TensorBoard
1
2
TensorBoard is a suite of web applications for inspecting, analyzing, and understanding machine learning models and training processes. It provides interactive dashboards for monitoring scalar metrics, visualizing computational graphs, exploring high-dimensional embeddings, analyzing histograms and distributions, debugging models, profiling performance, and examining image/audio/text data samples. The platform supports both real-time monitoring during training and post-hoc analysis with a plugin architecture for custom visualization extensions.
3
4
## Package Information
5
6
- **Package Name**: tensorboard
7
- **Language**: Python
8
- **Installation**: `pip install tensorboard`
9
10
## Core Imports
11
12
```python
13
import tensorboard
14
```
15
16
For accessing specific functionality:
17
18
```python
19
from tensorboard import errors, notebook, program, summary
20
```
21
22
Direct access to the main TensorBoard application:
23
24
```python
25
from tensorboard.program import TensorBoard
26
```
27
28
Summary operations (conditionally available, requires TensorFlow):
29
30
```python
31
# Only available if TensorFlow is installed
32
try:
33
from tensorboard.summary.v2 import scalar, histogram, image, audio, text
34
except ImportError:
35
# v2 API not available without TensorFlow
36
pass
37
```
38
39
## Basic Usage
40
41
### Launch TensorBoard Server
42
43
```python
44
from tensorboard.program import TensorBoard
45
46
# Create and configure TensorBoard application
47
tb = TensorBoard()
48
tb.configure(argv=['--logdir', './logs', '--port', '6006'])
49
50
# Launch the server
51
tb.launch()
52
```
53
54
### Summary Writing (TensorFlow Required)
55
56
```python
57
# Summary operations require TensorFlow installation
58
try:
59
from tensorboard.summary.v2 import scalar, histogram, image
60
import numpy as np
61
62
# Write scalar metrics
63
scalar('loss', 0.1, step=1)
64
scalar('accuracy', 0.95, step=1)
65
66
# Write histogram data
67
weights = np.random.normal(0, 1, 1000)
68
histogram('model/weights', weights, step=1)
69
70
# Write image data
71
image_data = np.random.rand(1, 28, 28, 1) # NHWC format
72
image('generated_images', image_data, step=1)
73
except ImportError:
74
print("TensorFlow required for summary operations")
75
```
76
77
### Notebook Integration
78
79
```python
80
import tensorboard.notebook as tb_notebook
81
82
# Launch TensorBoard in notebook (Jupyter/Colab)
83
tb_notebook.start('--logdir ./logs --port 6006')
84
85
# Display the TensorBoard interface
86
tb_notebook.display(port=6006, height=800)
87
```
88
89
## Architecture
90
91
TensorBoard consists of several key components:
92
93
- **Frontend**: Web-based dashboard with plugin architecture for visualizations
94
- **Backend**: HTTP server that reads log data and serves visualization content
95
- **Summary API**: Python API for writing structured data to TensorBoard logs
96
- **Plugin System**: Extensible architecture supporting custom visualization types
97
- **Manager**: Process lifecycle management for running TensorBoard instances
98
99
The plugin system enables specialized visualizations for different data types (scalars, histograms, images, text, etc.) while maintaining a consistent interface for data ingestion and display.
100
101
## Capabilities
102
103
### Error Handling
104
105
Structured exception hierarchy with HTTP-aware error classes for web application error handling and user-facing error messages.
106
107
```python { .api }
108
class PublicError(RuntimeError): ...
109
class InvalidArgumentError(PublicError): ...
110
class NotFoundError(PublicError): ...
111
class UnauthenticatedError(PublicError): ...
112
class PermissionDeniedError(PublicError): ...
113
```
114
115
[Error Handling](./errors.md)
116
117
### Notebook Integration
118
119
Utilities for using TensorBoard in interactive notebook environments including Jupyter notebooks and Google Colab with automatic context detection and display management.
120
121
```python { .api }
122
def start(args_string: str): ...
123
def display(port=None, height=None): ...
124
def list(): ...
125
```
126
127
[Notebook Integration](./notebook.md)
128
129
### Program Interface
130
131
Command-line application interface and server management functionality for launching and configuring TensorBoard instances with customizable plugins and server options.
132
133
```python { .api }
134
class TensorBoard:
135
def __init__(plugins=None, assets_zip_provider=None, server_class=None): ...
136
def configure(**kwargs): ...
137
def main(argv=None): ...
138
def launch(): ...
139
```
140
141
[Program Interface](./program.md)
142
143
### Summary Operations
144
145
TensorBoard's summary module provides access to summary writing infrastructure and re-exports v1/v2 summary APIs (when TensorFlow is available).
146
147
```python { .api }
148
# Core writer classes (always available)
149
class Writer: ...
150
class Output: ...
151
class DirectoryOutput(Output): ...
152
153
# V2 API re-exports (requires TensorFlow)
154
from tensorboard.summary.v2 import * # Conditional import
155
156
# V1 API re-exports (requires TensorFlow)
157
from tensorboard.summary.v1 import * # Conditional import
158
```
159
160
[Summary Operations](./summary.md)
161
162
### Process Management
163
164
Programmatic control over TensorBoard server instances including startup, monitoring, and shutdown with support for instance reuse and process tracking.
165
166
```python { .api }
167
class TensorBoardInfo: ...
168
class StartLaunched: ...
169
class StartReused: ...
170
def start(arguments, timeout=60): ...
171
def get_all(): ...
172
```
173
174
[Process Management](./manager.md)
175
176
## IPython Extension
177
178
```python { .api }
179
def load_ipython_extension(ipython):
180
"""
181
IPython API entry point for loading TensorBoard magic commands.
182
183
Args:
184
ipython: IPython.InteractiveShell instance
185
186
Note: Only intended to be called by the IPython runtime.
187
"""
188
```
189
190
This function enables TensorBoard magic commands in Jupyter notebooks via `%load_ext tensorboard`.
191
192
## Version Information
193
194
```python { .api }
195
__version__: str # Current version string (e.g., "2.20.0")
196
```
197
198
The `__version__` attribute provides access to the currently installed TensorBoard version for compatibility checking and debugging purposes. The version string corresponds to the value in `tensorboard.version.VERSION`.