GANExecutor¶
Inheritance Diagram

-
class
ashpy.losses.gan.GANExecutor(fn=None)[source]¶ Bases:
ashpy.losses.executor.Executor,abc.ABCExecutor for GANs.
Implements the basic functions needed by the GAN losses.
Methods
__init__([fn])Initialize the GANExecutor.
call(context, **kwargs)Execute the function, using the information provided by the context.
get_discriminator_inputs(context, …)Return the discriminator inputs.
Attributes
fnReturn the Keras loss function to execute.
global_batch_sizeGlobal batch size comprises the batch size for each cpu.
weightReturn the loss weight.
-
__init__(fn=None)[source]¶ Initialize the GANExecutor.
- Parameters
fn (
tf.keras.losses.Loss) – A Keras Loss to execute.- Returns
-
abstract
call(context, **kwargs)[source]¶ Execute the function, using the information provided by the context.
- Parameters
context (
ashpy.contexts.BaseContext) – The function execution Context.- Returns
tf.Tensor– Output Tensor.
-
static
get_discriminator_inputs(context, fake_or_real, condition, training)[source]¶ Return the discriminator inputs. If needed it uses the encoder.
The current implementation uses the number of inputs to determine whether the discriminator is conditioned or not.
- Parameters
context (
ashpy.contexts.gan.GANContext) – Context for GAN models.fake_or_real (
tf.Tensor) – Discriminator input tensor, it can be fake (generated) or real.condition (
tf.Tensor) – Discriminator condition (it can also be generator noise).training (
bool) – whether is training phase or not
- Return type
- Returns
The discriminator inputs.
-