code: def transh_interaction(
      h: torch.FloatTensor,
      w_r: torch.FloatTensor,
      d_r: torch.FloatTensor,
      t: torch.FloatTensor,
      p: int,
      power_norm: bool = False,
  ) -> torch.FloatTensor:
      """Evaluate the DistMult interaction function.
  
      :param h: shape: (`*batch_dims`, dim)
          The head representations.
      :param w_r: shape: (`*batch_dims`, dim)
          The relation normal vector representations.
      :param d_r: shape: (`*batch_dims`, dim)
          The relation difference vector representations.
      :param t: shape: (`*batch_dims`, dim)
          The tail representations.
      :param p:
          The p for the norm. cf. :func:`torch.linalg.vector_norm`.
      :param power_norm:
          Whether to return $|x-y|_p^p$.
  
      :return: shape: batch_dims
          The scores.
      """
      return negative_norm_of_sum(
          # h projection to hyperplane
          h,
          -einsum("...i, ...i, ...j -> ...j", h, w_r, w_r),
          # r
          d_r,
          # -t projection to hyperplane
          -t,
          einsum("...i, ...i, ...j -> ...j", t, w_r, w_r),
          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 21 for calling a global function with example usage: transh_interaction(h, w_r, d_r, t, p, power_norm) and returns: negative_norm_of_sum