class_docstr: Abstract Knowledge Graph embedding model class.
  
  Module to define basic operations in KG embedding models, including embedding
  initialization, computing embeddings and triples' scores.
class_docstr_tok: ["Abstract","Knowledge","Graph","embedding","model","class",".","Module","to","define","basic","operations","in","KG","embedding","models",",","including","embedding","initialization",",","computing","embeddings","and","triples","'","scores","."]
docstr: Computes triples' scores as well as scores againts all possible entities.
  
  Args:
    input_tensor: Tensor of size batch_size x 3 containing triples' indices.
  
  Returns:
    scores: Numpy array of size batch_size x n_entities containing queries'
            scores against all possible entities in the KG.
    targets: Numpy array of size batch_size x 1 containing triples' scores.
docstr_tok: ["Computes","triples","'","scores","as","well","as","scores","againts","all","possible","entities",".","Args",":","input_tensor",":","Tensor","of","size","batch_size","x","3","containing","triples","'","indices",".","Returns",":","scores",":","Numpy","array","of","size","batch_size","x","n_entities","containing","queries'","scores","against","all","possible","entities","in","the","KG",".","targets",":","Numpy","array","of","size","batch_size","x","1","containing","triples","'","scores","."]
code: def get_scores_targets(self, input_tensor):
      """Computes triples' scores as well as scores againts all possible entities.
  
      Args:
        input_tensor: Tensor of size batch_size x 3 containing triples' indices.
  
      Returns:
        scores: Numpy array of size batch_size x n_entities containing queries'
                scores against all possible entities in the KG.
        targets: Numpy array of size batch_size x 1 containing triples' scores.
      """
      cand = self.get_candidates()
      cand_biases = self.bt.embeddings
      lhs = self.get_queries(input_tensor)
      lhs_biases = self.bh(input_tensor[:, 0])
      rhs = self.get_rhs(input_tensor)
      rhs_biases = self.bt(input_tensor[:, 2])
      scores = self.score(
          lhs, lhs_biases, cand, cand_biases, eval_mode=True
      )
      targets = self.score(
          lhs, lhs_biases, rhs, rhs_biases, eval_mode=False
      )
      return scores.numpy(), targets.numpy()
  
file_path: neural-structured-learning/research/kg_hyp_emb/models/base.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  from kg_hyp_emb.learning import regularizers
  import numpy
  import tensorflow
label_desc: Use image node_id 8 for calling the KGModel obj's underlying member method code with example usage: obj.get_scores_targets(input_tensor) and returns: scores,  targets