code: def log_prob_ratio(p, x, q, y, name=None, **kwargs):
      """Computes `p.log_prob(x) - q.log_prob(y)`, numerically stably.
  
      Args:
        p: A distribution instance.
        x: A tensor from the support of `p`.
        q: A distribution instance in the same family as `p`, with matching shape.
        y: A tensor from the support of `q`.
        name: Optional name for ops in this scope.
        **kwargs: Passed to the distribution's `log_prob_ratio` implementation.
  
      Returns:
        lp_ratio: `log (p(x) / q(y)) = p.log_prob(x) - q.log_prob(y)`. In some cases
          this will be computed with better than naive numerical precision, e.g. by
          moving the difference inside of a sum reduction.
      """
      assert type(p) == type(q) or _is_composite_tensor_equivalent(
          type(p), type(q)
      )  # pylint: disable=unidiomatic-typecheck
      for cls in inspect.getmro(type(p)):
          if cls in _log_prob_ratio_registry:
              return _log_prob_ratio_registry[cls](
                  p, x, q, y, name=name, **kwargs
              )
      with tf.name_scope(name or "log_prob_ratio"):
          return p.unnormalized_log_prob(x) - q.unnormalized_log_prob(y)
  
file_path: probability/tensorflow_probability/python/distributions/log_prob_ratio.py
imports: import inspect
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import distribution
label_desc: Use image node_id 2 for calling a global function with example usage: log_prob_ratio(p, x, q, y, name) and returns: unknown, _log_prob_ratio_registry