triple_re_interaction

triple_re_interaction(h, r_head, r_mid, r_tail, t, u=None, p=2, power_norm=False)[source]

Evaluate the TripleRE interaction function.

See also

pykeen.nn.modules.TripleREInteraction for the stateful interaction module

Parameters
  • h (FloatTensor) – shape: (*batch_dims, rank, dim) The head representations.

  • r_head (FloatTensor) – shape: (*batch_dims, rank, dim) The relation-specific head multiplicator representations.

  • r_mid (FloatTensor) – shape: (*batch_dims, rank, dim) The relation representations.

  • r_tail (FloatTensor) – shape: (*batch_dims, rank, dim) The relation-specific tail multiplicator representations.

  • t (FloatTensor) – shape: (*batch_dims, rank, dim) The tail representations.

  • u (Optional[float]) – the relation factor offset. If u is not None or 0, this corresponds to TripleREv2.

  • p (int) – The p for the norm. cf. torch.linalg.vector_norm().

  • power_norm (bool) – Whether to return the powered norm.

Return type

FloatTensor

Returns

shape: batch_dims The scores.