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.0TensorBoard 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.
pip install tensorboardimport tensorboardFor accessing specific functionality:
from tensorboard import errors, notebook, program, summaryDirect access to the main TensorBoard application:
from tensorboard.program import TensorBoardSummary operations (conditionally available, requires TensorFlow):
# Only available if TensorFlow is installed
try:
from tensorboard.summary.v2 import scalar, histogram, image, audio, text
except ImportError:
# v2 API not available without TensorFlow
passfrom tensorboard.program import TensorBoard
# Create and configure TensorBoard application
tb = TensorBoard()
tb.configure(argv=['--logdir', './logs', '--port', '6006'])
# Launch the server
tb.launch()# Summary operations require TensorFlow installation
try:
from tensorboard.summary.v2 import scalar, histogram, image
import numpy as np
# Write scalar metrics
scalar('loss', 0.1, step=1)
scalar('accuracy', 0.95, step=1)
# Write histogram data
weights = np.random.normal(0, 1, 1000)
histogram('model/weights', weights, step=1)
# Write image data
image_data = np.random.rand(1, 28, 28, 1) # NHWC format
image('generated_images', image_data, step=1)
except ImportError:
print("TensorFlow required for summary operations")import tensorboard.notebook as tb_notebook
# Launch TensorBoard in notebook (Jupyter/Colab)
tb_notebook.start('--logdir ./logs --port 6006')
# Display the TensorBoard interface
tb_notebook.display(port=6006, height=800)TensorBoard consists of several key components:
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.
Structured exception hierarchy with HTTP-aware error classes for web application error handling and user-facing error messages.
class PublicError(RuntimeError): ...
class InvalidArgumentError(PublicError): ...
class NotFoundError(PublicError): ...
class UnauthenticatedError(PublicError): ...
class PermissionDeniedError(PublicError): ...Utilities for using TensorBoard in interactive notebook environments including Jupyter notebooks and Google Colab with automatic context detection and display management.
def start(args_string: str): ...
def display(port=None, height=None): ...
def list(): ...Command-line application interface and server management functionality for launching and configuring TensorBoard instances with customizable plugins and server options.
class TensorBoard:
def __init__(plugins=None, assets_zip_provider=None, server_class=None): ...
def configure(**kwargs): ...
def main(argv=None): ...
def launch(): ...TensorBoard's summary module provides access to summary writing infrastructure and re-exports v1/v2 summary APIs (when TensorFlow is available).
# Core writer classes (always available)
class Writer: ...
class Output: ...
class DirectoryOutput(Output): ...
# V2 API re-exports (requires TensorFlow)
from tensorboard.summary.v2 import * # Conditional import
# V1 API re-exports (requires TensorFlow)
from tensorboard.summary.v1 import * # Conditional importProgrammatic control over TensorBoard server instances including startup, monitoring, and shutdown with support for instance reuse and process tracking.
class TensorBoardInfo: ...
class StartLaunched: ...
class StartReused: ...
def start(arguments, timeout=60): ...
def get_all(): ...def load_ipython_extension(ipython):
"""
IPython API entry point for loading TensorBoard magic commands.
Args:
ipython: IPython.InteractiveShell instance
Note: Only intended to be called by the IPython runtime.
"""This function enables TensorBoard magic commands in Jupyter notebooks via %load_ext tensorboard.
__version__: str # Current version string (e.g., "2.20.0")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.