TF 2.0 is out! Get hands-on practice at TF World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

tf.contrib.gan.features.condition_tensor_from_onehot

View source on GitHub

Condition a tensor based on a one-hot tensor.

tf.contrib.gan.features.condition_tensor_from_onehot(
    tensor,
    one_hot_labels,
    embedding_size=256
)

Conditioning scheme based on https://arxiv.org/abs/1609.03499.

Args:

  • tensor: Tensor to be conditioned.
  • one_hot_labels: A Tensor of one-hot labels. Shape is [batch_size, num_classes].
  • embedding_size: The size of the class embedding.

Returns:

tensor conditioned on one_hot_labels.

Raises:

  • ValueError: one_hot_labels isn't 2D, if non-batch dimensions aren't fully defined, or if batch sizes don't match.