transd_interaction¶
-
transd_interaction
(h, r, t, h_p, r_p, t_p, p, power_norm=False)[source]¶ Evaluate the TransD interaction function.
- Parameters
h (
FloatTensor
) – shape: (batch_size, num_heads, 1, 1, d_e) The head representations.r (
FloatTensor
) – shape: (batch_size, 1, num_relations, 1, d_r) The relation representations.t (
FloatTensor
) – shape: (batch_size, 1, 1, num_tails, d_e) The tail representations.h_p (
FloatTensor
) – shape: (batch_size, num_heads, 1, 1, d_e) The head projections.r_p (
FloatTensor
) – shape: (batch_size, 1, num_relations, 1, d_r) The relation projections.t_p (
FloatTensor
) – shape: (batch_size, 1, 1, num_tails, d_e) The tail projections.p (
int
) – The parameter p for selecting the norm.power_norm (
bool
) – Whether to return the powered norm instead.
- Return type
FloatTensor
- Returns
shape: (batch_size, num_heads, num_relations, num_tails) The scores.