class_docstr: Orthogonal Relation Transforms with Graph Context Modeling for Knowledge Graph Embedding.
  https://aclanthology.org/2020.acl-main.241/
class_docstr_tok: ["Orthogonal","Relation","Transforms","with","Graph","Context","Modeling","for","Knowledge","Graph","Embedding",".","https",":","\/\/aclanthology.org\/2020.acl-main.241\/"]
code: def _get_neg_score(self, pos_e, pos_r, neg_e):
      chunk_size = pos_e.shape[1]
      neg_sample_size = neg_e.shape[1]
      embed_dim = pos_e.shape[-1]
  
      assert pos_e.shape[:-1] == pos_r.shape[:-1]
      pos_e = pos_e.reshape([-1, 1, self.num_elem])
      if self.use_scale:
          pos_r = pos_r.reshape([-1, self.num_elem, self.num_elem + 1])
          scale = self.get_scale(pos_r[:, :, self.num_elem :])
          scale = scale / scale.norm(axis=-1, p=2, keepdim=True)
          scale_r = pos_r[:, :, : self.num_elem] * scale
          output = paddle.bmm(pos_e, scale_r)
      else:
          pos_r = pos_r.reshape([-1, self.num_elem, self.num_elem])
          output = paddle.bmm(pos_e, pos_r)
  
      output = output.reshape([-1, chunk_size, 1, embed_dim])
      neg_e = neg_e.reshape([-1, 1, neg_sample_size, embed_dim])
  
      score = self._get_score(output, neg_e)
      return score
  
imports: import math
  import numpy
  from numpy.random import RandomState
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle.nn.functional import log_sigmoid
label_desc: Use image node_id 8 for calling the OTEScore obj's underlying member method code with example usage: obj._get_neg_score(pos_e, pos_r, neg_e) and returns: score