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: Score triples based on inverse triples, i.e., compute $f(h,r,t)$ based on $f(t,r_{inv},h)$.
  
  When training with inverse relations, the model produces two (different) scores for a triple $(h,r,t) \in K$.
  The forward score is calculated from $f(h,r,t)$ and the inverse score is calculated from $f(t,r_{inv},h)$.
  This function enables users to inspect the scores obtained by using the corresponding inverse triples.
  
  :param hrt_batch: shape: (b, 3)
      the batch of triples
  :param mode:
      the inductive mode, or None for transductive
  
  :return:
      the triple scores obtained by inverse relations
docstr_tok: ["Score","triples","based","on","inverse","triples",",","i.e.",",","compute","$","f","(","h",",","r",",","t",")","$","based","on","$","f","(","t",",","r_","{","inv","}",",","h",")","$",".","When","training","with","inverse","relations",",","the","model","produces","two","(","different",")","scores","for","a","triple","$","(","h",",","r",",","t",")","\\in","K","$",".","The","forward","score","is","calculated","from","$","f","(","h",",","r",",","t",")","$","and","the","inverse","score","is","calculated","from","$","f","(","t",",","r_","{","inv","}",",","h",")","$",".","This","function","enables","users","to","inspect","the","scores","obtained","by","using","the","corresponding","inverse","triples",".",":","param","hrt_batch",":","shape",":","(","b",",","3",")","the","batch","of","triples",":","param","mode",":","the","inductive","mode",",","or","None","for","transductive",":","return",":","the","triple","scores","obtained","by","inverse","relations"]
code: def score_hrt_inverse(
      self,
      hrt_batch: torch.LongTensor,
      *,
      mode: Optional[InductiveMode] = None,
  ) -> torch.FloatTensor:
      r"""
      Score triples based on inverse triples, i.e., compute $f(h,r,t)$ based on $f(t,r_{inv},h)$.
  
      When training with inverse relations, the model produces two (different) scores for a triple $(h,r,t) \in K$.
      The forward score is calculated from $f(h,r,t)$ and the inverse score is calculated from $f(t,r_{inv},h)$.
      This function enables users to inspect the scores obtained by using the corresponding inverse triples.
  
      :param hrt_batch: shape: (b, 3)
          the batch of triples
      :param mode:
          the inductive mode, or None for transductive
  
      :return:
          the triple scores obtained by inverse relations
      """
      t_r_inv_h = self._prepare_inverse_batch(
          batch=hrt_batch, index_relation=1
      )
      return self.score_hrt(hrt_batch=t_r_inv_h, mode=mode)
  
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 28 for calling the Model obj's underlying member method code with example usage: obj.score_hrt_inverse(hrt_batch) and returns: self