code: def cross_entropy(ref, other, allow_nan_stats=True, name=None):
      """Computes the (Shannon) cross entropy.
  
      Denote two distributions by `P` (`ref`) and `Q` (`other`). Assuming `P, Q`
      are absolutely continuous with respect to one another and permit densities
      `p(x) dr(x)` and `q(x) dr(x)`, (Shanon) cross entropy is defined as:
  
      ```none
      H[P, Q] = E_p[-log q(X)] = -int_F p(x) log q(x) dr(x)
      ```
  
      where `F` denotes the support of the random variable `X ~ P`.
  
      Args:
        ref: `tfd.Distribution` instance.
        other: `tfd.Distribution` instance.
        allow_nan_stats: Python `bool`, default `True`. When `True`,
          statistics (e.g., mean, mode, variance) use the value "`NaN`" to
          indicate the result is undefined. When `False`, an exception is raised
          if one or more of the statistic's batch members are undefined.
        name: Python `str` prepended to names of ops created by this function.
  
      Returns:
        cross_entropy: `ref.dtype` `Tensor` with shape `[B1, ..., Bn]`
          representing `n` different calculations of (Shanon) cross entropy.
      """
      with ops.name_scope(name, "cross_entropy"):
          return ref.entropy() + kl_divergence(
              ref, other, allow_nan_stats=allow_nan_stats
          )
  
file_path: tensorflow/tensorflow/python/ops/distributions/kullback_leibler.py
imports: from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_assert
  from tensorflow.python.ops import math_ops
  from tensorflow.python.util import deprecation
  from tensorflow.python.util import tf_inspect
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 3 for calling a global function with example usage: cross_entropy(ref, other, allow_nan_stats, name) and returns: unknown