tucker_interaction(h, r, t, core_tensor, do_h, do_r, do_hr, bn_h, bn_hr)[source]

Evaluate the TuckEr interaction function.

Compute scoring function W x_1 h x_2 r x_3 t as in the official implementation, i.e. as

\[DO_{hr}(BN_{hr}(DO_h(BN_h(h)) x_1 DO_r(W x_2 r))) x_3 t\]

where BN denotes BatchNorm and DO denotes Dropout

  • 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_e, d_r, d_e) The core tensor.

  • do_h (Dropout) – The dropout layer for the head representations.

  • do_r (Dropout) – The first hidden dropout.

  • do_hr (Dropout) – The second hidden dropout.

  • bn_h (Optional[BatchNorm1d]) – The first batch normalization layer.

  • bn_hr (Optional[BatchNorm1d]) – The second batch normalization layer.

Return type:



shape: batch_dims The scores.