RESCALInteraction
- class RESCALInteraction(*args: Any, **kwargs: Any)[source]
Bases:
Interaction[Tensor,Tensor,Tensor]The state-less RESCAL interaction function.
For head and tail entity representations \(\mathbf{h}, \mathbf{t} \in \mathbb{R}^d\) and relation representation \(\mathbf{R} \in \mathbb{R}^{d \times d}\), the interaction function is given as
\[\mathbf{h}^T \mathbf{R} \mathbf{t} = \sum_{i=1}^{d} \sum_{j=1}^{d} \mathbf{h}_i \mathbf{R}_{i, j} \mathbf{t}_{i}\]Thus, the relation matrices \(\mathbf{R}\) contain weights \(\mathbf{R}_{i, j}\) that capture the amount of interaction between the \(i\)-th latent factor of the head representation and the \(j\)-th latent factor.
The computational complexity is given by \(\mathcal{O}(d^2)\).
Initialize internal Module state, shared by both nn.Module and ScriptModule.
Attributes Summary
The symbolic shapes for relation representations
Methods Summary
forward(h, r, t)Evaluate the interaction function.
Attributes Documentation
Methods Documentation