Coverage for hypergan/gans/base_gan.py : 67%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
batch_size=None, width=None, height=None, channels=None): """ Initialized a new GAN."""
# A GAN as a component has a parent of itself # gan.gan.gan.gan.gan.gan
return self._batch_size raise ValidationException("gan.batch_size() requested but no inputs provided")
return self._channels raise ValidationException("gan.channels() requested but no inputs provided")
return self._width raise ValidationException("gan.width() requested but no inputs provided")
return self._height raise ValidationException("gan.height() requested but no inputs provided")
return None raise ValidationException("Component definition is missing '" + name + "'")
print("[hypergan] Saving network to ", save_file) os.makedirs(os.path.expanduser(os.path.dirname(save_file)), exist_ok=True) saver = tf.train.Saver() saver.save(self.session, save_file)
save_file = os.path.expanduser(save_file) if os.path.isfile(save_file) or os.path.isfile(save_file + ".index" ): print("[hypergan] |= Loading network from "+ save_file) dir = os.path.dirname(save_file) print("[hypergan] |= Loading checkpoint from "+ dir) ckpt = tf.train.get_checkpoint_state(os.path.expanduser(dir)) if ckpt and ckpt.model_checkpoint_path: saver = tf.train.Saver() saver.restore(self.session, save_file) loadedFromSave = True return True else: return False else: return False
|