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_size, num_heads, 1, 1, dim) The head representations.r (
FloatTensor
) – shape: (batch_size, 1, num_relations, 1, dim) The relation representations.t (
FloatTensor
) – shape: (batch_size, 1, 1, num_tails, dim) The tail representations.t_bias (
FloatTensor
) – shape: (batch_size, 1, 1, num_tails, 1) 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_size, num_heads, num_relations, num_tails) The scores.