class_docstr: A tokenizer using externally precomputed tokenization.
class_docstr_tok: ["A","tokenizer","using","externally","precomputed","tokenization","."]
code: def __call__(
      self,
      mapped_triples: MappedTriples,
      num_tokens: int,
      num_entities: int,
      num_relations: int,
  ) -> Tuple[int, torch.LongTensor]:  # noqa: D102
      if num_entities != len(self.pool):
          raise ValueError(
              f"Invalid number of entities ({num_entities}); expected {len(self.pool)}"
          )
      if self.randomize_selection:
          assignment = random_sample_no_replacement(
              pool=self.pool,
              num_tokens=num_tokens,
              num_entities=num_entities,
          )
      else:
          # choose first num_tokens
          assignment = torch.full(
              size=(len(self.pool), num_tokens),
              dtype=torch.long,
              fill_value=-1,
          )
          # TODO: vectorization?
          for idx, this_pool in self.pool.items():
              this_pool_t = torch.as_tensor(
                  data=list(this_pool)[:num_tokens], dtype=torch.long
              )
              assignment[idx, : len(this_pool_t)] = this_pool_t
      return self.vocabulary_size, assignment
  
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 3 for calling the PrecomputedPoolTokenizer obj's underlying member method code with example usage: obj.__call__(mapped_triples, num_tokens, num_entities, num_relations) and returns: self,  assignment