transr_interaction
- transr_interaction(h, r, t, m_r, p, power_norm=True)[source]
Evaluate the TransR interaction function.
- Parameters
h (
FloatTensor
) – shape: (batch_size, num_heads, 1, 1, d_e) Head embeddings.r (
FloatTensor
) – shape: (batch_size, 1, num_relations, 1, d_r) Relation embeddings.m_r (
FloatTensor
) – shape: (batch_size, 1, num_relations, 1, d_e, d_r) The relation specific linear transformations.t (
FloatTensor
) – shape: (batch_size, 1, 1, num_tails, d_e) Tail embeddings.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.