class_docstr: A base module for KGE models.
  
  Subclasses of :class:`Model` can decide however they want on how to store entities' and
  relations' representations, how they want to be looked up, and how they should
  be scored. The :class:`OModel` provides a commonly used interface for models storing entity
  and relation representations in the form of :class:`pykeen.nn.Embedding`.
class_docstr_tok: ["A","base","module","for","KGE","models",".","Subclasses","of",":","class",":","`","Model","`","can","decide","however","they","want","on","how","to","store","entities","'","and","relations","'","representations",",","how","they","want","to","be","looked","up",",","and","how","they","should","be","scored",".","The",":","class",":","`","OModel","`","provides","a","commonly","used","interface","for","models","storing","entity","and","relation","representations","in","the","form","of",":","class",":","`","pykeen.nn.Embedding","`","."]
docstr: Forward pass using middle (relation) prediction for obtaining scores of all possible relations.
  
  This method calculates the score for all possible relations for each (head, tail) pair.
  
  Additionally, the model is set to evaluation mode.
  
  :param ht_batch: shape: (batch_size, 2), dtype: long
      The indices of (head, tail) pairs.
  :param kwargs:
      additional keyword-based parameters passed to :meth:`Model.score_r`
  
  :return: shape: (batch_size, num_relations), dtype: float
      For each h-t pair, the scores for all possible relations.
docstr_tok: ["Forward","pass","using","middle","(","relation",")","prediction","for","obtaining","scores","of","all","possible","relations",".","This","method","calculates","the","score","for","all","possible","relations","for","each","(","head",",","tail",")","pair",".","Additionally",",","the","model","is","set","to","evaluation","mode",".",":","param","ht_batch",":","shape",":","(","batch_size",",","2",")",",","dtype",":","long","The","indices","of","(","head",",","tail",")","pairs",".",":","param","kwargs",":","additional","keyword-based","parameters","passed","to",":","meth",":","`","Model.score_r","`",":","return",":","shape",":","(","batch_size",",","num_relations",")",",","dtype",":","float","For","each","h-t","pair",",","the","scores","for","all","possible","relations","."]
code: def predict_r(
      self,
      ht_batch: torch.LongTensor,
      **kwargs,
  ) -> torch.FloatTensor:
      """Forward pass using middle (relation) prediction for obtaining scores of all possible relations.
  
      This method calculates the score for all possible relations for each (head, tail) pair.
  
      Additionally, the model is set to evaluation mode.
  
      :param ht_batch: shape: (batch_size, 2), dtype: long
          The indices of (head, tail) pairs.
      :param kwargs:
          additional keyword-based parameters passed to :meth:`Model.score_r`
  
      :return: shape: (batch_size, num_relations), dtype: float
          For each h-t pair, the scores for all possible relations.
      """
      self.eval()  # Enforce evaluation mode
      ht_batch = ht_batch.to(self.device)
      scores = self.score_r(ht_batch, **kwargs)
      if self.predict_with_sigmoid:
          scores = torch.sigmoid(scores)
      return scores
  
imports: from __future__ import annotations
  import inspect
  import logging
  import os
  import pickle
  from abc import ABC, abstractmethod
  from typing import Any, ClassVar, Iterable, Mapping, Optional, Type, Union
  import torch
  from class_resolver import HintOrType
  from docdata import parse_docdata
  from torch import nn
  from ..inverse import RelationInverter, relation_inverter_resolver
  from ..losses import Loss, MarginRankingLoss, loss_resolver
  from ..triples import KGInfo
  from ..typing import LABEL_HEAD, LABEL_RELATION, LABEL_TAIL, InductiveMode, MappedTriples, Target
  from ..utils import NoRandomSeedNecessary, get_preferred_device, set_random_seed
label_desc: Use image node_id 25 for calling the Model obj's underlying member method code with example usage: obj.predict_r(ht_batch) and returns: scores