ProjEInteraction¶
-
class
ProjEInteraction
(embedding_dim=50, inner_non_linearity=None)[source]¶ Bases:
pykeen.nn.modules.FunctionalInteraction
[torch.FloatTensor
,torch.FloatTensor
,torch.FloatTensor
]A stateful module for the ProjE interaction function.
Initializes internal Module state, shared by both nn.Module and ScriptModule.
Methods Summary
func
(r, t, d_e, d_r, b_c, b_p, activation)Evaluate the ProjE interaction function.
Reset parameters the interaction function may have.
Methods Documentation
-
func
(r, t, d_e, d_r, b_c, b_p, activation)¶ Evaluate the ProjE interaction function.
\[f(h, r, t) = g(t z(D_e h + D_r r + b_c) + b_p)\]- 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.d_e (
FloatTensor
) – shape: (dim,) Global entity projection.d_r (
FloatTensor
) – shape: (dim,) Global relation projection.b_c (
FloatTensor
) – shape: (dim,) Global combination bias.b_p (
FloatTensor
) – shape: (1,) Final score biasactivation (
Module
) – The activation function.
- Return type
FloatTensor
- Returns
shape: (batch_size, num_heads, num_relations, num_tails) The scores.
-