proje_interaction

proje_interaction(h, r, t, d_e, d_r, b_c, b_p, activation)[source]

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 bias

  • activation (Module) – The activation function.

Return type

FloatTensor

Returns

shape: (batch_size, num_heads, num_relations, num_tails) The scores.