High-dimensional data visualization for NumPy, PyTorch, Hugging Face datasets and entire neural networks.
Svetoviz is a debug viewer for tensors, images, NumPy arrays, datasets and PyTorch models. It ships as a
single Python package (svetoviz) that streams your scene to a custom WebGPU renderer running in the browser,
and includes a PyTorch debugger that traces the input -> weights -> output relation of every basic torch.nn
module.
Every section below mirrors the matching page of the documentation site (https://www.svetoviz.com/docs) one to one, in the same order. The section-to-page mapping, including the reference script, is listed in Documentation Index.
Svetoviz is a high-dimensional data visualization engine. It ships with a custom WebGPU renderer that renders entire models and datasets in the browser, and a Python package (svetoviz) that lets you build your own visualizations with your own data.
Your Python process builds a scene out of Views (data sources) and Layouts (spatial containers) and hands it to a renderer. Values are never flattened into a print statement or a single 2D image: every element gets a position in 3D space, and you navigate that space.
- Model visualization: render entire models and datasets in the browser via the custom WebGPU renderer, or open the scene directly from the public spaces directory.
- Dataset browser: visualize large datasets in the browser, or open the scene directly from the public spaces directory.
- PyTorch Debugger: track the input -> weights -> output relations for every basic PyTorch module.
- Your own data: build views from your own models, datasets and NumPy arrays with the Python package and open them in the browser - the renderer runs locally, no account needed.
| Package | Renders in | macOS (Apple Silicon) | Linux | Python |
|---|---|---|---|---|
svetoviz |
A modern browser (Chrome / Chromium WebGPU) | Yes | Yes ( x86_64 /aarch64 ) |
3.9 - 3.14 |
The single svetoviz package exposes one surface - sv.array, sv.tensor, sv.image, sv.view, sv.pytorch, sv.model, sv.pipeline, sv.save_to_disk, sv.load_from_disk - backed by one mapping implementation. It streams the scene to a browser tab and renders it client-side with a custom WebGPU pipeline: the renderer runs locally, so no account and no server-side compute are required.
your python process renderer user
--------------------- -------- ----
numpy / torch / PIL / HF dataset
|
+-- Views (NumpyView, TensorView, DatasetView, ModelView, ...)
|
+-- Layouts (Vertical / Horizontal / Grid / Directory / Spiral)
|
+-- sv.view(scene) -------------> WebGPU (browser) ---------> 3D scene
sv.save_to_disk(scene) --> tiles + tree.db --> sv.build_pmtiles_file() --> remote URL
This README mirrors the documentation site section by section. Every code block below is taken from the corresponding documentation page or from the reference script in this repository.
.
|-- README.md # this document (GitHub landing page)
|-- app.py # local preview renderer for README.md (not part of the package)
|-- examples/
| `-- quickstart_webgpu.py # reference script for svetoviz
`-- assets/
`-- images/ # every screenshot embedded in this README
Svetoviz is currently distributed via pip.
Install the Svetoviz package (WebGPU renderer) with the following command:
pip install svetoviz
Or using a private repository:
pip install svetoviz --extra-index-url https://svetoviz.com/webgpu/simple/
Compatibility: this package supports macOS (Apple Silicon), Linux and Python versions 3.9 through 3.14.
Dependencies installed with the Svetoviz package:
dependencies = [
"Flask>=3.1,<4",
"flask-cors>=6.0,<7",
"waitress>=3.0,<4",
"websockets>=15,<16",
"opencv-python>=4.10",
"psd-tools==1.11.0",
"pmtiles==3.7.0",
"petname==2.9",
"requests>=2.32,<3",
"transformers>=4.57,<6",
"torch>=2.8",
"datasets>=4.5,<6",
]
Quick start: download examples/quickstart_webgpu.py for the full reference script. The minimal starting point from that file:
import os
current_dir = os.path.dirname(os.path.abspath(__file__))
cache_dir = os.path.join(current_dir, "cache_test")
os.environ["SVETO_VIZ_CACHE_DIR"] = cache_dir
import svetoviz as sv
import numpy as np
print(f"Cache dir: {sv.get_cache_dir()}")
data = np.random.rand(4, 4, 32, 32).astype(np.float32)
sv.array(data, gap_size=10) # opens http://localhost:8000
Cache data is written to SVETO_VIZ_CACHE_DIR. Set the variable before importing svetoviz, otherwise cache data gets stored inside site packages:
import os
current_dir = os.path.dirname(os.path.abspath(__file__))
cache_dir = os.path.join(current_dir, "cache_test")
os.environ["SVETO_VIZ_CACHE_DIR"] = cache_dir
import svetoviz as sv
print(f"Cache dir: {sv.get_cache_dir()}")
Run the demo to verify the installation:
import svetoviz as sv
sv.demo_array()
sv.demo_modules()
sv.demo_modules() opens a collection of all supported PyTorch modules. Pass any string into the terminal view to process them, then use the timeline view to walk through the activations.
Method definitions and parameter specifications for the svetoviz package.
svetoviz
| Signature |
|---|
array(cls, np_array, gap_size=0, ordering=None, host="localhost", http_port=8000, ws_port=8765, config=None) |
arrays(cls, arrays, gap_size=0, host="localhost", http_port=8000, ws_port=8765, config=None) |
tensor(cls, tensor, gap_size=0, ordering=None, host="localhost", http_port=8000, ws_port=8765, config=None) |
tensors(cls, tensors, gap_size=0, host="localhost", http_port=8000, ws_port=8765, config=None) |
image(cls, image, host="localhost", http_port=8000, ws_port=8765, config=None) |
images(cls, images, host="localhost", http_port=8000, ws_port=8765, config=None) |
pytorch(cls, module, terminal_callback=None, host="localhost", http_port=8000, ws_port=8765, blocking=True, config=None) |
model(cls, id, model, tokenizer=None, image_processor=None, video_processor=None, processor=None, scheduler=None, feature_extractor=None, terminal_callback=None, host="localhost", http_port=8000, ws_port=8765, blocking=True, config=None) |
pipeline(cls, id, pipe, terminal_callback=None, host="localhost", http_port=8000, ws_port=8765, blocking=True, config=None) |
view(cls, view, terminal_callback=None, host="localhost", http_port=8000, ws_port=8765, config=None) |
save_to_disk(cls, view, directory, threaded=True, max_memory_gb=2, image_backend="pillow", compression="png_0") |
load_from_disk(cls, directory, host="localhost", http_port=8000, ws_port=8765, config=None) |
build_pmtiles_file(cls, directory) |
demo_array(cls, host="localhost", http_port=8000) |
demo_modules(cls, host="localhost", http_port=8000) |
Parameter notes
gap_size- integer spacing between visualized slices. Default0.ordering- tuple or list defining the axis permutation, identical tonumpy.transpose. The visualizer treats thelast two dimensions as width and height, so arrays in(H, W, C)layout appear distorted and must be reordered, e.g.ordering=(2, 0, 1).image- accepts a URL string, a local file path, or a PillowImageinstance.
Every web method accepts an optional config=WebConfig() argument that controls the rendering of the scene:
class WebConfig:
def __init__(self,
description=None,
default_theme="Dark",
groups_mode="lines",
matrix_mode="quads",
stream_values=True,
terminal_enabled=True,
render_labels=True
):
| Class | Signature |
|---|---|
NumpyView |
__init__(self, id, data, gap_size=1, ordering=None, description=None) |
TensorView |
__init__(self, id, data, gap_size=1, ordering=None, description=None) |
LazyImageView |
__init__(self, id, image, description=None) |
DiskImageView |
__init__(self, id, image, description=None) |
DirectoryGridView |
__init__(self, id, directory, lazy=False, limit=None) |
DirectorySpiralView |
__init__(self, id, directory, lazy=False, limit=None) |
DatasetView |
__init__(self, id, dataset, image_columns, info_columns, cell_width, cell_height, image_backend, info_column_mapping_func) |
ModelView |
__init__(self, id, model, tokenizer=None, image_processor=None, video_processor=None, processor=None, scheduler=None, feature_extractor=None) |
PipelineView |
__init__(self, id, pipe) |
DiskSceneView |
__init__(self, id, directory) |
| Class | Signature |
|---|---|
VerticalLayout |
__init__(self, id, views, title=None, title_color=None, padding=None, spacing=None, gravity=None, background_color=None) |
HorizontalLayout |
__init__(self, id, views, title=None, title_color=None, padding=None, spacing=None, gravity=None, background_color=None) |
GridLayout |
__init__(self, id, views, title=None, title_color=None, padding=None, spacing=None, background_color=None) |
| Class | Signature |
|---|---|
RemotePmTilesView(VerticalLayout) |
__init__(self, id, pm_tiles_url, tree_db_file) |
RemoteTilesView(VerticalLayout) |
__init__(self, id, depth, tile_width, tile_height, url_pattern) |
| Call | Effect |
|---|---|
get_cache_dir() |
Resolve the current cache directory |
save_to_disk(view, directory, ...) |
Write a scene into tiles plus a tree.db |
load_from_disk(directory) |
Open a built scene without the original data |
build_pmtiles_file(directory) |
Turn a built scene into a PMTiles pyramid for remote hosting |
Inside a terminal_callback(buffer, message, images, files):
| Call | Effect |
|---|---|
buffer.send_user_message(text) |
Echo text as a user line in the terminal |
buffer.send_system_message(text) |
Print a system line in the terminal |
Svetoviz handles the full NumPy and PyTorch dtype spectrum:
bool, int8, int16, int32, int64, uint8, uint16, uint32, uint64, float16, bfloat16, float32, float64, complex32, complex64, complex128.
Svetoviz provides native support for image data, abstracting away the boilerplate of and pre-processing. Whether dealing with local high-resolution TIFs, web-based JPGs, or in-memory PIL objects, the engine renders them directly into the 3D environment.
The image method is polymorphic. It accepts local file paths, remote URLs, or existing Pillow (PIL) image objects. This is the fastest way to verify data integrity or inspect high-bit-depth scientific imagery.
import svetoviz as sv
filepath = "/datasets/nasaimages/heic2409a.tif"
sv.image(filepath)
| Color map turbo | Zoom in to single pixel |
|---|
For multiple images, images allows you to pass a list of mixed-source images. The engine tiles them in 3D space, enabling you to rotate and zoom through entire batches.
import svetoviz as sv
image1_url = "https://t4.ftcdn.net/jpg/02/70/3..."
image2_url = "https://www.mamp.one/wp-content/..."
image3_url = "https://img.freepik.com/free-photo/..."
filepath1 = "random_images/random_image_1.jpg"
filepath2 = "/datasets/nasaimages/heic1007a.tif"
filepath3 = "/datasets/nasaimages/heic2409b.tif"
filepath4 = "/datasets/nasaimages/heic2409a.tif"
sv.images(images=[
image1_url, image2_url, image3_url,
filepath1, filepath2, filepath3, filepath4
])
Images processed via image and images are loaded eagerly and streamed directly from disk to ensure low latency during inspection. You can explicitly define the storage location for cached assets by modifying the global configuration:
import os
os.environ["SVETO_VIZ_CACHE_DIR"] = "/path/to/your/custom/cache"
import svetoviz as sv
current_cache = sv.get_cache_dir()
While these methods are optimized for rapid previews and medium-sized batches, they are not intended for massive datasets. For high-performance scenes containing hundreds of thousands of images, use the Views API for tile-based, lazy- spatial optimization.
The core of Svetoviz is its ability to handle raw NumPy arrays of any dimension and data type. Whether you are inspecting a single tensor or a collection of disparate arrays, the engine provides 3D spatial awareness for every element.
Use array to project a single NumPy array into the 3D scene. The gap_size parameter controls the visual spacing between high-dimensional slices, making it easier to identify patterns across tensors.
import svetoviz as sv
data = np.random.rand(4, 4, 32, 32).astype(np.float32)
sv.array(data, gap_size=10)
Svetoviz handles high-dimensional tensors by "stacking" them along specific axes. This transforms multidimensional data into a physical 3D structure where numerical values are mapped to visual gradients in real time.
| Dimensional stacking | Colormap application |
|---|
Svetoviz supports the full spectrum of NumPy dtypes - from standard integers and floats to complex numbers and booleans. Using arrays, you can pass a list of arrays with varying shapes and types.
import svetoviz as sv
sv.arrays([
np.random.randint(np.iinfo(np.int8).min, np.iinfo(np.int8).max, (2, 2, 128, 128), dtype=np.int8),
np.random.randint(np.iinfo(np.int16).min, np.iinfo(np.int16).max, (2, 3, 128, 128), dtype=np.int16),
np.random.randint(np.iinfo(np.int32).min, np.iinfo(np.int32).max, (4, 4, 64, 64), dtype=np.int32),
np.random.randint(np.iinfo(np.int64).min, np.iinfo(np.int64).max, (4, 2, 32, 64), dtype=np.int64),
np.random.randint(np.iinfo(np.uint8).min, np.iinfo(np.uint8).max, (2, 3, 128, 128), dtype=np.uint8),
np.random.randint(np.iinfo(np.uint16).min, np.iinfo(np.uint16).max, (16, 128, 128), dtype=np.uint16),
np.random.randint(np.iinfo(np.uint32).min, np.iinfo(np.uint32).max, (4, 4, 64, 64), dtype=np.uint32),
np.random.randint(np.iinfo(np.uint64).min, np.iinfo(np.uint64).max, (4, 2, 32, 64), dtype=np.uint64),
np.random.randint(np.iinfo(np.ubyte).min, np.iinfo(np.ubyte).max, (16, 16, 16), dtype=np.ubyte),
np.random.randint(np.iinfo(np.byte).min, np.iinfo(np.byte).max, (8, 2, 24, 24), dtype=np.byte),
np.random.randint(np.iinfo(np.intp).min, np.iinfo(np.intp).max, (64, 64), dtype=np.intp),
np.random.randint(np.iinfo(np.uintp).min, np.iinfo(np.uintp).max, (64, 64), dtype=np.uintp),
np.random.choice([True, False], (2, 72, 72)).astype(np.bool_),
(np.random.uniform(-1, 1, (256, 256)) * np.finfo(np.float16).max).astype(np.float16),
(np.random.uniform(-1, 1, (32, 32, 32)) * np.finfo(np.float32).max).astype(np.float32),
(np.random.uniform(-1, 1, (4, 3, 32, 32)) * np.finfo(np.float64).max).astype(np.float64),
(np.random.randn(32, 32) + 1j * np.random.randn(32, 32)).astype(np.complex64),
(np.random.randn(32, 32) + 1j * np.random.randn(32, 32)).astype(np.complex128),
], gap_size=32)
By default, Svetoviz expects the last two dimensions of an array to represent the spatial height and width (H, W). When passing standard image data in (H, W, C) format, the engine renders the channels as the spatial grid, resulting in a distorted view.
import svetoviz as sv
data = np.array(image)
sv.array(data, gap_size=0)
To resolve this, use the ordering parameter to transpose the axes for the 3D projection without modifying the original array in memory. For a standard (H, W, C) image, use ordering=(2, 0, 1) to correctly map the dimensions.
import svetoviz as sv
data = np.array(image)
sv.array(data, gap_size=0, ordering=(2, 0, 1))
Svetoviz handles large arrays with ease. You can, for example, see all frames from a videoclip at once, allowing for a comprehensive spatial overview of temporal data.
import svetoviz as sv
array = video_to_5d_grid('bunny.mp4')
sv.array(array)
Svetoviz provides integrated support for the Hugging Face datasets ecosystem. By utilizing the DatasetView, you can transform massive remote repositories into persistent, locally-browsable 3D environments with optimized image tiling.
import svetoviz as sv
from datasets import load_dataset
hf_name = "Dewa/Dog_Emotion_Dataset_v2"
dataset = load_dataset(hf_name, split="train")
layout = sv.DatasetView(
id=hf_name,
dataset=dataset,
image_columns=["image"],
info_columns=["emotion"],
cell_width=400,
cell_height=400
)
sv.save_to_disk(
view=layout,
compression="png_0",
directory=output_directory
)
DatasetView parameters:
| Parameter | Meaning |
|---|---|
id |
Scene / dataset identifier shown in the viewer |
dataset |
A datasets.Dataset (or aselect() subset of it) |
image_columns |
Columns holding images to tile into the grid |
info_columns |
Text columns indexed into the search database |
cell_width /cell_height |
Pixel size of each rendered entry |
image_backend |
Pillow or the alternative image backend |
info_column_mapping_func |
Maps raw ids to human labels |
import svetoviz as sv
sv.load_from_disk(directory=output_directory)
Include info_columns to automatically build the search database:
import svetoviz as sv
from datasets import load_dataset
hf_name = "eltorio/ROCOv2-radiology"
dataset = load_dataset(hf_name, split="train")
layout = sv.DatasetView(
id=hf_name,
dataset=dataset,
image_columns=["image"],
info_columns=["image_id", "caption", "cui"],
cell_width=400,
cell_height=400
)
sv.save_to_disk(
view=layout,
compression="png_0",
directory=output_directory
)
sv.load_from_disk(directory=output_directory)
Use the web interface to search over the entire dataset:
You can also explore datasets already published online at https://app.svetoviz.com.
The selected compression type dictates the following parameters of the final scene:
- Quality of the final scene
- Total disk usage of the final scene
- Total build time of the scene
PNG compression levels
| Available constants |
|---|
PNG_0 (Highest Quality) |
PNG_1 |
PNG_2 |
PNG_3 |
PNG_4 |
PNG_5 |
PNG_6 |
PNG_7 |
PNG_8 |
PNG_9 (Lowest Quality) |
JPEG compression levels
| Available constants |
|---|
JPEG_0 (Highest Quality) |
JPEG_1 |
JPEG_2 |
JPEG_3 |
JPEG_4 |
JPEG_5 |
JPEG_6 |
JPEG_7 |
JPEG_8 |
JPEG_9 (Lowest Quality) |
The Views API provides a declarative way to organize multiple data sources into a single 3D scene. By using Layout containers, you can create structured environments for comparative analysis and large-scale dataset inspection.
The Views API is built on two primary class types: View and Layout.
- Views represent individual data points, encapsulating various formats such as NumPy arrays, images, or other specialized data structures.
- Layouts organize collections of views into structured 3D scenes by defining spatial relationships, such as line arrangements or grids. Layouts are inherently composable, allowing you to nest them within one another to build complex, multi-tiered visual environments.
import svetoviz as sv
view = sv.NumpyView(
id="numpy_view_example",
data=np.random.rand(4, 4, 32, 32).astype(np.float32),
gap_size=10)
sv.view(view=view)
python
import svetoviz as sv
image = Image.open(BytesIO(requests.get(IMAGE_URL).content))
data = np.array(image)
view = sv.NumpyView(
id="numpy_image_channels",
data=data,
gap_size=10,
ordering=(2, 0, 1))
sv.view(view=view)
| Raw array projection | Transposed mapping |
|---|
For images, use DiskImageView to stream assets directly from storage, or LazyImageView to lazy-load images into RAM only when required. Both classes accept a URL, a local file path, or a PIL image object as the source.
import svetoviz as sv
view = sv.DiskImageView(
id="disc_image",
image=IMAGE_URL)
view = sv.LazyImageView(
id="lazy_image",
image=IMAGE_URL)
sv.view(view=view)
The DirectoryGridView is a specialized layout class designed to automatically load and organize an entire directory of images into a structured grid scene.
import svetoviz as sv
def description_func(filepath):
return f"My description for {filepath}"
layout = sv.DirectoryGridView(
id="directory_grid_example",
directory=directory,
limit=100,
lazy=False,
description_func=description_func
)
sv.view(layout)
| Grid overview | Grid spread |
|---|
The DirectorySpiralView is a specialized layout class designed to automatically load and organize an entire directory of images into a structured spiral scene.
import svetoviz as sv
def description_func(filepath):
return f"My description for {filepath}"
layout = sv.DirectorySpiralView(
id="directory_spiral_view",
directory=directory,
limit=100,
lazy=False,
description_func=description_func
)
sv.view(layout)
| Spiral overview | Spiral spread |
|---|
**Lazy vs eager **
lazy=Trueis limited by available RAM, and the scene may appear empty at launch until data loads.lazy=Falseis limited by available disc space for theDiskImageViewmemory files and by the maximum number of open file descriptors.sv.view()may start failing around 500 - 1000 data points. For larger collections, build the scene offline (seeOffline scene building ).
The DatasetView enables the integration of Hugging Face datasets directly into your scene. It automatically processes a dataset object and renders its entries into a structured grid of images. You will learn more about DatasetView in Datasets.
import svetoviz as sv
hf_name = "Dewa/Dog_Emotion_Dataset_v2"
dataset = load_dataset(hf_name, split="train")
subset = dataset.select(range(100))
layout = sv.DatasetView(
id=hf_name,
dataset=subset,
info_columns=["emotion"],
image_columns=["image"],
cell_width=400,
cell_height=400
)
sv.view(layout)
The VerticalLayout arranges its child views in a linear vertical stack.
import svetoviz as sv
numpy_array = np.random.rand(4, 4, 32, 32).astype(np.float32)
image = Image.open(BytesIO(requests.get(IMAGE_URL).content))
image_array = np.array(image)
layout = sv.VerticalLayout(
id="vertical_layout_example",
views=[
sv.NumpyView(
id="array",
data=numpy_array,
gap_size=10,
ordering=None),
sv.NumpyView(
id="image_array",
data=image_array,
gap_size=10,
ordering=(2, 0, 1)),
sv.DiskImageView(
id="disc_image",
image=image),
sv.LazyImageView(
id="lazy_image",
image=image)
],
)
sv.view(layout)
The HorizontalLayout arranges its child views in a linear horizontal stack.
import svetoviz as sv
numpy_array = np.random.rand(4, 4, 32, 32).astype(np.float32)
image = Image.open(BytesIO(requests.get(IMAGE_URL).content))
image_array = np.array(image)
layout = sv.HorizontalLayout(
id="layout",
title="Horizontal layout",
views=[
sv.NumpyView(
id="array",
data=numpy_array,
gap_size=10),
sv.NumpyView(
id="image_array",
data=image_array,
gap_size=10,
ordering=(2, 0, 1)),
sv.DiskImageView(
id="disc_image",
image=image),
sv.LazyImageView(
id="lazy_image",
image=image)
],
)
sv.view(layout)
The GridLayout arranges its child views in a grid.
import svetoviz as sv
directory = "downloaded_images"
image_sources = []
for root, dirs, files in os.walk(directory):
for file in files:
image_sources.append(os.path.join(root, file))
image_views = [
sv.DiskImageView(id=f"img_{i}", image=src)
for i, src in enumerate(image_sources)
]
grid = sv.GridLayout(id="grid_layout_example", views=image_views)
sv.view(grid)
Layouts can be nested to create complex, multi-tiered scenes. Each layout object accepts an optional title argument; when provided, the title is rendered as an additional child at the beginning of the collection, adhering to the parent's defined spatial positioning.
import svetoviz as sv
disc_image = sv.DiskImageView(
id="disc_image",
image="sample_image.jpg")
lazy_image = sv.LazyImageView(
id="lazy_image",
image="sample_image.jpg")
array = sv.NumpyView(
id="array",
data=np.random.rand(4, 32, 4, 245, 245).astype(np.float32),
gap_size=10)
images_directory = "downloaded_images"
dir_spiral_view = sv.DirectorySpiralView(
id="dir_spiral",
directory=images_directory,
limit=100,
lazy=False
)
dir_grid_view = sv.DirectoryGridView(
id="dir_grid",
directory=images_directory,
limit=100,
lazy=False
)
hf_name = "Dewa/Dog_Emotion_Dataset_v2"
dataset = load_dataset(hf_name, split="train")
subset = dataset.select(range(500))
subset2 = dataset.select(range(500, 1000))
subset_view_1 = sv.DatasetView(
id="subset1",
dataset=subset,
image_columns=["image"],
info_columns=["emotion"],
cell_width=400,
cell_height=400
)
subset_view_2 = sv.DatasetView(
id="subset2",
dataset=subset2,
image_columns=["image"],
info_columns=["emotion"],
cell_width=400,
cell_height=400
)
array_container = sv.VerticalLayout(
id="Numpy",
title="Numpy",
views=[array])
image_container = sv.VerticalLayout(
id="Image",
title="Images",
views=[disc_image, lazy_image])
directory_grid_container = sv.VerticalLayout(
id="directory_grid_id",
title="Directory grid view",
views=[dir_grid_view])
directory_spiral_container = sv.VerticalLayout(
id="directory_spiral_id",
title="Directory spiral view",
views=[dir_spiral_view])
subset_1_container = sv.VerticalLayout(
id="dataset_subset_1",
title="Subset 1",
views=[subset_view_1])
subset_2_container = sv.VerticalLayout(
id="dataset_subset_2",
title="Subset 2",
views=[subset_view_2])
layout = sv.GridLayout(
id="parent_layout",
views=[
image_container,
array_container,
directory_grid_container,
directory_spiral_container,
subset_1_container,
subset_2_container]
)
sv.view(layout)
You can switch between different layout types at any time directly through the web interface. Additionally, you can dynamically modify properties such as spacing, padding, and spread to refine the spatial organization of your scene.
| Horizontal spread | Vertical spread |
|---|
Displaying a scene with view is typically sufficient for scenes containing a small number of data points. For large-scale scenes, build your scene offline. Once the scene is built, you can launch it directly from the directory without requiring access to the original source data.
This example demonstrates building a unified scene from the complete ESA/Hubble and ESA/Webb image catalogs in maximum quality.
import svetoviz as sv
images_directory = "/Users/piotrgryko/Desktop/nasaimages"
config_file_path = os.path.join(images_directory, "config.json")
scraped_data = {}
with open(config_file_path, "r", encoding="utf-8") as f:
scraped_data = json.load(f)
def description_func(filepath):
filename = os.path.basename(filepath)
name_without_ext = os.path.splitext(filename)[0]
metadata = scraped_data.get(name_without_ext, {})
lines = []
for key, value in metadata.items():
lines.append(f"{key}: {value}")
return "\n\n".join(lines)
layout = sv.DirectorySpiralView(
id="Galaxy",
directory=images_directory,
lazy=True,
description_func=description_func
)
sv.save_to_disk(
view=layout,
threaded=True,
directory="output/space_scene",
compression="jpeg_0"
)
Once the build is complete, launch the interactive 3D environment directly from the directory:
import svetoviz as sv
sv.load_from_disk(directory="output/space_scene")
Alternatively, you can process the scene further and generate a PMTiles file for remote hosting and streaming:
import svetoviz as sv
sv.build_pmtiles_file(
directory="output/space_scene"
)
After up the generated PMTiles file to a remote server, you can browse the scene from anywhere without distributing the original dataset:
import svetoviz as sv
db_file = "output/space_scene/tree.db"
url = "your remote pmtiles file url"
layout = sv.RemotePmTilesLayout(
id="universe",
pm_tiles_url=url,
tree_db_file=db_file
)
sv.view(layout)
To re-open a saved scene as a widget instead of launching it, use DiskSceneView:
import svetoviz as sv
view = sv.DiskSceneView(
id="dog_emotions",
directory="output/dog_emotion_dataset"
)
view2 = sv.DiskSceneView(
id="roco_radiology",
directory="output/roco_scene"
)
layout = sv.VerticalLayout(id="scenes", views=[view, view2])
sv.view(layout)
Svetoviz supports torch.Tensor visualization exactly like standard NumPy arrays.
Use tensor() to project a single torch.Tensor into the 3D scene. The gap_size parameter controls the visual spacing between high-dimensional slices.
import svetoviz as sv
data = torch.rand((4, 4, 256, 256), dtype=torch.float32)
sv.tensor(data, gap_size=10)
Svetoviz supports the full spectrum of torch dtypes - from standard integers and floats to complex numbers and booleans. Using tensors(), you can pass a list of torch.Tensor with varying shapes and types.
import svetoviz as sv
sv.tensors([
torch.randint(0, 2, (2, 72, 72), dtype=torch.bool),
torch.randint(np.iinfo(np.int8).min, np.iinfo(np.int8).max, (2, 60, 60), dtype=torch.int8),
torch.randint(np.iinfo(np.int16).min, np.iinfo(np.int16).max, (4, 8, 16, 16), dtype=torch.int16),
torch.randint(np.iinfo(np.int32).min, np.iinfo(np.int32).max, (4, 4, 64, 64), dtype=torch.int32),
torch.randint(np.iinfo(np.int64).min, np.iinfo(np.int64).max, (4, 2, 32, 64), dtype=torch.int64),
torch.randint(np.iinfo(np.uint8).min, np.iinfo(np.uint8).max, (2, 3, 128, 128), dtype=torch.uint8),
torch.randint(np.iinfo(np.uint16).min, np.iinfo(np.uint16).max, (16, 128, 128), dtype=torch.uint16),
torch.randint(np.iinfo(np.uint32).min, np.iinfo(np.uint32).max, (4, 4, 64, 64), dtype=torch.uint32),
torch.frombuffer(np.random.bytes(4 * 2 * 32 * 64 * 8), dtype=torch.uint64).reshape(4, 2, 32, 64),
(torch.rand(256, 256, dtype=torch.float32) * torch.finfo(torch.float16).max).to(torch.float16),
(torch.rand(256, 256, dtype=torch.float32) * torch.finfo(torch.bfloat16).max).to(torch.bfloat16),
(torch.rand(256, 256, dtype=torch.float32) * torch.finfo(torch.float32).max).to(torch.float32),
(torch.rand(256, 256, dtype=torch.float64) * torch.finfo(torch.float64).max).to(torch.float64),
torch.complex(
torch.rand(32, 32),
torch.rand(32, 32)).to(torch.complex32) * torch.finfo(torch.complex32).max,
torch.complex(
torch.rand(32, 32),
torch.rand(32, 32)).to(torch.complex64) * torch.finfo(torch.complex64).max,
torch.complex(
torch.rand(32, 32),
torch.rand(32, 32)).to(torch.complex128) * torch.finfo(torch.complex128).max
], gap_size=32)
torch.Tensor visualization inherits all features from standard NumPy views, including stacking, ordering, colormaps, and large tensor support. TensorView is also the primary view used for rendering PyTorch models.
import svetoviz as sv
view = sv.TensorView(
id="tensor_view_example",
data=torch.rand((4, 4, 256, 256), dtype=torch.float32),
gap_size=10)
sv.view(view=view)
Svetoviz provides two primary methods for attaching the debugger to your models.
@classmethod
def model(cls,
id,
model,
tokenizer=None,
image_processor=None,
video_processor=None,
processor=None,
scheduler=None,
feature_extractor=None,
terminal_callback=None,
blocking=True
)
python
@classmethod
def pipeline(cls,
id,
pipe,
terminal_callback=None,
blocking=True
)
To interact with the model, use the terminal_callback function to send data directly from the GUI, or use the blocking=False argument (WebGPU only) to attach the debugger in non-blocking mode and continue your standard interaction loop.
Selected breakpoints flash during interaction, and their activations are automatically collected. Afterward, you can visually inspect the input and output data alongside their relation to the module.
import svetoviz as sv
tokenizer = GPT2Tokenizer.from_pretrained('gpt2', device_map="cpu")
model = GPT2LMHeadModel.from_pretrained('gpt2', device_map="cpu")
def terminal_callback(buffer, message, images, files):
inputs = tokenizer(message, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=50)
decoded = tokenizer.decode(outputs[0], skip_special_tokens=True)
buffer.send_user_message(message)
buffer.send_system_message(decoded)
sv.model(
id="GPT2",
model=model,
tokenizer=tokenizer,
terminal_callback=terminal_callback
)
| GPT-2 architecture | GPT tokenizer |
|---|
import svetoviz as sv
image_processor = DetrImageProcessor.from_pretrained(
"facebook/detr-resnet-50",
revision="no_timm",
device_map="cpu")
model = DetrForObjectDetection.from_pretrained(
"facebook/detr-resnet-50",
revision="no_timm",
device_map="cpu")
def terminal_callback(buffer, message, images, files):
for image in images:
inputs = image_processor(images=image, return_tensors="pt")
outputs = model(**inputs)
buffer.send_system_message("processed")
sv.model(
id="DERT",
model=model,
image_processor=image_processor,
terminal_callback=terminal_callback
)
| DETR Conv2d | DETR kernel |
|---|
| YOLOS Conv2d | YOLOS linear |
|---|
The blocking=False argument starts the debugger in non-blocking mode, allowing you to continue with your model interaction as usual.
import svetoviz as sv
tokenizer = AutoTokenizer.from_pretrained(
"speakleash/Bielik-Minitron-7B-v3.0-Instruct")
model = AutoModelForCausalLM.from_pretrained(
"speakleash/Bielik-Minitron-7B-v3.0-Instruct",
torch_dtype=torch.float16)
sv.model(
id="Bielik-Minitron-7B",
model=model,
tokenizer=tokenizer,
blocking=False
)
while True:
text = my_external_input_message()
inputs = tokenizer(text, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=50)
Collected activations are stored in RAM. For small models, you can inspect an entire pass. For larger models like diffusion models, select specific breakpoints. For example, you can select the Scheduler module to see each step of the denoising process.
import svetoviz as sv
pipe = DiffusionPipeline.from_pretrained(
"stable-diffusion-v1-5/stable-diffusion-v1-5",
torch_dtype=torch.float16)
pipe = pipe.to("mps")
pipe.enable_attention_slicing()
def terminal_callback(buffer, message, images, files):
buffer.send_system_message(message)
image = pipe(message).images[0]
image.show("output.png")
sv.pipeline(
id="stable-diffusion-v1-5",
pipe=pipe,
terminal_callback=terminal_callback
)
| stable-diffusion-1-5 structure | stable-diffusion-1-5 activation |
|---|
Use the Views API with ModelView or PipelineView to build a compressed, static representation of the model:
import svetoviz as sv
view = sv.ModelView(
id="detr-resnet-50",
model=model,
image_processor=image_processor
)
sv.save_to_disk(view=view, directory="output/detr_scene")
Use the settings window to modify various rendering aspects of your scene. Adjust themes, layouts, or matrix settings to control the visual representation of data values when viewed at close range (WebConfig.matrix_mode: quads, cubes, diamonds, spheres).
Online models are browsable at https://www.svetoviz.com.
The svetoviz Python package is the entry point for the whole application. Every helper builds a scene in your Python process and streams it to the WebGPU renderer, which opens automatically in your browser at http://localhost:8000. There is no separate native binary to install - the renderer ships with the package and runs locally.
Download examples/quickstart_webgpu.py for a complete, runnable script.
Every data type is reached through the same set of class methods, so moving between arrays, images, tensors and models only changes the function you call:
| Call | Purpose |
|---|---|
sv.array(np_array, gap_size=0, ordering=None) |
Visualize a single NumPy array |
sv.arrays(arrays, gap_size=0) |
Visualize a list of NumPy arrays |
sv.tensor(tensor, gap_size=0, ordering=None) |
Visualize a single torch.Tensor |
sv.tensors(tensors, gap_size=0) |
Visualize a list of tensors |
sv.image(image) |
Visualize one image (URL / path / PIL) |
sv.images(images) |
Visualize a list of images |
sv.pytorch(module, terminal_callback=None) |
Attach the debugger to a nn.Module |
sv.model(id, model, ...) |
Attach the debugger to a Hugging Face model |
sv.pipeline(id, pipe, ...) |
Attach the debugger to a pipeline |
sv.view(view) |
Open a View or Layout instance |
sv.save_to_disk(view, directory, ...) |
Build a scene offline |
sv.load_from_disk(directory) |
Open a previously built scene |
Assemble a scene from Views and Layouts and control the spatial organization with padding, spacing and gravity. These arguments are available on every layout container, so the same code produces a consistent scene whether it is opened live or built offline.
import svetoviz as sv
import numpy as np
view = sv.GridLayout(
id="layout",
title="Grid Layout",
padding="2%",
title_color=(155, 155, 155),
background_color=(0, 0, 0, 255),
spacing=40,
views=[
sv.VerticalLayout(
id="vertical1",
title="np.float32",
padding="5%",
spacing="5%",
background_color=(50, 50, 50, 255),
views=[
sv.NumpyView(
id="float32",
data=np.random.rand(6, 24, 128, 32).astype(np.float32),
gap_size=10,
ordering=None)
]
),
sv.VerticalLayout(
id="vertical2",
title="Images",
padding="5%",
spacing="5%",
background_color=(50, 50, 50, 255),
views=[
sv.DiskImageView(
id="disk_image",
image=IMAGE_URL),
sv.LazyImageView(
id="lazy_image",
image=IMAGE_URL)
]
),
],
)
sv.view(view=view)
Directory views load and organize an entire folder of images into a structured scene:
import svetoviz as sv
view = sv.DirectorySpiralView(
directory="downloaded_images",
limit=200,
lazy=False
)
sv.view(view)
Build a scene once and reopen it later without the original data. save_to_disk() writes tiles plus a tree.db, and load_from_disk() opens it again:
import svetoviz as sv
sv.save_to_disk(view=view, directory="output/scene")
sv.load_from_disk(directory="output/scene")
Svetoviz provides native support for PyTorch modules. Your interaction activations are collected and presented on the screen, allowing for real-time inspection of data transformations.
114 documented modules are supported: 73 module pages plus 28 activation functions and 13 loss functions. Every module is traced through the same pipeline: input -> weights -> output, with the exact relation between a selected output value and the input values that produced it.
The three views below show that pipeline on nn.Conv3d. First the input volume is convolved by the learned kernel, producing a stack of spatial feature maps. Then each output value can be traced back to the exact input positions and kernel weights that produced it. Finally, the weights, bias, input and output tensors are inspected side by side for the selected value.
nn.Conv3d feature maps - the input volume convolved with the learned kernel produces one spatial feature map per output channel.
nn.Conv3d value mapping - a selected output value is traced back to the input patch and the kernel weights that produced it.
nn.Conv3d bias and weight inspection - weights, bias, input and output tensors are shown side by side for the selected value.
The pytorch interface wraps your nn.Module and provides a terminal for live interaction. This allows you to process data and inspect the resulting tensors without leaving the visualization environment.
import svetoviz as sv
import torch
import torch.nn as nn
from PIL import Image
url = "https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg"
img = Image.open(requests.get(url, stream=True).raw).resize((64, 64))
img_np = np.array(img).transpose(2, 0, 1)
image_data = torch.from_numpy(img_np).float().unsqueeze(0)
conv = nn.Conv2d(3, 4, 5, padding=10)
def terminal_callback(buffer, message, images, files):
conv(image_data)
buffer.send_system_message("processed")
sv.pytorch(module=conv, terminal_callback=terminal_callback)
You can hover or click on output values to see the mappings and relations between layers. Svetoviz provides a visual explanation of the provenance for each value in the tensor.
For example, you can find the exact kernel position for convolutions, or visualize the column-to-patch mapping for operations like fold and unfold. Clicking an output value reveals the input-to-output spatial relationship.
Each table lists the module, a one-line purpose and the parameters that matter most when inspecting it. The tables follow the documentation category order: convolution, pooling, padding, normalization, linear and embedding, dropout, shape and view, then activation functions, and loss functions last. Every module links to its illustrated guide on https://pytorch.svetoviz.com.
| Module | Purpose | Key parameters |
|---|---|---|
nn.Conv1d |
1-D convolution over signals (N, C, L) |
in_channels ,out_channels ,kernel_size ,stride ,padding ,dilation ,groups |
nn.ConvTranspose1d |
Transposed 1-D convolution (learned upsampling) | in_channels ,out_channels ,kernel_size ,stride ,padding ,output_padding |
nn.Conv2d |
2-D convolution over images (N, C, H, W) |
in_channels ,out_channels ,kernel_size ,stride ,padding ,groups |
nn.ConvTranspose2d |
Transposed 2-D convolution (decoders, GANs) | in_channels ,out_channels ,kernel_size ,stride ,padding ,output_padding |
nn.Conv3d |
3-D convolution over volumes (N, C, D, H, W) |
in_channels ,out_channels ,kernel_size ,stride ,padding |
nn.ConvTranspose3d |
Transposed 3-D convolution | in_channels ,out_channels ,kernel_size ,stride ,padding |
| Module | Purpose | Key parameters |
|---|---|---|
nn.MaxPool1d |
Max pooling over 1-D signals | kernel_size ,stride ,padding ,dilation ,return_indices |
nn.MaxPool2d |
Max pooling over 2-D feature maps | kernel_size ,stride ,padding ,return_indices |
nn.MaxPool3d |
Max pooling over 3-D volumes | kernel_size ,stride ,padding ,return_indices |
nn.MaxUnpool1d |
Inverse of MaxPool1d using stored indices |
kernel_size ,stride ,padding |
nn.MaxUnpool2d |
Inverse of MaxPool2d using stored indices |
kernel_size ,stride ,padding |
nn.MaxUnpool3d |
Inverse of MaxPool3d using stored indices |
kernel_size ,stride ,padding |
nn.AvgPool1d |
Average pooling over 1-D signals | kernel_size ,stride ,padding ,count_include_pad |
nn.AvgPool2d |
Average pooling over 2-D feature maps | kernel_size ,stride ,padding ,count_include_pad |
nn.AvgPool3d |
Average pooling over 3-D volumes | kernel_size ,stride ,padding ,count_include_pad |
nn.LPPool1d |
Lp-norm pooling over 1-D signals | norm_type ,kernel_size ,stride |
nn.LPPool2d |
Lp-norm pooling over 2-D feature maps | norm_type ,kernel_size ,stride |
nn.LPPool3d |
Lp-norm pooling over 3-D volumes | norm_type ,kernel_size ,stride |
nn.AdaptiveMaxPool1d |
Max pool to a fixed output length | output_size ,return_indices |
nn.AdaptiveMaxPool2d |
Max pool to a fixed output grid | output_size ,return_indices |
nn.AdaptiveMaxPool3d |
Max pool to a fixed output volume | output_size ,return_indices |
nn.AdaptiveAvgPool1d |
Average pool to a fixed output length | output_size |
nn.AdaptiveAvgPool2d |
Average pool to a fixed output grid | output_size |
nn.AdaptiveAvgPool3d |
Average pool to a fixed output volume | output_size |
nn.FractionalMaxPool2d |
Random-step max pooling with fractional coverage | kernel_size ,output_ratio /output_size |
nn.FractionalMaxPool3d |
3-D fractional max pooling | kernel_size ,output_ratio /output_size |
| Module | Purpose | Key parameters |
|---|---|---|
nn.ReflectionPad1d |
Reflects the signal at the border (1-D) | padding |
nn.ReflectionPad2d |
Reflects the image at the border (2-D) | padding |
nn.ReflectionPad3d |
Reflects the volume at the border (3-D) | padding |
nn.ReplicationPad1d |
Repeats edge values (1-D) | padding |
nn.ReplicationPad2d |
Repeats edge values (2-D) | padding |
nn.ReplicationPad3d |
Repeats edge values (3-D) | padding |
nn.ZeroPad1d |
Zero padding (1-D) | padding |
nn.ZeroPad2d |
Zero padding (2-D) | padding |
nn.ZeroPad3d |
Zero padding (3-D) | padding |
nn.ConstantPad1d |
Constant-value padding (1-D) | padding ,value |
nn.ConstantPad2d |
Constant-value padding (2-D) | padding ,value |
nn.ConstantPad3d |
Constant-value padding (3-D) | padding ,value |
nn.CircularPad1d |
Wraps the signal around (1-D) | padding |
nn.CircularPad2d |
Wraps the image around (2-D) | padding |
nn.CircularPad3d |
Wraps the volume around (3-D) | padding |
| Module | Purpose | Key parameters |
|---|---|---|
nn.BatchNorm1d |
Normalizes per channel across a batch (1-D) | num_features ,eps ,momentum ,affine ,track_running_stats |
nn.BatchNorm2d |
Normalizes per channel across a batch (2-D) | num_features ,eps ,momentum ,affine |
nn.BatchNorm3d |
Normalizes per channel across a batch (3-D) | num_features ,eps ,momentum ,affine |
nn.InstanceNorm1d |
Normalizes each sample independently (1-D) | num_features ,eps ,momentum ,affine ,track_running_stats |
nn.InstanceNorm2d |
Normalizes each sample independently (2-D) | num_features ,eps ,momentum ,affine |
nn.InstanceNorm3d |
Normalizes each sample independently (3-D) | num_features ,eps ,momentum ,affine |
nn.LayerNorm |
Normalizes over the trailing normalized shape | normalized_shape ,eps ,elementwise_affine |
nn.GroupNorm |
Splits channels into groups and normalizes each | num_groups ,num_channels ,eps ,affine |
nn.LocalResponseNorm |
Lateral inhibition across neighbouring channels | size ,alpha ,beta ,k |
| Module | Purpose | Key parameters |
|---|---|---|
nn.Linear |
Fully connected transform y = xA^T + b |
in_features ,out_features ,bias |
nn.Bilinear |
Bilinear combination of two inputs | in1_features ,in2_features ,out_features ,bias |
nn.Embedding |
Lookup table mapping indices to vectors | num_embeddings ,embedding_dim ,padding_idx ,max_norm |
nn.EmbeddingBag |
Embedding lookup with on-the-fly reduction | num_embeddings ,embedding_dim ,mode (mean /sum /max ) |
nn.CosineSimilarity |
Cosine similarity along a dimension | dim ,eps |
nn.PairwiseDistance |
p-norm distance between two batches | p ,eps ,keepdim |
| Module | Purpose | Key parameters |
|---|---|---|
nn.Dropout |
Randomly zeroes elements during training | p ,inplace |
nn.Dropout1d |
Drops entire 1-D channels | p ,inplace |
nn.Dropout2d |
Drops entire feature maps | p ,inplace |
nn.Dropout3d |
Drops entire volumetric channels | p ,inplace |
nn.AlphaDropout |
Self-normalizing dropout for SELU networks | p ,inplace |
nn.FeatureAlphaDropout |
Channel-wise AlphaDropout | p ,inplace |
| Module | Purpose | Key parameters |
|---|---|---|
nn.Unfold |
Extracts sliding local blocks into columns | kernel_size ,dilation ,padding ,stride |
nn.Fold |
Combines sliding local blocks back into a tensor | output_size ,kernel_size ,dilation ,padding ,stride |
nn.Flatten |
Flattens a contiguous range of dimensions | start_dim ,end_dim |
nn.Unflatten |
Expands one dimension into a shape | dim ,unflattened_size |
nn.PixelShuffle |
Rearranges (*, C*r^2, H, W) into(*, C, H*r, W*r) |
upscale_factor |
nn.PixelUnshuffle |
Inverse rearrangement of PixelShuffle |
downscale_factor |
nn.Upsample |
Generic resampling of spatial dimensions | size /scale_factor ,mode ,align_corners |
nn.UpsamplingNearest2d |
Nearest-neighbour upsampling, deprecated alias | size /scale_factor |
nn.UpsamplingBilinear2d |
Bilinear upsampling, deprecated alias | size /scale_factor |
nn.ChannelShuffle |
Interleaves channels between groups | groups |
nn.Identity |
Pass-through, useful as a breakpoint placeholder | none |
import svetoviz as sv
def demo_activation():
input_tensor = torch.from_numpy(img_np)\
.view(1, 1, height, width)\
.repeat(1, 2, 1, 1)
activations = nn.ModuleDict({
"ReLU": nn.ReLU(),
"LeakyReLU": nn.LeakyReLU(negative_slope=0.02),
"PReLU": nn.PReLU(num_parameters=2),
"GELU": nn.GELU(),
"SiLU": nn.SiLU(),
"Mish": nn.Mish(),
"Hardswish": nn.Hardswish(),
"Sigmoid": nn.Sigmoid(),
"Tanh": nn.Tanh(),
"Softmax": nn.Softmax(dim=1),
"LogSoftmax": nn.LogSoftmax(dim=-1),
"ELU": nn.ELU(),
"SELU": nn.SELU(),
"Softplus": nn.Softplus(),
"Threshold": nn.Threshold(threshold=0.1, value=-2.0),
"Softshrink": nn.Softshrink(lambd=0.5),
"GLU": nn.GLU(dim=1),
"Hardshrink": nn.Hardshrink(lambd=0.5),
"Hardsigmoid": nn.Hardsigmoid(),
"Hardtanh": nn.Hardtanh(min_val=-1.0, max_val=1.0),
"LogSigmoid": nn.LogSigmoid(),
"ReLU6": nn.ReLU6(),
"RReLU": nn.RReLU(),
"CELU": nn.CELU(),
"Softsign": nn.Softsign(),
"Tanhshrink": nn.Tanhshrink(),
"Softmin": nn.Softmin(dim=1),
"Softmax2d": nn.Softmax2d()
})
def terminal_callback(buffer, message, images, files):
for name, module in activations.items():
output = module(input_tensor)
buffer.send_system_message(f"Applied {name}: Output shape {list(output.shape)}")
sv.pytorch(module=activations, terminal_callback=terminal_callback)
| Module | Purpose | Key parameters |
|---|---|---|
nn.ReLU |
Half-wave rectifier, max(0, x) |
inplace |
nn.LeakyReLU |
ReLU with a small negative slope | negative_slope ,inplace |
nn.PReLU |
ReLU with a learned negative slope | num_parameters ,init |
nn.GELU |
Gaussian error linear unit | approximate (none /tanh ) |
nn.SiLU |
Sigmoid-weighted linear unit (Swish) | inplace |
nn.Mish |
Smooth non-monotonic activation | inplace |
nn.Hardswish |
Piecewise-linear approximation of SiLU | inplace |
nn.Sigmoid |
Logistic squashing to (0, 1) |
none |
nn.Tanh |
Hyperbolic tangent, zero-centred | none |
nn.Softmax |
Normalizes values into a probability simplex | dim |
nn.LogSoftmax |
Log of the softmax, numerically stable | dim |
nn.Softmin |
Softmax over negated inputs | dim |
nn.Softmax2d |
Softmax over each spatial location | none |
nn.ELU |
Exponential linear unit | alpha ,inplace |
nn.SELU |
Self-normalizing exponential unit | inplace |
nn.CELU |
Continuously differentiable exponential unit | alpha ,inplace |
nn.Softplus |
Smooth approximation of ReLU | beta ,threshold |
nn.Softsign |
x / (1 + abs(x)) , a smooth squashing curve |
none |
nn.Tanhshrink |
x - tanh(x) |
none |
nn.Threshold |
Hard threshold with a replacement value | threshold ,value |
nn.Softshrink |
Soft thresholding, used in sparse coding | lambd |
nn.Hardshrink |
Hard thresholding | lambd |
nn.Hardsigmoid |
Piecewise-linear sigmoid | inplace |
nn.Hardtanh |
Clamps values into a fixed interval | min_val ,max_val |
nn.LogSigmoid |
Log of the sigmoid | none |
nn.ReLU6 |
ReLU capped at 6 | inplace |
nn.RReLU |
Randomized leaky ReLU during training | lower ,upper ,inplace |
nn.GLU |
Gated linear unit over a split dimension | dim |
import svetoviz as sv
def demo_loss():
losses = nn.ModuleDict({
"L1": nn.L1Loss(),
"MSE": nn.MSELoss(),
"SmoothL1": nn.SmoothL1Loss(),
"Huber": nn.HuberLoss(delta=1.0),
"CrossEntropy": nn.CrossEntropyLoss(),
"BCEWithLogits": nn.BCEWithLogitsLoss(),
"KLDiv": nn.KLDivLoss(reduction="batchmean"),
"PoissonNLL": nn.PoissonNLLLoss(),
"MultiLabelSoftMargin": nn.MultiLabelSoftMarginLoss(),
"MarginRanking": nn.MarginRankingLoss(margin=0.0),
"CosineEmbedding": nn.CosineEmbeddingLoss(margin=0.0),
"TripletMargin": nn.TripletMarginLoss(margin=1.0, p=2.0),
"TripletMarginWithDistance": nn.TripletMarginWithDistanceLoss()
})
def terminal_callback(buffer, message, images, files):
for name in losses:
buffer.send_system_message(f"Loaded {name}")
sv.pytorch(module=losses, terminal_callback=terminal_callback)
| Module | Purpose | Key parameters |
|---|---|---|
nn.L1Loss |
Mean absolute error | reduction |
nn.MSELoss |
Mean squared error | reduction |
nn.SmoothL1Loss |
Quadratic near zero, linear in the tails | beta ,reduction |
nn.HuberLoss |
Huber combination of L1 and L2 | delta ,reduction |
nn.CrossEntropyLoss |
Log-softmax followed by NLL for class logits | weight ,ignore_index ,label_smoothing |
nn.BCEWithLogitsLoss |
Sigmoid plus binary cross entropy, numerically stable | weight ,pos_weight ,reduction |
nn.KLDivLoss |
Kullback-Leibler divergence between distributions | reduction (batchmean for true KL) |
nn.PoissonNLLLoss |
Negative log likelihood of a Poisson target | log_input ,full ,eps |
nn.MultiLabelSoftMarginLoss |
One-vs-all logistic loss for multi-label targets | weight ,reduction |
nn.MarginRankingLoss |
Ranking loss with a margin between pairs | margin ,reduction |
nn.CosineEmbeddingLoss |
Cosine distance with a target label of 1 or-1 |
margin ,reduction |
nn.TripletMarginLoss |
Anchor / positive / negative embedding separation | margin ,p ,eps ,swap |
nn.TripletMarginWithDistanceLoss |
Triplet loss with a pluggable distance function | distance_function ,margin ,swap |
Browse every module screenshot and per-module walkthrough at https://pytorch.svetoviz.com.
Everything in this README runs in the live viewer. You do not need to install anything to look at the public scenes, module walkthroughs and published datasets.
| Destination | What is there |
|---|---|
| https://www.svetoviz.com | Product overview, the public 3D scene directory and pricing |
| https://www.svetoviz.com/docs | The full manuals and guides mirrored by this README |
| https://pytorch.svetoviz.com | Illustrated per-module guides for all 114 PyTorch modules |
| https://app.svetoviz.com | Dataset scenes published online, browsable in the browser |
The written guides published on the website, in the same order as this README:
| Guide | Covers | Link |
|---|---|---|
| Overview | What Svetoviz is, the visual-debugger concept, supported data types | https://www.svetoviz.com/docs |
| Installation | Package, dependency list, cache setup, demos | https://www.svetoviz.com/docs/install |
| API Reference | Full signatures and parameters for every method, view, layout, remote view and utility | https://www.svetoviz.com/docs/docs |
| Images | image /images polymorphism, batch inspection, cache configuration |
https://www.svetoviz.com/docs/images |
| NumPy | Single array inspection, stacking, colormaps, mixed dtypes, axis ordering, large high-dimensional arrays | https://www.svetoviz.com/docs/numpy |
| Datasets | Building and launching a dataset scene, search database, compression levels | https://www.svetoviz.com/docs/datasets |
| Views | View vsLayout , directory views, layout nesting, offline scene building |
https://www.svetoviz.com/docs/views |
| torch.Tensor | Single tensor inspection, mixed dtypes, stacking, ordering, large tensors | https://www.svetoviz.com/docs/tensor |
| Models | model() vspipeline() , terminal callbacks, non-blocking mode, diffusion pipelines |
https://www.svetoviz.com/docs/models |
| PyTorch | Wrapping nn.Module , the interaction terminal, layer relations and provenance mapping |
https://www.svetoviz.com/docs/pytorch |
| PyTorch Modules | The illustrated module catalog (114 modules) | https://pytorch.svetoviz.com |
| Activation functions | All 28 supported activation modules | https://www.svetoviz.com/docs/activations |
| Loss functions | All 13 supported loss modules | https://www.svetoviz.com/docs/loss |
| Demo | Link |
|---|---|
| NumPy array inspection | https://www.youtube.com/watch?v=fWhK4oPcSf0 |
torch.Tensor inspection |
https://www.youtube.com/watch?v=IijSmLB1FgY |
| PyTorch Debugger | https://www.youtube.com/watch?v=JGBud9nniOM |
| Model analysis (DETR) | https://www.youtube.com/watch?v=SPCUtlT1298 |
| Model debugger (GPT-2) | https://www.youtube.com/watch?v=LJa9MFEWcWE |
| Dataset explorer | https://www.youtube.com/watch?v=DEuSVW1oJG4 |
| Image browser | https://www.youtube.com/watch?v=xHb_U8BAsEs |
- Website / public directory:https://www.svetoviz.com
- Documentation:https://www.svetoviz.com/docs
- PyTorch module guides:https://pytorch.svetoviz.com
- Online datasets:https://app.svetoviz.com
- Python package wheel index:https://svetoviz.com/webgpu/simple/
- Author - LinkedIn:https://www.linkedin.com/in/piotr-gryko-946756101/
- Author - GitHub:https://github.com/PiotrGryko
Svetoviz Research - advancing high-dimensional data visualization and machine learning interpretability.
Piotr Gryko
ul. Prezydenta Ryszarda Kaczorowskiego 14 / 271
15-375 Bialystok, Poland
NIP: 9662022689
REGON: 368029613
Registered in Bialystok, Poland.
www.svetoviz.com | Documentation | PyTorch Debugger
Built for the Global AI Research Community.
Start visualizing - open the live Svetoviz viewer
https://www.svetoviz.com - documentation, install commands, pricing and the public model / dataset browser.