ConvEInteraction

class ConvEInteraction(input_channels=None, output_channels=32, embedding_height=None, embedding_width=None, kernel_height=3, kernel_width=3, input_dropout=0.2, output_dropout=0.3, feature_map_dropout=0.2, embedding_dim=200, apply_batch_normalization=True)[source]

Bases: pykeen.nn.modules.FunctionalInteraction[torch.FloatTensor, torch.FloatTensor, Tuple[torch.FloatTensor, torch.FloatTensor]]

A stateful module for the ConvE interaction function.

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

Attributes Summary

tail_entity_shape

Methods Summary

func(r, t, t_bias, input_channels, ...)

Evaluate the ConvE interaction function.

Attributes Documentation

tail_entity_shape = ('d', '')

Methods Documentation

func(r, t, t_bias, input_channels, embedding_height, embedding_width, hr2d, hr1d)

Evaluate the ConvE interaction function.

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.

  • t_bias (FloatTensor) – shape: (*batch_dims) The tail entity bias.

  • input_channels (int) – The number of input channels.

  • embedding_height (int) – The height of the reshaped embedding.

  • embedding_width (int) – The width of the reshaped embedding.

  • hr2d (Module) – The first module, transforming the 2D stacked head-relation “image”.

  • hr1d (Module) – The second module, transforming the 1D flattened output of the 2D module.

Return type

FloatTensor

Returns

shape: batch_dims The scores.