class_docstr: An anchor tokenizer, which first partitions the graph using METIS.
  
  We use the binding by :mod:`torch_sparse`. The METIS graph partitioning algorithm is described here:
  http://glaros.dtc.umn.edu/gkhome/metis/metis/overview
class_docstr_tok: ["An","anchor","tokenizer",",","which","first","partitions","the","graph","using","METIS",".","We","use","the","binding","by",":","mod",":","`","torch_sparse","`",".","The","METIS","graph","partitioning","algorithm","is","described","here",":","http",":","\/\/glaros.dtc.umn.edu\/gkhome\/metis\/metis\/overview"]
docstr: Initialize the tokenizer.
  
  :param num_partitions:
      the number of partitions obtained through Metis.
  :param device:
      the device to use for tokenization
  :param kwargs:
      additional keyword-based parameters passed to :meth:`AnchorTokenizer.__init__`. note that there will be one
      anchor tokenizer per partition, i.e., the vocabulary size will grow respectively.
docstr_tok: ["Initialize","the","tokenizer",".",":","param","num_partitions",":","the","number","of","partitions","obtained","through","Metis",".",":","param","device",":","the","device","to","use","for","tokenization",":","param","kwargs",":","additional","keyword-based","parameters","passed","to",":","meth",":","`","AnchorTokenizer.__init__","`",".","note","that","there","will","be","one","anchor","tokenizer","per","partition",",","i.e.",",","the","vocabulary","size","will","grow","respectively","."]
code: def __init__(
      self, num_partitions: int = 2, device: DeviceHint = None, **kwargs
  ):
      """Initialize the tokenizer.
  
      :param num_partitions:
          the number of partitions obtained through Metis.
      :param device:
          the device to use for tokenization
      :param kwargs:
          additional keyword-based parameters passed to :meth:`AnchorTokenizer.__init__`. note that there will be one
          anchor tokenizer per partition, i.e., the vocabulary size will grow respectively.
      """
      super().__init__(**kwargs)
      self.num_partitions = num_partitions
      self.device = resolve_device(device)
  
imports: import logging
  import pathlib
  from abc import abstractmethod
  from collections import defaultdict
  from typing import Collection, Mapping, Optional, Tuple
  import more_itertools
  import numpy
  import torch
  from class_resolver import ClassResolver, HintOrType, OptionalKwargs
  from .anchor_search import AnchorSearcher, anchor_searcher_resolver
  from .anchor_selection import AnchorSelection, anchor_selection_resolver
  from .loader import PrecomputedTokenizerLoader, precomputed_tokenizer_loader_resolver
  from .utils import prepare_edges_for_metis, random_sample_no_replacement
  from ...constants import PYKEEN_MODULE
  from ...typing import DeviceHint, MappedTriples
  from ...utils import format_relative_comparison, get_edge_index, resolve_device
label_desc: Use image node_id 1 to create a new MetisAnchorTokenizer object from inherited base classes: AnchorTokenizer with example: obj = MetisAnchorTokenizer(num_partitions, device)