ComplExInteraction

class ComplExInteraction[source]

Bases: FunctionalInteraction[FloatTensor, FloatTensor, FloatTensor]

A module wrapper for the stateless ComplEx interaction function.

Initializes internal Module state, shared by both nn.Module and ScriptModule.

Methods Summary

func(r, t)

Evaluate the ComplEx interaction function.

Methods Documentation

func(r, t)

Evaluate the ComplEx interaction function.

\[Re(\langle h, r, conj(t) \rangle)\]

Note

this method expects all tensors to be of complex datatype, i.e., torch.is_complex(x) to evaluate to True.

Parameters
  • h (FloatTensor) – shape: (*batch_dims, dim) The complex head representations.

  • r (FloatTensor) – shape: (*batch_dims, dim) The complex relation representations.

  • t (FloatTensor) – shape: (*batch_dims, dim) The complex tail representations.

Return type

FloatTensor

Returns

shape: batch_dims The scores.