code: def kl_div(x, y, out=None, where=None, **kwargs):
      r"""
      Elementwise function for computing relative entropy.
  
      .. math::
  
          \mathrm{rel\_entr}(x, y) =
              \begin{cases}
                  x \log(x / y) & x > 0, y > 0 \\
                  0 & x = 0, y \ge 0 \\
                  \infty & \text{otherwise}
              \end{cases}
  
      Parameters
      ----------
      x, y : array_like
          Input arrays
      out : ndarray, optional
          Optional output array for the function results
  
      Returns
      -------
      scalar or ndarray
          Relative entropy of the inputs
  
      See Also
      --------
      entr, kl_div
  
      Notes
      -----
      This function is jointly convex in x and y.
  
      The origin of this function is in convex programming; see
      [1]_. Given two discrete probability distributions :math:`p_1,
      \ldots, p_n` and :math:`q_1, \ldots, q_n`, to get the relative
      entropy of statistics compute the sum
  
      .. math::
  
          \sum_{i = 1}^n \mathrm{rel\_entr}(p_i, q_i).
  
      See [2]_ for details.
  
      References
      ----------
      .. [1] Grant, Boyd, and Ye, "CVX: Matlab Software for Disciplined Convex
          Programming", http://cvxr.com/cvx/
      .. [2] Kullback-Leibler divergence,
          https://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_divergence
      """
      op = TensorKlDiv(**kwargs)
      return op(x, y, out=out, where=where)
  
file_path: mars/mars/tensor/special/info_theory.py
imports: import scipy.special
  from ..arithmetic.utils import arithmetic_operand
  from ..utils import infer_dtype, implement_scipy
  from .core import TensorSpecialUnaryOp, TensorSpecialBinOp, _register_special_op
label_desc: Use image node_id 3 for calling a global function with example usage: kl_div(x, y, out, where) and returns: op