class_docstr: An abstract base class for implementing custom KGE models.
  
  Args:
      num_nodes (int): The number of nodes/entities in the graph.
      num_relations (int): The number of relations in the graph.
      hidden_channels (int): The hidden embedding size.
      sparse (bool, optional): If set to :obj:`True`, gradients w.r.t. to the
          embedding matrices will be sparse. (default: :obj:`False`)
docstr: Evaluates the model quality by computing Mean Rank, MRR and
  Hits@:math:`k` across all possible tail entities.
  
  Args:
      head_index (torch.Tensor): The head indices.
      rel_type (torch.Tensor): The relation type.
      tail_index (torch.Tensor): The tail indices.
      batch_size (int): The batch size to use for evaluating.
      k (int, optional): The :math:`k` in Hits @ :math:`k`.
          (default: :obj:`10`)
      log (bool, optional): If set to :obj:`False`, will not print a
          progress bar to the console. (default: :obj:`True`)
docstr_tok: ["Evaluates","the","model","quality","by","computing","Mean","Rank",",","MRR","and","Hits","@",":","math",":","`","k","`","across","all","possible","tail","entities",".","Args",":","head_index","(","torch.Tensor",")",":","The","head","indices",".","rel_type","(","torch.Tensor",")",":","The","relation","type",".","tail_index","(","torch.Tensor",")",":","The","tail","indices",".","batch_size","(","int",")",":","The","batch","size","to","use","for","evaluating",".","k","(","int",",","optional",")",":","The",":","math",":","`","k","`","in","Hits","@",":","math",":","`","k","`",".","(","default",":",":","obj",":","`","10","`",")","log","(","bool",",","optional",")",":","If","set","to",":","obj",":","`","False","`",",","will","not","print","a","progress","bar","to","the","console",".","(","default",":",":","obj",":","`","True","`",")"]
code: def test(
      self,
      head_index: Tensor,
      rel_type: Tensor,
      tail_index: Tensor,
      batch_size: int,
      k: int = 10,
      log: bool = True,
  ) -> Tuple[float, float, float]:
      r"""Evaluates the model quality by computing Mean Rank, MRR and
      Hits@:math:`k` across all possible tail entities.
  
      Args:
          head_index (torch.Tensor): The head indices.
          rel_type (torch.Tensor): The relation type.
          tail_index (torch.Tensor): The tail indices.
          batch_size (int): The batch size to use for evaluating.
          k (int, optional): The :math:`k` in Hits @ :math:`k`.
              (default: :obj:`10`)
          log (bool, optional): If set to :obj:`False`, will not print a
              progress bar to the console. (default: :obj:`True`)
      """
      arange = range(head_index.numel())
      arange = tqdm(arange) if log else arange
  
      mean_ranks, reciprocal_ranks, hits_at_k = [], [], []
      for i in arange:
          h, r, t = head_index[i], rel_type[i], tail_index[i]
  
          scores = []
          tail_indices = torch.arange(self.num_nodes, device=t.device)
          for ts in tail_indices.split(batch_size):
              scores.append(self(h.expand_as(ts), r.expand_as(ts), ts))
          rank = int(
              (torch.cat(scores).argsort(descending=True) == t)
              .nonzero()
              .view(-1)
          )
          mean_ranks.append(rank)
          reciprocal_ranks.append(1 / (rank + 1))
          hits_at_k.append(rank < k)
  
      mean_rank = float(
          torch.tensor(mean_ranks, dtype=torch.float).mean()
      )
      mrr = float(
          torch.tensor(reciprocal_ranks, dtype=torch.float).mean()
      )
      hits_at_k = int(torch.tensor(hits_at_k).sum()) / len(hits_at_k)
  
      return mean_rank, mrr, hits_at_k
  
file_path: pytorch_geometric/torch_geometric/nn/kge/base.py
imports: from typing import Tuple
  import torch
  from torch import Tensor
  from torch.nn import Embedding
  from tqdm import tqdm
  from torch_geometric.nn.kge.loader import KGTripletLoader
label_desc: Use image node_id 6 for calling the KGEModel obj's underlying member method code with example usage: obj.test(head_index, rel_type, tail_index, batch_size, k, log) and returns: mean_rank,  mrr,  hits_at_k