class_docstr: Select closest anchors as the nodes with the largest personalized page rank.
  
  .. seealso::
      http://web.stanford.edu/class/cs224w/slides/04-pagerank.pdf
class_docstr_tok: ["Select","closest","anchors","as","the","nodes","with","the","largest","personalized","page","rank",".","..","seealso",":",":","http",":","\/\/web.stanford.edu\/class\/cs224w\/slides\/04-pagerank.pdf"]
code: def __call__(
      self,
      edge_index: numpy.ndarray,
      anchors: numpy.ndarray,
      k: int,
      num_entities: Optional[int] = None,
  ) -> numpy.ndarray:  # noqa: D102
      num_entities = ensure_num_entities(
          edge_index, num_entities=num_entities
      )
      result = numpy.full(shape=(num_entities, k), fill_value=-1)
      i = 0
      for batch_ppr in self._iter_ppr(
          edge_index=edge_index,
          anchors=anchors,
          num_entities=num_entities,
      ):
          batch_size = batch_ppr.shape[0]
          # select k anchors with largest ppr, shape: (batch_size, k)
          result[i : i + batch_size, :] = (
              torch.topk(batch_ppr, k=k, dim=-1, largest=True)
              .indices.cpu()
              .numpy()
          )
          i += batch_size
      return result
  
imports: import logging
  from abc import ABC, abstractmethod
  from typing import Iterable, Optional
  import numpy
  import scipy.sparse
  import torch
  from class_resolver import ClassResolver, OptionalKwargs
  from torch_ppr import page_rank
  from torch_ppr.utils import edge_index_to_sparse_matrix, prepare_page_rank_adjacency, prepare_x0
  from tqdm.auto import tqdm
  from .utils import ensure_num_entities
  from ...typing import DeviceHint
  from ...utils import ExtraReprMixin, format_relative_comparison, resolve_device
label_desc: Use image node_id 4 for calling the PersonalizedPageRankAnchorSearcher obj's underlying member method code with example usage: obj.__call__(edge_index, anchors, k, num_entities) and returns: result