conve_interaction

conve_interaction(h, r, t, t_bias, input_channels, embedding_height, embedding_width, hr2d, hr1d)[source]

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.