code: def iter_entity_mappings(
      *old_new_ids_pairs: Tuple[torch.LongTensor, torch.LongTensor],
      offsets: torch.LongTensor,
  ) -> Iterable[Mapping[int, int]]:
      """
      Create explicit Id mappings.
  
      :param old_new_ids_pairs:
          aligned pairs of old and new ids
      :param offsets: shape: (2,)
          the entity offsets
  
      :yields: explicit id remappings
      """
      old, new = [
          torch.cat(tensors, dim=0)
          for tensors in zip(*old_new_ids_pairs)
      ]
      offsets = offsets.tolist() + [old.max().item() + 1]
      for low, high in zip(offsets, offsets[1:]):
          mask = (low <= old) & (old < high)
          this_old = old[mask] - low
          this_new = new[mask]
          yield dict(zip(this_old.tolist(), this_new.tolist()))
  
imports: import logging
  from abc import ABC, abstractmethod
  from collections import defaultdict
  from typing import Any, ClassVar, DefaultDict, Dict, Iterable, Mapping, NamedTuple, Optional, Sequence, Set, Tuple, Union
  import numpy
  import pandas
  import torch
  from class_resolver import ClassResolver
  from pandas.api.types import is_numeric_dtype, is_string_dtype
  from ...triples import CoreTriplesFactory, TriplesFactory
  from ...typing import COLUMN_HEAD, COLUMN_TAIL, EA_SIDE_LEFT, EA_SIDE_RIGHT, EA_SIDES, MappedTriples, TargetColumn
  from ...utils import format_relative_comparison, get_connected_components
label_desc: Use image node_id 6 for calling a global function with example usage: iter_entity_mappings() without return types