W3cubDocs

/TensorFlow Python

tf.contrib.gan.gan_model

tf.contrib.gan.gan_model(
    generator_fn,
    discriminator_fn,
    real_data,
    generator_inputs,
    generator_scope='Generator',
    discriminator_scope='Discriminator',
    check_shapes=True
)

Defined in tensorflow/contrib/gan/python/train.py.

Returns GAN model outputs and variables.

Args:

  • generator_fn: A python lambda that takes generator_inputs as inputs and returns the outputs of the GAN generator.
  • discriminator_fn: A python lambda that takes real_data/generated data and generator_inputs. Outputs a Tensor in the range [-inf, inf].
  • real_data: A Tensor representing the real data.
  • generator_inputs: A Tensor or list of Tensors to the generator. In the vanilla GAN case, this might be a single noise Tensor. In the conditional GAN case, this might be the generator's conditioning.
  • generator_scope: Optional generator variable scope. Useful if you want to reuse a subgraph that has already been created.
  • discriminator_scope: Optional discriminator variable scope. Useful if you want to reuse a subgraph that has already been created.
  • check_shapes: If True, check that generator produces Tensors that are the same shape as real data. Otherwise, skip this check.

Returns:

A GANModel namedtuple.

Raises:

  • ValueError: If the generator outputs a Tensor that isn't the same shape as real_data.

© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/contrib/gan/gan_model