code: def find_topk(a, k, axis=-1, largest=True, sorted=True):
      if axis is None:
          axis_size = a.size
      else:
          axis_size = a.shape[axis]
      assert 1 <= k <= axis_size
  
      a = np.asanyarray(a)
      if largest:
          index_array = np.argpartition(a, axis_size - k, axis=axis)
          topk_indices = np.take(
              index_array, -np.arange(k) - 1, axis=axis
          )
      else:
          index_array = np.argpartition(a, k - 1, axis=axis)
          topk_indices = np.take(index_array, np.arange(k), axis=axis)
      topk_values = np.take_along_axis(a, topk_indices, axis=axis)
      if sorted:
          sorted_indices_in_topk = np.argsort(topk_values, axis=axis)
          if largest:
              sorted_indices_in_topk = np.flip(
                  sorted_indices_in_topk, axis=axis
              )
          sorted_topk_values = np.take_along_axis(
              topk_values, sorted_indices_in_topk, axis=axis
          )
          sorted_topk_indices = np.take_along_axis(
              topk_indices, sorted_indices_in_topk, axis=axis
          )
          return sorted_topk_values, sorted_topk_indices
      return topk_values, topk_indices
  
imports: import os
  import re
  import cv2
  import gc
  import numpy
  import pandas
  from tqdm import tqdm
  import warnings
label_desc: Use image node_id 13 for calling a global function with example usage: find_topk(a, k, axis, largest, sorted) and returns: topk_values,  topk_indices, sorted_topk_values,  sorted_topk_indices