code: def build_knns(feats, k, knn_method, dump=True):
      with Timer("build index"):
          if knn_method == "faiss":
              index = knn_faiss(feats, k, omp_num_threads=None)
          elif knn_method == "faiss_gpu":
              index = knn_faiss_gpu(feats, k)
          else:
              raise KeyError(
                  "Only support faiss and faiss_gpu currently ({}).".format(
                      knn_method
                  )
              )
          knns = index.get_knns()
      return knns
  
file_path: dgl/examples/pytorch/hilander/utils/knn.py
imports: import math
  import multiprocessing
  import os
  import numpy
  from tqdm import tqdm
  from utils import Timer
  from .faiss_search import faiss_search_knn
label_desc: Use image node_id 3 for calling a global function with example usage: build_knns(feats, k, knn_method, dump) and returns: knns