code: def ntn_interaction(
      h: torch.FloatTensor,
      t: torch.FloatTensor,
      w: torch.FloatTensor,
      vh: torch.FloatTensor,
      vt: torch.FloatTensor,
      b: torch.FloatTensor,
      u: torch.FloatTensor,
      activation: nn.Module,
  ) -> torch.FloatTensor:
      r"""Evaluate the NTN interaction function.
  
      .. math::
  
          f(h,r,t) = u_r^T act(h W_r t + V_r h + V_r' t + b_r)
  
      :param h: shape: (`*batch_dims`, dim)
          The head representations.
      :param w: shape: (`*batch_dims`, k, dim, dim)
          The relation specific transformation matrix W_r.
      :param vh: shape: (`*batch_dims`, k, dim)
          The head transformation matrix V_h.
      :param vt: shape: (`*batch_dims`, k, dim)
          The tail transformation matrix V_h.
      :param b: shape: (`*batch_dims`, k)
          The relation specific offset b_r.
      :param u: shape: (`*batch_dims`, k)
          The relation specific final linear transformation b_r.
      :param t: shape: (`*batch_dims`, dim)
          The tail representations.
      :param activation:
          The activation function.
  
      :return: shape: batch_dims
          The scores.
      """
      return (
          u
          * activation(
              tensor_sum(
                  einsum(
                      "...d,...kde,...e->...k", h, w, t
                  ),  # shape: (*batch_dims, k)
                  einsum("...d, ...kd->...k", h, vh),
                  einsum("...d, ...kd->...k", t, vt),
                  b,
              )
          )
      ).sum(dim=-1)
  
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 12 for calling a global function with example usage: ntn_interaction(h, t, w, vh, vt, b, u, activation) and returns: unknown