KG2EInteraction
- class KG2EInteraction(similarity=None, exact=True)[source]
Bases:
pykeen.nn.modules.FunctionalInteraction
[Tuple
[torch.FloatTensor
,torch.FloatTensor
],Tuple
[torch.FloatTensor
,torch.FloatTensor
],Tuple
[torch.FloatTensor
,torch.FloatTensor
]]A stateful module for the KG2E interaction function.
Initializes 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
func
(h_var, r_mean, r_var, t_mean, t_var[, ...])Evaluate the KG2E interaction function.
Attributes Documentation
Methods Documentation
- func(h_var, r_mean, r_var, t_mean, t_var, similarity='KL', exact=True)
Evaluate the KG2E interaction function.
- Parameters
h_mean (
FloatTensor
) – shape: (*batch_dims, d) The head entity distribution mean.h_var (
FloatTensor
) – shape: (*batch_dims, d) The head entity distribution variance.r_mean (
FloatTensor
) – shape: (*batch_dims, d) The relation distribution mean.r_var (
FloatTensor
) – shape: (*batch_dims, d) The relation distribution variance.t_mean (
FloatTensor
) – shape: (*batch_dims, d) The tail entity distribution mean.t_var (
FloatTensor
) – shape: (*batch_dims, d) The tail entity distribution variance.similarity (
str
) – The similarity measures for gaussian distributions. From {“KL”, “EL”}.exact (
bool
) – Whether to leave out constants to accelerate similarity computation.
- Return type
FloatTensor
- Returns
shape: batch_dims The scores.