class_docstr: TransR model.
docstr: Construct test program
code: def construct_test_program(self):
      """
      Construct test program
      """
      (
          entity_embedding,
          relation_embedding,
          transfer_matrix,
      ) = self.creat_share_variables()
      rel_matrix = fluid.layers.reshape(
          lookup_table(self.test_input[1], transfer_matrix),
          [self._hidden_size, self._hidden_size],
      )
      entity_embedding_trans = fluid.layers.matmul(
          entity_embedding, rel_matrix, False, False
      )
      rel_vec = lookup_table(self.test_input[1], relation_embedding)
      entity_embedding_trans = fluid.layers.l2_normalize(
          entity_embedding_trans, axis=-1
      )
      rel_vec = fluid.layers.l2_normalize(rel_vec, axis=-1)
      head_vec = lookup_table(
          self.test_input[0], entity_embedding_trans
      )
      tail_vec = lookup_table(
          self.test_input[2], entity_embedding_trans
      )
  
      # The paddle fluid.layers.topk GPU OP is very inefficient
      # we do sort operation in the evaluation step using multiprocessing
      id_replace_head = fluid.layers.reduce_sum(
          fluid.layers.abs(entity_embedding_trans + rel_vec - tail_vec),
          dim=1,
      )
      id_replace_tail = fluid.layers.reduce_sum(
          fluid.layers.abs(entity_embedding_trans - rel_vec - head_vec),
          dim=1,
      )
  
      return [id_replace_head, id_replace_tail]
  
file_path: PGL/legacy/examples/pgl-ke/model/TransR.py
imports: import numpy
  import paddle.fluid
  from .Model import Model
  from .utils import lookup_table
label_desc: Use image node_id 6 for calling the TransR obj's underlying member method code with example usage: obj.construct_test_program() and returns: list