code: def kg2e_interaction(
      h_mean: torch.FloatTensor,
      h_var: torch.FloatTensor,
      r_mean: torch.FloatTensor,
      r_var: torch.FloatTensor,
      t_mean: torch.FloatTensor,
      t_var: torch.FloatTensor,
      similarity: str = "KL",
      exact: bool = True,
  ) -> torch.FloatTensor:
      """Evaluate the KG2E interaction function.
  
      :param h_mean: shape: (`*batch_dims`, d)
          The head entity distribution mean.
      :param h_var: shape: (`*batch_dims`, d)
          The head entity distribution variance.
      :param r_mean: shape: (`*batch_dims`, d)
          The relation distribution mean.
      :param r_var: shape: (`*batch_dims`, d)
          The relation distribution variance.
      :param t_mean: shape: (`*batch_dims`, d)
          The tail entity distribution mean.
      :param t_var: shape: (`*batch_dims`, d)
          The tail entity distribution variance.
      :param similarity:
          The similarity measures for gaussian distributions. From {"KL", "EL"}.
      :param exact:
          Whether to leave out constants to accelerate similarity computation.
  
      :return: shape: batch_dims
          The scores.
      """
      return KG2E_SIMILARITIES[similarity](
          h=GaussianDistribution(
              mean=h_mean, diagonal_covariance=h_var
          ),
          r=GaussianDistribution(
              mean=r_mean, diagonal_covariance=r_var
          ),
          t=GaussianDistribution(
              mean=t_mean, diagonal_covariance=t_var
          ),
          exact=exact,
      )
  
imports: from __future__ import annotations
  import functools
  from typing import Optional, Tuple, Union
  import numpy
  import torch
  from torch import broadcast_tensors, nn
  from .compute_kernel import batched_dot
  from .sim import KG2E_SIMILARITIES
  from ..typing import GaussianDistribution
  from ..utils import clamp_norm, einsum, is_cudnn_error, make_ones_like, negative_norm, negative_norm_of_sum, project_entity, tensor_product, tensor_sum
label_desc: Use image node_id 11 for calling a global function with example usage: kg2e_interaction(h_mean, h_var, r_mean, r_var, t_mean, t_var, similarity, exact) and returns: KG2E_SIMILARITIES