(self, z, y, is_training)
return out
Build the generator network for the given inputs.

    Args:
      z: `Tensor` of shape [batch_size, z_dim] with latent code.
      y: `Tensor` of shape [batch_size, num_classes] of one hot encoded labels.
      is_training: boolean, are we in train or eval model.

    Returns:
      A tensor of size [batch_size] + self._image_shape with values in [0, 1].
Build the generator network for the given inputs.
Build the generator network for the given inputs .
def apply(self, z, y, is_training):
    """Build the generator network for the given inputs.

    Args:
      z: `Tensor` of shape [batch_size, z_dim] with latent code.
      y: `Tensor` of shape [batch_size, num_classes] of one hot encoded labels.
      is_training: boolean, are we in train or eval model.

    Returns:
      A tensor of size [batch_size] + self._image_shape with values in [0, 1].
    """
    batch_size = z.shape[0].value
    s_h, s_w, colors = self._image_shape
    s_h2, s_w2 = conv_out_size_same(s_h, 2), conv_out_size_same(s_w, 2)
    s_h4, s_w4 = conv_out_size_same(s_h2, 2), conv_out_size_same(s_w2, 2)
    s_h8, s_w8 = conv_out_size_same(s_h4, 2), conv_out_size_same(s_w4, 2)

    net = linear(z, s_h8 * s_w8 * 512, scope="g_fc1")
    net = self.batch_norm(net, z=z, y=y, is_training=is_training, name="g_bn1")
    net = tf.nn.relu(net)
    net = tf.reshape(net, [batch_size, s_h8, s_w8, 512])
    net = deconv2d(net, [batch_size, s_h4, s_w4, 256], 4, 4, 2, 2, name="g_dc2")
    net = self.batch_norm(net, z=z, y=y, is_training=is_training, name="g_bn2")
    net = tf.nn.relu(net)
    net = deconv2d(net, [batch_size, s_h2, s_w2, 128], 4, 4, 2, 2, name="g_dc3")
    net = self.batch_norm(net, z=z, y=y, is_training=is_training, name="g_bn3")
    net = tf.nn.relu(net)
    net = deconv2d(net, [batch_size, s_h, s_w, 64], 4, 4, 2, 2, name="g_dc4")
    net = self.batch_norm(net, z=z, y=y, is_training=is_training, name="g_bn4")
    net = tf.nn.relu(net)
    net = deconv2d(
        net, [batch_size, s_h, s_w, colors], 3, 3, 1, 1, name="g_dc5")
    out = tf.tanh(net)

    # This normalization from [-1, 1] to [0, 1] is introduced for consistency
    # with other models.
    out = tf.div(out + 1.0, 2.0)
    return out
def apply ( self , z , y , is_training ) : batch_size = z . shape [ 0 ] . value s_h , s_w , colors = self . _image_shape s_h2 , s_w2 = conv_out_size_same ( s_h , 2 ) , conv_out_size_same ( s_w , 2 ) s_h4 , s_w4 = conv_out_size_same ( s_h2 , 2 ) , conv_out_size_same ( s_w2 , 2 ) s_h8 , s_w8 = conv_out_size_same ( s_h4 , 2 ) , conv_out_size_same ( s_w4 , 2 ) net = linear ( z , s_h8 * s_w8 * 512 , scope = "g_fc1" ) net = self . batch_norm ( net , z = z , y = y , is_training = is_training , name = "g_bn1" ) net = tf . nn . relu ( net ) net = tf . reshape ( net , [ batch_size , s_h8 , s_w8 , 512 ] ) net = deconv2d ( net , [ batch_size , s_h4 , s_w4 , 256 ] , 4 , 4 , 2 , 2 , name = "g_dc2" ) net = self . batch_norm ( net , z = z , y = y , is_training = is_training , name = "g_bn2" ) net = tf . nn . relu ( net ) net = deconv2d ( net , [ batch_size , s_h2 , s_w2 , 128 ] , 4 , 4 , 2 , 2 , name = "g_dc3" ) net = self . batch_norm ( net , z = z , y = y , is_training = is_training , name = "g_bn3" ) net = tf . nn . relu ( net ) net = deconv2d ( net , [ batch_size , s_h , s_w , 64 ] , 4 , 4 , 2 , 2 , name = "g_dc4" ) net = self . batch_norm ( net , z = z , y = y , is_training = is_training , name = "g_bn4" ) net = tf . nn . relu ( net ) net = deconv2d ( net , [ batch_size , s_h , s_w , colors ] , 3 , 3 , 1 , 1 , name = "g_dc5" ) out = tf . tanh ( net ) # This normalization from [-1, 1] to [0, 1] is introduced for consistency # with other models. out = tf . div ( out + 1.0 , 2.0 ) return out