FunctionalInteraction

class FunctionalInteraction(*args, **kwargs)[source]

Bases: Interaction, Generic[HeadRepresentation, RelationRepresentation, TailRepresentation]

Base class for interaction functions.

Initialize internal Module state, shared by both nn.Module and ScriptModule.

Methods Summary

forward(h, r, t)

Compute broadcasted triple scores given broadcasted representations for head, relation and tails.

Methods Documentation

forward(h, r, t)[source]

Compute broadcasted triple scores given broadcasted representations for head, relation and tails.

Parameters:
  • h (~HeadRepresentation) – shape: (*batch_dims, *dims) The head representations.

  • r (~RelationRepresentation) – shape: (*batch_dims, *dims) The relation representations.

  • t (~TailRepresentation) – shape: (*batch_dims, *dims) The tail representations.

Return type:

FloatTensor

Returns:

shape: batch_dims The scores.