pulsatrix
Loading...
Searching...
No Matches
egan_training.hpp File Reference

E-GAN's own full generational training loop (Wang et al. 2019): each generation, every population member independently attempts every given mutation objective (Phase 5 Mission 1) via a fresh weight-copy offspring, keeps whichever mutation scored the best combined fitness, then the shared discriminator trains on a real batch plus the (now-mutated) population's own pooled fake output (Phase 5 Mission 0). More...

#include <limits>
#include <memory>
#include <random>
#include <stdexcept>
#include <vector>
#include "pulsatrix/bce_with_logits_loss.hpp"
#include "pulsatrix/egan_mutation.hpp"
#include "pulsatrix/generator_population.hpp"
#include "pulsatrix/sgd_optimizer.hpp"
Include dependency graph for egan_training.hpp:

Go to the source code of this file.

Namespaces

namespace  pulsatrix
 

Functions

template<typename MakeGenerator , typename DOptimizerT >
std::vector< float > pulsatrix::RunEGANGeneration (GeneratorPopulation &population, Module &discriminator, const Tensor &real_batch, const std::vector< Tensor > &noise_per_generator, const std::vector< MutationObjective > &objectives, MakeGenerator make_generator, float g_learning_rate, DOptimizerT &d_optimizer, DeviceBackend *backend, float gamma=0.05f)
 Runs one E-GAN generation: for every population member, attempts every objective in objectives (each against a fresh weight-copy offspring built by make_generator + RestoreParameters), keeps the best-combined-fitness offspring, replaces that population slot with it, then trains discriminator on real_batch plus the now-mutated population's own pooled fake output.
 
template<typename MakeGenerator , typename DOptimizerT , typename RNG >
void pulsatrix::RunEGANTraining (GeneratorPopulation &population, Module &discriminator, const Tensor &real_batch, int num_generations, int64_t noise_dim, int64_t per_generator_batch, const std::vector< MutationObjective > &objectives, MakeGenerator make_generator, float g_learning_rate, DOptimizerT &d_optimizer, DeviceBackend *backend, RNG &rng, float gamma=0.05f)
 RNG-driven wrapper: draws fresh standard-normal noise for every population member every generation, then runs RunEGANGeneration num_generations times.
 

Detailed Description

E-GAN's own full generational training loop (Wang et al. 2019): each generation, every population member independently attempts every given mutation objective (Phase 5 Mission 1) via a fresh weight-copy offspring, keeps whichever mutation scored the best combined fitness, then the shared discriminator trains on a real batch plus the (now-mutated) population's own pooled fake output (Phase 5 Mission 0).

Note
Passing a single-element objectives list (repeated N times, e.g. {Heuristic, Heuristic, Heuristic}) turns this same loop into a compute-matched single-objective GAN baseline – deliberately not a separate code path, so any measured difference between the two arms is attributable to the objective-diversity/selection mechanism itself, not to a structurally different training loop.