(sess, gan)
return result_dict["metric_tensor"]["log_condition_number"]
Computes the generator condition number.

  Computes the Jacobian of the generator in session, then postprocesses to get
  the condition number.

  Args:
    sess: tf.Session object.
    gan: AbstractGAN object, that is already present in the current tf.Graph.

  Returns:
    A list of length gan.batch_size. Each element is the condition number
    computed at a single z sample within a minibatch.
Computes the generator condition number.
Computes the generator condition number .
def compute_generator_condition_number(sess, gan):
  """Computes the generator condition number.

  Computes the Jacobian of the generator in session, then postprocesses to get
  the condition number.

  Args:
    sess: tf.Session object.
    gan: AbstractGAN object, that is already present in the current tf.Graph.

  Returns:
    A list of length gan.batch_size. Each element is the condition number
    computed at a single z sample within a minibatch.
  """
  shape = gan.fake_images.get_shape().as_list()
  flat_generator_output = tf.reshape(
      gan.fake_images, [gan.batch_size, np.prod(shape[1:])])
  tf_jacobian = compute_jacobian(
      xs=gan.z, fx=flat_generator_output)
  z_sample = gan.z_generator(gan.batch_size, gan.z_dim)
  np_jacobian = sess.run(tf_jacobian, feed_dict={gan.z: z_sample})
  result_dict = analyze_jacobian(np_jacobian)
  return result_dict["metric_tensor"]["log_condition_number"]
def compute_generator_condition_number ( sess , gan ) : shape = gan . fake_images . get_shape ( ) . as_list ( ) flat_generator_output = tf . reshape ( gan . fake_images , [ gan . batch_size , np . prod ( shape [ 1 : ] ) ] ) tf_jacobian = compute_jacobian ( xs = gan . z , fx = flat_generator_output ) z_sample = gan . z_generator ( gan . batch_size , gan . z_dim ) np_jacobian = sess . run ( tf_jacobian , feed_dict = { gan . z : z_sample } ) result_dict = analyze_jacobian ( np_jacobian ) return result_dict [ "metric_tensor" ] [ "log_condition_number" ]