code: def linea_re_interaction(
      # head
      h: torch.FloatTensor,
      # relation
      r_head: torch.FloatTensor,
      r_mid: torch.FloatTensor,
      r_tail: torch.FloatTensor,
      # tail
      t: torch.FloatTensor,
      # extension: negative (power) norm
      p: int = 2,
      power_norm: bool = False,
  ) -> torch.FloatTensor:
      """Evaluate the LineaRE interaction function.
  
      .. note ::
          the interaction is equivalent to TripleRE interaction without the `u` term.
  
      :param h: shape: (`*batch_dims`, rank, dim)
          The head representations.
      :param r_head: shape: (`*batch_dims`, rank, dim)
          The relation-specific head multiplicator representations.
      :param r_mid: shape: (`*batch_dims`, rank, dim)
          The relation representations.
      :param r_tail: shape: (`*batch_dims`, rank, dim)
          The relation-specific tail multiplicator representations.
      :param t: shape: (`*batch_dims`, rank, dim)
          The tail representations.
      :param p:
          The p for the norm. cf. :func:`negative_norm_of_sum`.
      :param power_norm:
          Whether to return the powered norm. cf. :func:`negative_norm_of_sum`.
  
      :return: shape: batch_dims
          The scores.
      """
      return triple_re_interaction(
          h=h,
          r_head=r_head,
          r_mid=r_mid,
          r_tail=r_tail,
          t=t,
          u=None,
          p=p,
          power_norm=power_norm,
      )
  
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 33 for calling a global function with example usage: linea_re_interaction(h, r_head, r_mid, r_tail, t, p, power_norm) and returns: triple_re_interaction