import tensorflow as tf

  def test_generator_grad_norm_progress(self):
    stable_stage_num_images = 2
    transition_stage_num_images = 3

    current_image_id_ph = tf.placeholder(tf.int32, [])
    progress = networks.compute_progress(
        current_image_id_ph,
        stable_stage_num_images,
        transition_stage_num_images,
        num_blocks=3)
    z = tf.random_normal([2, 10], dtype=tf.float32)
    x, _ = networks.generator(
        z, progress, _num_filters_stub,
        networks.ResolutionSchedule(
            start_resolutions=(4, 4), scale_base=2, num_resolutions=3))
    fake_loss = tf.reduce_sum(tf.square(x))
    grad_norms = [
        _get_grad_norm(
            fake_loss, tf.trainable_variables('.*/progressive_gan_block_1/.*')),
        _get_grad_norm(
            fake_loss, tf.trainable_variables('.*/progressive_gan_block_2/.*')),
        _get_grad_norm(
            fake_loss, tf.trainable_variables('.*/progressive_gan_block_3/.*'))
    ]

    grad_norms_output = None
    with self.test_session(use_gpu=True) as sess:
      sess.run(tf.global_variables_initializer())
      x1_np = sess.run(x, feed_dict={current_image_id_ph: 0.12})
      x2_np = sess.run(x, feed_dict={current_image_id_ph: 1.8})
