Skip to content
Yi Zhu edited this page Mar 16, 2021 · 2 revisions

Functionality

GAN is Generative Adversarial Network.

Usage

GAN has to be initialized with a noise generator.

GAN(noise_generator)

GAN uses add_Glayer for Generator and add_Dlayer for Discriminator to add layers. Since the layers are all added to the same array, it has to be finished with all the layers in the generator first then the discriminator. Just like Sequential, it sets the size of input data for each layer automatically.

GAN.add_Glayer(model::GAN, layer::Any;args...)
GAN.add_Dlayer(model::GAN, layer::Any;args...)

model: self reference

layer: a type of layer

args: parameters of the layer for initialization


If the model is used for generation but not training, it requires to be initialized with an extra function before activated.

GAN.initialize(model::GAN, mini_batch::Int64)

model: self reference

mini_batch: the batch size of input data

GAN.activate_Generator(model::GAN)

model: self reference

return: output data


GAN model can be saved and loaded by using the tools save_GAN and load_GAN.

save_GAN(model::GAN, path::String)

model: self reference

path: path

load_GAN(path::String, noise_generator::Any)

path: path of the target model

noise_generator: a noise generator

return: target model