|
pulsatrix
|
E-GAN's own population-of-generators infrastructure (Wang et al. 2019, "Evolutionary Generative Adversarial Networks"): N independently-parameterized generator Modules, and the concrete mechanism for training one shared discriminator against fake samples pooled from the whole population – in E-GAN, the discriminator's own training distribution is the union of every population member's output, not one generator's alone, which is what gives the discriminator (and, in turn, each generator's own training signal) a harder, more diverse target than a single- generator GAN ever sees. More...
#include <memory>#include <stdexcept>#include <vector>#include "pulsatrix/module.hpp"#include "pulsatrix/tensor.hpp"

Go to the source code of this file.
Classes | |
| class | pulsatrix::GeneratorPopulation |
| Owns N independently-parameterized generator Modules. More... | |
Namespaces | |
| namespace | pulsatrix |
Functions | |
| Tensor | pulsatrix::SliceBatch (const Tensor &t, int64_t start, int64_t count, DeviceBackend *backend) |
| Extracts rows [start, start+count) along t's leading dimension into a new Tensor – the inverse of Tensor::Stack, needed to split a pooled discriminator gradient back into each population member's own slice. | |
| std::vector< float > | pulsatrix::FlattenParameters (Module &module) |
| Flattens every parameter tensor module.parameters() reports (in that order) into one vector – the concrete mechanism Phase 5 Mission 2's mutation-offspring construction uses to copy a parent generator's current weights into a freshly-constructed (architecturally identical) offspring instance before mutating the copy. | |
| void | pulsatrix::RestoreParameters (Module &module, const std::vector< float > &flat) |
| Overwrites every parameter tensor module.parameters() reports (in that order) from flat – the inverse of FlattenParameters. | |
| void | pulsatrix::ZeroModuleGradients (Module &module) |
| Zeros every gradient tensor module.parameters() reports – a standalone alternative to calling some optimizer's own zero_grad(module) when no persistent per-module optimizer instance is being kept around (Phase 5 Mission 2's own mutation-attempt loop constructs a fresh optimizer per attempt, so there is no single optimizer instance left to call zero_grad on between generations). | |
| Tensor | pulsatrix::GeneratePooledFakeSamples (GeneratorPopulation &population, const std::vector< Tensor > &noise_per_generator, DeviceBackend *backend) |
| Runs every population member's generator forward on its own noise batch (noise_per_generator[i] for population member i), then pools the results (Tensor::Stack, concatenated along the batch dimension, in population order) into one combined fake-sample batch – the discriminator's own training input in E-GAN. | |
| void | pulsatrix::BackwardThroughPopulation (GeneratorPopulation &population, const Tensor &pooled_grad, const std::vector< int64_t > &batch_sizes, DeviceBackend *backend) |
| Given pooled_grad (the gradient w.r.t. the pooled fake batch GeneratePooledFakeSamples produced – e.g. from discriminator.backward() called after a forward on that pooled batch), routes each population member's own slice back through that member's own backward() – the concrete mechanism that lets one shared discriminator train against every generator's own output while each generator's own parameters still receive exactly its own correct gradient. | |
E-GAN's own population-of-generators infrastructure (Wang et al. 2019, "Evolutionary Generative Adversarial Networks"): N independently-parameterized generator Modules, and the concrete mechanism for training one shared discriminator against fake samples pooled from the whole population – in E-GAN, the discriminator's own training distribution is the union of every population member's output, not one generator's alone, which is what gives the discriminator (and, in turn, each generator's own training signal) a harder, more diverse target than a single- generator GAN ever sees.