ProjEInteraction
- class ProjEInteraction(embedding_dim=50, inner_non_linearity=None)[source]
Bases:
FunctionalInteraction
[FloatTensor
,FloatTensor
,FloatTensor
]A stateful module for the ProjE interaction function.
Initialize the interaction module.
- Parameters
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_dims, dim) The head representations.r (
FloatTensor
) – shape: (*batch_dims, dim) The relation representations.t (
FloatTensor
) – shape: (*batch_dims, 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: scalar Final score biasactivation (
Module
) – The activation function.
- Return type
FloatTensor
- Returns
shape: batch_dims The scores.