GAN CIFAR Example #
Compact LSGAN-style executable path.
This trains:
- a generator
z -> imagetoward the current CIFAR minibatch as a stable warm-up objective; - a discriminator on real CIFAR images (
1) and deterministic noise images (0).
The formal LSGAN objective decomposition lives in NN.Spec.Models.Gan and
NN.MLTheory.Generative.Latent.GAN. A full alternating adversarial trainer can reuse the same
generator/discriminator constructors and data path.
CLI subcommand name used in terminal banners and error messages.
Instances For
Default JSON loss-curve path for this command.
Instances For
Shared vector-image configuration.
The generator, discriminator, latent batch, score batch, and CIFAR vector batch all derive from this record, so shape changes stay centralized.
Instances For
Latent-noise batch shape for the generator input.
Instances For
Flattened CIFAR image-vector batch shape.
Instances For
Discriminator score shape: one scalar score per batch row.
Instances For
Generator network mapping latent vectors to flattened image vectors.
Instances For
Discriminator network mapping flattened image vectors to scalar real/fake scores.
Instances For
Mean-squared error for one supervised sample evaluated through a public prediction closure.
Instances For
Aggregate generator and discriminator scalar losses for one LSGAN reporting step.
The metric receives public prediction functions rather than raw modules. That is the whole point of
this example after the trainer cleanup: the GAN-specific code still defines the task objective, but
the model state, optimizer stepping, and backend details stay inside trainer.trainPairStreamFloat.
Instances For
Train the compact LSGAN-style pair and return a total-loss curve.
The update rule is chosen for stable public runs: the generator first learns toward a fixed CIFAR minibatch, while the discriminator separates that minibatch from deterministic noise. The imported spec/theory modules carry the adversarial objective statements; this runtime path checks that both networks, optimizers, CUDA memory reporting, and real-data loading work together.
Instances For
Executable entrypoint for the compact GAN-style run.
The command loads CIFAR vectors, trains generator and discriminator updates for --steps, and writes
the combined loss curve to the requested logging destination.