MultiLinearTuckerInteraction
- class MultiLinearTuckerInteraction(head_dim=64, relation_dim=None, tail_dim=None)[source]
Bases:
FunctionalInteraction
[Tuple
[FloatTensor
,FloatTensor
],FloatTensor
,Tuple
[FloatTensor
,FloatTensor
]]An implementation of the original (multi-linear) TuckER interaction as described [tucker1966].
Note
For small tensors, there are more efficient algorithms to compute the decomposition, e.g., http://tensorly.org/stable/modules/generated/tensorly.decomposition.Tucker.html
Initialize the Tucker interaction function.
- Parameters
Attributes Summary
The symbolic shapes for entity representations
The symbolic shapes for relation representations
Methods Summary
func
(r, t, core_tensor)Evaluate the (original) multi-linear TuckEr interaction function.
Reset parameters the interaction function may have.
Attributes Documentation
Methods Documentation
- func(r, t, core_tensor)
Evaluate the (original) multi-linear TuckEr interaction function.
\[score(h, r, t) = \sum W_{ijk} h_i r_j t_k\]- Parameters
h (
FloatTensor
) – shape: (*batch_dims, d_e) The head representations.r (
FloatTensor
) – shape: (*batch_dims, d_r) The relation representations.t (
FloatTensor
) – shape: (*batch_dims, d_e) The tail representations.core_tensor (
FloatTensor
) – shape: (d_h, d_r, d_t) The core tensor.
- Return type
FloatTensor
- Returns
shape: batch_dims The scores.