TensorBoard is a suite of web applications for inspecting and understanding your TensorFlow runs and graphs
TensorBoard provides utilities for seamless integration with interactive notebook environments including Jupyter notebooks and Google Colab. The notebook module automatically detects the runtime environment and provides appropriate display methods for each context.
Start a TensorBoard instance from within a notebook environment with automatic context detection.
def start(args_string):
"""
Launch TensorBoard in notebook environment.
Args:
args_string (str): Command-line arguments as a single string
(same format as tensorboard CLI)
Automatically detects and handles:
- Google Colab environments
- Jupyter notebook environments
- IPython shell environments
- Standard CLI environments
"""Display a running TensorBoard instance within the notebook interface.
def display(port=None, height=None):
"""
Display running TensorBoard instance in notebook.
Args:
port (int, optional): TensorBoard server port. If None, attempts
to auto-detect running instance
height (int, optional): Frame height in pixels (default 800)
Provides environment-specific display:
- Colab: Embedded iframe with proxy URL handling
- Jupyter: Local iframe integration
- CLI: Prints URL for manual access
"""List and manage running TensorBoard instances.
def list():
"""
List all known running TensorBoard instances.
Returns:
Information about active TensorBoard processes including
ports, PIDs, start times, and data sources
"""Integration with IPython's extension system for magic commands.
def load_ipython_extension(ipython):
"""
Deprecated: use '%load_ext tensorboard' instead.
Args:
ipython: IPython.InteractiveShell instance
Raises:
RuntimeError: Always, directing users to correct usage
"""import tensorboard.notebook as tb_notebook
# Launch TensorBoard with log directory
tb_notebook.start('--logdir ./logs')
# Display in notebook (auto-detects port)
tb_notebook.display()import tensorboard.notebook as tb_notebook
# Launch with multiple options
tb_notebook.start('--logdir ./experiments --port 6007 --reload_interval 30')
# Display with custom height
tb_notebook.display(port=6007, height=1000)
# List running instances
running_instances = tb_notebook.list()
print(f"Found {len(running_instances)} TensorBoard instances")After loading the TensorBoard extension, magic commands become available:
# Load the extension (run once per session)
%load_ext tensorboard
# Use magic command to launch TensorBoard
%tensorboard --logdir ./logs --port 6006The notebook module automatically adapts to different environments:
Google Colab:
Jupyter Notebook:
IPython/CLI:
The module uses the following detection logic:
google.colab module and IPython kernelkernel traitThis ensures TensorBoard works consistently across different development environments while providing the best possible user experience for each context.
Install with Tessl CLI
npx tessl i tessl/pypi-tensorboard