code: def simple_interaction(
      h: torch.FloatTensor,
      r: torch.FloatTensor,
      t: torch.FloatTensor,
      h_inv: torch.FloatTensor,
      r_inv: torch.FloatTensor,
      t_inv: torch.FloatTensor,
      clamp: Optional[Tuple[float, float]] = None,
  ) -> torch.FloatTensor:
      """Evaluate the SimplE interaction function.
  
      :param h: shape: (`*batch_dims`, dim)
          The head representations.
      :param r: shape: (`*batch_dims`, dim, dim)
          The relation representations.
      :param t: shape: (`*batch_dims`, dim)
          The tail representations.
      :param h_inv: shape: (`*batch_dims`, dim)
          The inverse head representations.
      :param r_inv: shape: (`*batch_dims`, dim, dim)
          The relation representations.
      :param t_inv: shape: (`*batch_dims`, dim)
          The tail representations.
      :param clamp:
          Clamp the scores to the given range.
  
      :return: shape: batch_dims
          The scores.
      """
      scores = 0.5 * (
          distmult_interaction(h=h, r=r, t=t)
          + distmult_interaction(h=h_inv, r=r_inv, t=t_inv)
      )
      # Note: In the code in their repository, the score is clamped to [-20, 20].
      #       That is not mentioned in the paper, so it is made optional here.
      if clamp:
          min_, max_ = clamp
          scores = scores.clamp(min=min_, max=max_)
      return scores
  
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 15 for calling a global function with example usage: simple_interaction(h, r, t, h_inv, r_inv, t_inv, clamp) and returns: scores