ConvKBInteraction¶
-
class
ConvKBInteraction
(hidden_dropout_rate=0.0, embedding_dim=200, num_filters=400)[source]¶ Bases:
pykeen.nn.modules.FunctionalInteraction
[torch.FloatTensor
,torch.FloatTensor
,torch.FloatTensor
]A stateful module for the ConvKB interaction function.
See also
pykeen.nn.functional.convkb_interaction`()
Initializes internal Module state, shared by both nn.Module and ScriptModule.
Methods Summary
func
(r, t, conv, activation, hidden_dropout, …)Evaluate the ConvKB interaction function.
Reset parameters the interaction function may have.
Methods Documentation
-
func
(r, t, conv, activation, hidden_dropout, linear)¶ Evaluate the ConvKB interaction function.
\[W_L drop(act(W_C \ast ([h; r; t]) + b_C)) + b_L\]- 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.conv (
Conv2d
) – The 3x1 convolution.activation (
Module
) – The activation function.hidden_dropout (
Dropout
) – The dropout layer applied to the hidden activations.linear (
Linear
) – The final linear layer.
- Return type
FloatTensor
- Returns
shape: (batch_size, num_heads, num_relations, num_tails) The scores.
-