def __init__(self, params, session, name="GAN", mode="train"): self.generator = tf.make_template(name + '/generator', Generator) self.discriminator = tf.make_template(name + '/discriminator', Discriminator) Trainer.__init__(self, session, params, name=name, mode=mode) self.build_eval_graph() self.train_X = np.transpose(self.train_X, (0, 3, 1, 2)) self.test_X = np.transpose(self.test_X, (0, 3, 1, 2))
def __init__(self, sess, model, wgan, params, name="classifier", mode="train"): ''' Init: sess: tf.Session() model: function that takes in input placeholder, is_training placeholder and params dictionary, wgan: trainer for adversarial generator. params: dictionary of hyperparameters for the model and training. ''' self.model = model self.gan = wgan Trainer.__init__(self, sess, params, name, mode) self.adversarial_dir = os.path.join(self.checkpoint_dir, "adversarial") check_folder(self.adversarial_dir)
def __init__(self, sess, model, generator, params, name="classifier", mode="train"): ''' Init: sess: tf.Session() model: function that takes in input placeholder, is_training placeholder and params dictionary, adv_trainer: trainer for adversarial generator, must be not None is adversarial_mode == "gan" returns a tensor containing the logits. params: dictionary of hyperparameters for the model and training. ''' self.model = model self.generator = generator Trainer.__init__(self, sess, params, name, mode) self.adversarial_dir = os.path.join(self.checkpoint_dir, "adversarial") check_folder(self.adversarial_dir)