pair_re_interaction
- pair_re_interaction(h, t, r_h, r_t, p=2, power_norm=True)[source]
Evaluate the PairRE interaction function.
\[-\|h \odot r_h - t \odot r_t \|\]- Parameters:
h (
FloatTensor
) – shape: (*batch_dims, dim) The head representations.t (
FloatTensor
) – shape: (*batch_dims, dim) The tail representations.r_h (
FloatTensor
) – shape: (*batch_dims, dim) The head part of the relation representations.r_t (
FloatTensor
) – shape: (*batch_dims, dim) The tail part of the relation representations.p (
Union
[int
,str
]) – The parameter p for selecting the norm.power_norm (
bool
) – Whether to return the powered norm instead.
- Return type:
FloatTensor
- Returns:
shape: batch_dims The scores.