code: def _kl_pareto_pareto(a, b, name=None):
      """Calculate the batched KL divergence KL(a || b) with a and b Pareto.
  
      Args:
        a: instance of a Pareto distribution object.
        b: instance of a Pareto distribution object.
        name: (optional) Name to use for created operations.
          default is 'kl_pareto_pareto'.
  
      Returns:
        Batchwise KL(a || b)
      """
      with tf.name_scope(name or "kl_pareto_pareto"):
          # Consistent with
          # http://www.mast.queensu.ca/~communications/Papers/gil-msc11.pdf, page 55
          # Terminology is different from source to source for Pareto distributions.
          # The 'concentration' parameter corresponds to 'a' in that source, and the
          # 'scale' parameter corresponds to 'm'.
          a_scale = tf.convert_to_tensor(a.scale)
          b_scale = tf.convert_to_tensor(b.scale)
          a_concentration = tf.convert_to_tensor(a.concentration)
          b_concentration = tf.convert_to_tensor(b.concentration)
          return tf.where(
              a_scale >= b_scale,
              (
                  b_concentration
                  * (tf.math.log(a_scale) - tf.math.log(b_scale))
                  + tf.math.log(a_concentration)
                  - tf.math.log(b_concentration)
                  + b_concentration / a_concentration
                  - 1.0
              ),
              dtype_util.as_numpy_dtype(a.dtype)(np.inf),
          )
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import chain
  from tensorflow_probability.python.bijectors import shift
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.util.deferred_tensor import DeferredTensor
label_desc: Use image node_id 1 for calling a global function with example usage: _kl_pareto_pareto(a, b, name) and returns: tf