CPInteraction
- class CPInteraction(*args, **kwargs)[source]
Bases:
Interaction
[Tensor
,Tensor
,Tensor
]The Canonical Tensor Decomposition interaction as described [lacroix2018] (originally from [hitchcock1927]).
The interaction function is given as
\[\sum_{1 \leq i \leq k, 1 \leq j \leq d} \mathbf{h}_{i, j} \cdot \mathbf{r}_{i, j} \cdot \mathbf{t}_{i, j}\]Note
For \(k=1\), this interaction is the same as
DistMultInteraction
. However, in contrast toDistMult
, entities should have different representations for the head and the tail role.Initialize internal Module state, shared by both nn.Module and ScriptModule.
Attributes Summary
The symbolic shapes for entity representations
The symbolic shapes for relation representations
Methods Summary
forward
(h, r, t)Evaluate the interaction function.
Attributes Documentation
Methods Documentation