std1.0.0-beta-7 SafeC docs

std :: ml::gan

Struct std::Gan

#include <std/ml/gan.h> source

struct Gan {
    struct Mlp gen;
    struct Mlp genEma;
    struct Mlp disc;
    struct Optimizer optG;
    struct Optimizer optD;
    struct GanConfig cfg;
    struct Rng rng;
    struct TensorArena stepArena;
    unsigned long steps;
}

Fields

§struct Mlp gensource
§struct Mlp genEmasource

averaged generator (a copy of gen when emaDecay is 0)

§struct Mlp discsource
§struct Optimizer optGsource
§struct Optimizer optDsource
§struct Rng rngsource
§struct TensorArena stepArenasource
§unsigned long stepssource

generator steps taken

Methods

§struct GanLosses train_step(const &FloatTensor real, ?&FloatTensor labels)source · definition

One generator step after cfg.nCritic discriminator steps on 'real' ([m, dataDim]); 'labels' (m class indices) for a conditional GAN, else null.

§struct GanLosses train(const &Dataset data, unsigned long epochs, unsigned long batchSize)source · definition

Epochs over a dataset in shuffled batches (labels taken from the dataset when the GAN is conditional). Returns the last step's losses.

§&FloatTensor sample(unsigned long n, ?&FloatTensor labels)source · definition

n generated rows from the averaged generator (heap tensor, caller frees); 'labels' as above.

D's raw score for rows (higher = more real).

§void collect_params(&Vec<&FloatTensor> out) constsource · definition

Parameterized (module.h): G's and D's parameters; the state adds the averaged generator (and a Dcgan's buffers).

§void collect_state(&Vec<&FloatTensor> out) constsource · definition
§void drop()source · definition
§void free() consumesource · definition

= drop()

§static struct Gan new(unsigned long dataDim, const &GanConfig cfg)source · definition