linea_re_interaction
- linea_re_interaction(h, r_head, r_mid, r_tail, t, p=2, power_norm=False)[source]
Evaluate the LineaRE interaction function.
Note
the interaction is equivalent to TripleRE interaction without the u term.
- Parameters:
h (
FloatTensor
) – shape: (*batch_dims, rank, dim) The head representations.r_head (
FloatTensor
) – shape: (*batch_dims, rank, dim) The relation-specific head multiplicator representations.r_mid (
FloatTensor
) – shape: (*batch_dims, rank, dim) The relation representations.r_tail (
FloatTensor
) – shape: (*batch_dims, rank, dim) The relation-specific tail multiplicator representations.t (
FloatTensor
) – shape: (*batch_dims, rank, dim) The tail representations.p (
int
) – The p for the norm. cf.negative_norm_of_sum()
.power_norm (
bool
) – Whether to return the powered norm. cf.negative_norm_of_sum()
.
- Return type:
FloatTensor
- Returns:
shape: batch_dims The scores.