MODEL EXPLORER / GENERATIVE MODELS
Train a generator against a discriminator
Which network is being updated, and what is it trying to change?
RECORDED NUMERICAL EXAMPLE
Update one network at a time.
Recorded two-dimensional GAN updates on four toy points. Choose the discriminator and generator stages to inspect which parameters and generated samples change. One alternating update does not establish a learned distribution or stable GAN training.
Start from the same random initialization and fixed noise samples. The discriminator assigns probabilities to real and generated points. Two separate optimizers will update one network at a time.
- ● Real training points
- ◆ Generated points · fixed noise
Both axes use the same scale.
Recorded point coordinates
| Series | Feature x | Feature y |
|---|---|---|
| Real training points | 0.8 | 0.9 |
| Real training points | 1.1 | 1 |
| Real training points | 0.9 | 1.2 |
| Real training points | 1.2 | 0.8 |
| Generated points · fixed noise | -0.2281 | -0.3277 |
| Generated points · fixed noise | -0.2688 | -0.1584 |
| Generated points · fixed noise | -0.1617 | -0.1855 |
| Generated points · fixed noise | -0.02167 | -0.008925 |
Bars share one scale within this example. Values are rounded to four significant digits.
- Generator parameter change · norm since initialization
- 0
- Discriminator parameter change · norm since initialization
- 0
- Discriminator loss
- 1.438
- Non-saturating generator loss
- 0.7693
Verified by the local recipe
- A discriminator update changes only D; detached samples give the generator no gradient
- A generator update changes only G while retaining a gradient path through frozen D
- Stable logit losses match minimax and non-saturating analytic gradients
- The non-saturating loss gives a stronger gradient in the confident-fake example
Download the source and run.py to reproduce these checks. Choosing an example here replays recorded values.
THE SAME MODEL, ON YOUR MACHINE
Pick up where
the graph leaves off.
Follow real and generated points through one discriminator, then replay separate optimizer steps and compare generator-loss gradients.
Use in VS Code ↗1. Save these files in one folder
2. Reproduce the example
Use Python 3.13 in a dedicated environment, matching the tested recipe. These commands are for macOS / Linux shells.
python3.13 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
python run.pyExpected output: [2,4,1]
Input 1: [4,4] · float32 randn
Input 2: [4,2] · float32 randn · CPU / eval · seed 0
3. Open the source in TensorViz
Install the preview, open this folder in local VS Code, and choose Open as Graph above TinyGAN in model.py. Select your Python environment. Save before choosing Validate.
Installation and supported setup ↗
The recipe was run with Python 3.13.13 and Torch 2.7.1. This is an untrained example; a successful shape check does not measure accuracy.
ABOUT THIS EXAMPLE
Follow real and generated points through one discriminator, then replay separate optimizer steps and compare generator-loss gradients.
Training method · 2014
Generative adversarial networks
MLP generator 4 → 8 → 2 and shared discriminator 2 → 8 → 1. Stable logit losses reproduce the binary objectives; recorded training uses one D step and one non-saturating G step on four synthetic points.
Source, capture & limitations +
A toy two-dimensional training process, not a trained image model. One optimizer step does not demonstrate distribution matching, stable convergence or protection against mode collapse. The forward graph shares D across both inputs; separate update functions in the downloaded source implement detach/freeze behavior.
Original TensorViz teaching example. PyTorch provides the underlying operators.
No separate redistribution license has been declared for these project examples.
- Content revision
c8dd1ae1b30e8df7- Source SHA-256
83dea846127a7455d89d2d0faaec5105d412b5b4eb434b34dce826aca371956d- Captured
- 2026-09-17 · Python 3.13.13 / Torch 2.7.1
Two-dimensional GAN forward, separate SGD updates, frozen/detached parameter checks and minimax/non-saturating gradient comparisons. No image dataset or trained generator.
Read the model manifest ↗