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
The symbolic shapes for entity representations for tail entities, if different.
Methods Summary
func
(r, t, t_bias, input_channels, …)Evaluate the ConvE interaction function.
Attributes Documentation
-
tail_entity_shape
: Optional[Sequence[str]] = ('d', 'k')¶ The symbolic shapes for entity representations for tail entities, if different. This is ony relevant for ConvE.
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_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.
-