gan

Convenience Restorer to be used with ashpy.trainers.gan .

Classes

AdversarialEncoderRestorer Convenience Restorer for ease of use with the EncoderTrainer.
AdversarialRestorer Convenience Restorer for ease of use with the AdversairalTrainer.
class ashpy.restorers.gan.AdversarialEncoderRestorer(logdir=PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/ashpy/checkouts/master/docs/source/log'), ckpts_dir='ckpts', expect_partial=True)[source]

Bases: ashpy.restorers.gan.AdversarialRestorer

Convenience Restorer for ease of use with the EncoderTrainer.

restore_encoder(model)[source]

Restore the Encoder model.

Parameters:model (tf.keras.Model) – The placeholder model in which values from the checkpoint will be restored.
Return type:Model
Returns:Restored model.

Warning

When restoring a tf.keras.Model object from checkpoint assure that the model has been correctly built and instantiated by firstly calling it on some sample inputs. In the case of a model built with either the Sequential or Functional API an exception will be raised; for a model built with the Chainer API it will fail silently, restoration will be “successful” but no values will actually be restored since there are no valid placeholder as the model has not be built yet.

restore_encoder_optimizer(optimizer)[source]

Restore the Optimizer used to train the Encoder model.

Parameters:model (tf.keras.optimizers.Optimizer) – The placeholder Optimizer in which values from the checkpoint will be restored.
Return type:OptimizerV2
Returns:Restored optimizer.
class ashpy.restorers.gan.AdversarialRestorer(logdir=PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/ashpy/checkouts/master/docs/source/log'), ckpts_dir='ckpts', expect_partial=True)[source]

Bases: ashpy.restorers.restorer.Restorer

Convenience Restorer for ease of use with the AdversairalTrainer.

restore_discriminator(model)[source]

Restore the Discriminator model.

Parameters:model (tf.keras.Model) – The placeholder model in which values from the checkpoint will be restored.
Return type:Model
Returns:Restored model.

Warning

When restoring a tf.keras.Model object from checkpoint assure that the model has been correctly built and instantiated by firstly calling it on some sample inputs. In the case of a model built with either the Sequential or Functional API an exception will be raised; for a model built with the Chainer API it will fail silently, restoration will be “successful” but no values will actually be restored since there are no valid placeholder as the model has not be built yet.

restore_discriminator_optimizer(optimizer)[source]

Restore the Optimizer used to train the Discriminator model.

Parameters:model (tf.keras.optimizers.Optimizer) – The placeholder Optimizer in which values from the checkpoint will be restored.
Return type:OptimizerV2
Returns:Restored optimizer.
restore_generator(model)[source]

Restore the Generator model.

Parameters:model (tf.keras.Model) – The placeholder model in which values from the checkpoint will be restored.
Return type:Model
Returns:Restored model.

Warning

When restoring a tf.keras.Model object from checkpoint assure that the model has been correctly built and instantiated by firstly calling it on some sample inputs. In the case of a model built with either the Sequential or Functional API an exception will be raised; for a model built with the Chainer API it will fail silently, restoration will be “successful” but no values will actually be restored since there are no valid placeholder as the model has not be built yet.

restore_generator_optimizer(optimizer)[source]

Restore the Optimizer used to train the Generator model.

Parameters:model (tf.keras.optimizers.Optimizer) – The placeholder Optimizer in which values from the checkpoint will be restored.
Return type:OptimizerV2
Returns:Restored optimizer.