code: def _kl_gumbel_gumbel(a, b, name=None):
      """Calculate the batched KL divergence KL(a || b) with a and b Gumbel.
  
      Args:
        a: instance of a Gumbel distribution object.
        b: instance of a Gumbel distribution object.
        name: (optional) Name to use for created operations.
          default is 'kl_gumbel_gumbel'.
  
      Returns:
        Batchwise KL(a || b)
      """
      with tf.name_scope(name or "kl_gumbel_gumbel"):
          # Consistent with
          # http://www.mast.queensu.ca/~communications/Papers/gil-msc11.pdf, page 64
          # The paper uses beta to refer to scale and mu to refer to loc.
          # There is actually an error in the solution as printed; this is based on
          # the second-to-last step of the derivation. The value as printed would be
          # off by (a.loc - b.loc) / b.scale.
          a_loc = tf.convert_to_tensor(a.loc)
          b_loc = tf.convert_to_tensor(b.loc)
          a_scale = tf.convert_to_tensor(a.scale)
          b_scale = tf.convert_to_tensor(b.scale)
          return (
              tf.math.log(b_scale)
              - tf.math.log(a_scale)
              + np.euler_gamma * (a_scale / b_scale - 1.0)
              + tf.math.expm1(
                  (b_loc - a_loc) / b_scale
                  + tf.math.lgamma(a_scale / b_scale + 1.0)
              )
              + (a_loc - b_loc) / b_scale
          )
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import gumbel_cdf
  from tensorflow_probability.python.bijectors import identity
  from tensorflow_probability.python.bijectors import invert
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions import transformed_distribution
  from tensorflow_probability.python.distributions import uniform
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import tensor_util
label_desc: Use image node_id 1 for calling a global function with example usage: _kl_gumbel_gumbel(a, b, name) and returns: unknown