Visualization
Computation Graph
simplegrad.visual.inline_comp_graph.graph(tensor: Tensor, path: str | None = None) -> graphviz.Digraph
Render the computation graph of a tensor as an SVG diagram.
Functions decorated with @compound_op are enclosed in a labelled
black-border rectangle. Each distinct call to a compound op gets its own
rectangle, so two calls to softmax produce two separate boxes.
Node colors
- Salmon: leaf tensors (inputs / parameters)
- Steel blue: intermediate tensors
- Gold: operation nodes
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tensor
|
Tensor
|
The output tensor whose computation graph to visualize. |
required |
path
|
str | None
|
If provided, save the SVG to this file path (without extension). |
None
|
Returns:
| Type | Description |
|---|---|
Digraph
|
A |
Source code in simplegrad/visual/inline_comp_graph.py
Training Plots
simplegrad.visual.inline_training_graphs.plot(results: dict[str, list[RecordInfo]], selected: list[str] | None = None, num_cols: int = 2, cell_w: int = 8, cell_h: int = 5, path: Path | None = None, color: str | None = None)
Plot training metrics as line charts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
results
|
dict[str, list[RecordInfo]]
|
Mapping of metric name to list of |
required |
selected
|
list[str] | None
|
Subset of metric names to plot. Plots all if None. |
None
|
num_cols
|
int
|
Number of subplot columns. Defaults to 2. |
2
|
cell_w
|
int
|
Width of each subplot cell in inches. Defaults to 8. |
8
|
cell_h
|
int
|
Height of each subplot cell in inches. Defaults to 5. |
5
|
path
|
Path | None
|
If provided, save the figure to this path. |
None
|
color
|
str | None
|
Fixed color for all lines. Random if None. |
None
|
Source code in simplegrad/visual/inline_training_graphs.py
simplegrad.visual.inline_training_graphs.scatter(results: dict[str, list[RecordInfo]], selected: list[str] | None = None, num_cols: int = 2, cell_w: int = 8, cell_h: int = 5, path: Path | None = None, color: str | None = None)
Plot training metrics as scatter charts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
results
|
dict[str, list[RecordInfo]]
|
Mapping of metric name to list of |
required |
selected
|
list[str] | None
|
Subset of metric names to plot. Plots all if None. |
None
|
num_cols
|
int
|
Number of subplot columns. Defaults to 2. |
2
|
cell_w
|
int
|
Width of each subplot cell in inches. Defaults to 8. |
8
|
cell_h
|
int
|
Height of each subplot cell in inches. Defaults to 5. |
5
|
path
|
Path | None
|
If provided, save the figure to this path. |
None
|
color
|
str | None
|
Fixed color for all points. Random if None. |
None
|