code: def __call__(self, query, k, reference, ref_includes_query=False):
      if ref_includes_query:
          k = k + 1
      get_largest = self.distance.is_inverted
      if isinstance(self.distance, BatchedDistance):
          device = query.device
          distances = torch.zeros(len(query), k, device=device)
          indices = torch.zeros(
              len(query), k, device=device, dtype=torch.long
          )
          self.distance.iter_fn = get_topk(
              distances, indices, k, get_largest
          )
          self.distance(query, reference)
      else:
          mat = self.distance(query, reference)
          distances, indices = torch.topk(
              mat, k, largest=get_largest, dim=1
          )
      return return_results(distances, indices, ref_includes_query)
  
imports: import numpy
  import torch
  from ..distances import BatchedDistance, CosineSimilarity
  from .None import common_functions
label_desc: Use image node_id 2 for calling the CustomKNN obj's underlying member method code with example usage: obj.__call__(query, k, reference, ref_includes_query) and returns: return_results