LiteralInteraction¶
- class LiteralInteraction(base, combination, base_kwargs=None)[source]¶
Bases:
pykeen.nn.modules.Interaction,Generic[pykeen.typing.HeadRepresentation,pykeen.typing.RelationRepresentation,pykeen.typing.TailRepresentation]The interaction function shared by literal-containing interactions.
Instantiate the module.
- Parameters
combination (
Combination) – The module used to concatenate the literals to the entity representationsbase (
Union[str,Interaction[~HeadRepresentation, ~RelationRepresentation, ~TailRepresentation],Type[Interaction[~HeadRepresentation, ~RelationRepresentation, ~TailRepresentation]],None]) – The interaction modulebase_kwargs (
Optional[Mapping[str,Any]]) – Keyword arguments for the interaction module
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_size, num_heads, 1, 1,
*) The head representations.r (~RelationRepresentation) – shape: (batch_size, 1, num_relations, 1,
*) The relation representations.t (~TailRepresentation) – shape: (batch_size, 1, 1, num_tails,
*) The tail representations.
- Return type
FloatTensor- Returns
shape: (batch_size, num_heads, num_relations, num_tails) The scores.