class_docstr: A method for finding the closest anchors.
class_docstr_tok: ["A","method","for","finding","the","closest","anchors","."]
docstr: Find the $k$ closest anchor nodes for each entity.
  
  :param edge_index: shape: (2, m)
      the edge index
  :param anchors: shape: (a,)
      the selected anchor entity Ids
  :param k:
      the number of closest anchors to return
  :param num_entities:
      the number of entities
  
  :return: shape: (n, k), -1 <= res < a
      the Ids of the closest anchors
docstr_tok: ["Find","the","$","k","$","closest","anchor","nodes","for","each","entity",".",":","param","edge_index",":","shape",":","(","2",",","m",")","the","edge","index",":","param","anchors",":","shape",":","(","a",",",")","the","selected","anchor","entity","Ids",":","param","k",":","the","number","of","closest","anchors","to","return",":","param","num_entities",":","the","number","of","entities",":","return",":","shape",":","(","n",",","k",")",",","-1","<","=","res","<","a","the","Ids","of","the","closest","anchors"]
code: def __call__(
      self,
      edge_index: numpy.ndarray,
      anchors: numpy.ndarray,
      k: int,
      num_entities: Optional[int] = None,
  ) -> numpy.ndarray:
      """
      Find the $k$ closest anchor nodes for each entity.
  
      :param edge_index: shape: (2, m)
          the edge index
      :param anchors: shape: (a,)
          the selected anchor entity Ids
      :param k:
          the number of closest anchors to return
      :param num_entities:
          the number of entities
  
      :return: shape: (n, k), -1 <= res < a
          the Ids of the closest anchors
      """
      raise NotImplementedError
  
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 1 for calling the AnchorSearcher obj's underlying member method code with example usage: obj.__call__(edge_index, anchors, k, num_entities) without return types