code: def ermlp_interaction(
      h: torch.FloatTensor,
      r: torch.FloatTensor,
      t: torch.FloatTensor,
      hidden: nn.Linear,
      activation: nn.Module,
      final: nn.Linear,
  ) -> torch.FloatTensor:
      r"""Evaluate the ER-MLP interaction function.
  
      :param h: shape: (`*batch_dims`, dim)
          The head representations.
      :param r: shape: (`*batch_dims`, dim)
          The relation representations.
      :param t: shape: (`*batch_dims`, dim)
          The tail representations.
      :param hidden:
          The first linear layer.
      :param activation:
          The activation function of the hidden layer.
      :param final:
          The second linear layer.
  
      :return: shape: batch_dims
          The scores.
      """
      # shortcut for same shape
      if h.shape == r.shape and h.shape == t.shape:
          x = hidden(torch.cat([h, r, t], dim=-1))
      else:
          # split weight into head-/relation-/tail-specific sub-matrices
          *prefix, dim = h.shape
          x = tensor_sum(
              hidden.bias.view(*make_ones_like(prefix), -1),
              *(
                  einsum("...i, ji -> ...j", xx, weight)
                  for xx, weight in zip(
                      [h, r, t],
                      hidden.weight.split(split_size=dim, dim=-1),
                  )
              ),
          )
      return final(activation(x)).squeeze(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 7 for calling a global function with example usage: ermlp_interaction(h, r, t, hidden, activation, final) and returns: final