TorusEInteraction

class TorusEInteraction(p=2, power_norm=False)[source]

Bases: NormBasedInteraction[FloatTensor, FloatTensor, FloatTensor]

A stateful module for the TorusE interaction function.

See also

pykeen.nn.functional.toruse_interaction()

Initialize the interaction module.

Parameters
  • p (int) – the \(p\) value of the norm to use, cf. NormBasedInteraction.__init__()

  • power_norm (bool) – whether to use the \(p\).

Methods Summary

func(r, t[, p, power_norm])

Evaluate the TorusE interaction function from [ebisu2018].

Methods Documentation

func(r, t, p=2, power_norm=False)

Evaluate the TorusE interaction function from [ebisu2018].

Note

This only implements the two L_p norm based variants.

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

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

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

  • p (Union[int, str]) – The p for the norm.

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

Return type

FloatTensor

Returns

shape: batch_dims The scores.