示例#1
0
def generator_fn_specgram(inputs, **kwargs):
  """Builds generator network."""
  # inputs = (noises, one_hot_labels)
  with tf.variable_scope('generator_cond'):
    z = tf.concat(inputs, axis=1)
  if kwargs['to_rgb_activation'] == 'tanh':
    to_rgb_activation = tf.tanh
  elif kwargs['to_rgb_activation'] == 'linear':
    to_rgb_activation = lambda x: x
  fake_images, end_points = networks.generator(
      z,
      kwargs['progress'],
      lambda block_id: _num_filters_fn(block_id, **kwargs),
      kwargs['resolution_schedule'],
      num_blocks=kwargs['num_blocks'],
      kernel_size=kwargs['kernel_size'],
      colors=2,
      to_rgb_activation=to_rgb_activation,
      simple_arch=kwargs['simple_arch'])
  shape = fake_images.shape
  normalizer = data_normalizer.registry[kwargs['data_normalizer']](kwargs)
  fake_images = normalizer.denormalize_op(fake_images)
  fake_images.set_shape(shape)
  return fake_images, end_points
示例#2
0
def generator_fn_specgram(inputs, **kwargs):
    """Builds generator network."""
    # inputs = (noises, one_hot_labels)
    with tf.variable_scope('generator_cond'):
        z = tf.concat(inputs, axis=1)
    if kwargs['to_rgb_activation'] == 'tanh':
        to_rgb_activation = tf.tanh
    elif kwargs['to_rgb_activation'] == 'linear':
        to_rgb_activation = lambda x: x
    fake_images, end_points = networks.generator(
        z,
        kwargs['progress'],
        lambda block_id: _num_filters_fn(block_id, **kwargs),
        kwargs['resolution_schedule'],
        num_blocks=kwargs['num_blocks'],
        kernel_size=kwargs['kernel_size'],
        colors=2,
        to_rgb_activation=to_rgb_activation,
        simple_arch=kwargs['simple_arch'])
    shape = fake_images.shape
    normalizer = data_normalizer.registry[kwargs['data_normalizer']](kwargs)
    fake_images = normalizer.denormalize_op(fake_images)
    fake_images.set_shape(shape)
    return fake_images, end_points