mure_interaction
- mure_interaction(h: Tensor, b_h: Tensor, r_vec: Tensor, r_mat: Tensor, t: Tensor, b_t: Tensor, p: int | float | str = 2, power_norm: bool = False) Tensor [source]
Evaluate the MuRE interaction function from [balazevic2019b].
\[-\|Rh + r - t\| + b_h + b_t\]- Parameters:
h (Tensor) – shape: (*batch_dims, dim) The head representations.
b_h (Tensor) – shape: batch_dims The head entity bias.
r_vec (Tensor) – shape: (*batch_dims, dim) The relation vector.
r_mat (Tensor) – shape: (*batch_dims, dim,) The diagonal relation matrix.
t (Tensor) – shape: (*batch_dims, dim) The tail representations.
b_t (Tensor) – shape: batch_dims The tail entity bias.
p (int | float | str) – The parameter p for selecting the norm, cf.
torch.linalg.vector_norm()
.power_norm (bool) – Whether to return the powered norm instead.
- Returns:
shape: batch_dims The scores.
- Return type: