code: def kullback_leibler_similarity(
      h: GaussianDistribution,
      r: GaussianDistribution,
      t: GaussianDistribution,
      exact: bool = True,
  ) -> torch.FloatTensor:
      r"""Compute the negative KL divergence.
  
      This is done between two Gaussian distributions given by mean `mu_*` and diagonal covariance matrix `sigma_*`.
  
      .. math::
  
          D((\mu_0, \Sigma_0), (\mu_1, \Sigma_1)) = 0.5 * (
            tr(\Sigma_1^-1 \Sigma_0)
            + (\mu_1 - \mu_0) * \Sigma_1^-1 (\mu_1 - \mu_0)
            - k
            + ln (det(\Sigma_1) / det(\Sigma_0))
          )
  
      with :math:`\mu_e = \mu_h - \mu_t` and :math:`\Sigma_e = \Sigma_h + \Sigma_t`.
  
      .. note ::
          This methods assumes diagonal covariance matrices :math:`\Sigma`.
  
      .. seealso ::
          https://en.wikipedia.org/wiki/Multivariate_normal_distribution#Kullback%E2%80%93Leibler_divergence
  
      :param h: shape: (batch_size, num_heads, 1, 1, d)
          The head entity Gaussian distribution.
      :param r: shape: (batch_size, 1, num_relations, 1, d)
          The relation Gaussian distribution.
      :param t: shape: (batch_size, 1, 1, num_tails, d)
          The tail entity Gaussian distribution.
      :param exact:
          Whether to return the exact similarity, or leave out constant offsets.
  
      :return: torch.Tensor, shape: (s_1, ..., s_k)
          The similarity.
      """
      assert all((d.diagonal_covariance > 0).all() for d in (h, r, t))
      return -_vectorized_kl_divergence(
          h=h,
          r=r,
          t=t,
          exact=exact,
      )
  
file_path: pykeen/src/pykeen/nn/sim.py
imports: import itertools
  import math
  import torch
  from .compute_kernel import batched_dot
  from ..typing import GaussianDistribution
  from ..utils import at_least_eps, calculate_broadcasted_elementwise_result_shape, tensor_sum
label_desc: Use image node_id 2 for calling a global function with example usage: kullback_leibler_similarity(h, r, t, exact) and returns: unknown