code: def precision_at_k(
      knn_labels,
      gt_labels,
      k,
      avg_of_avgs,
      return_per_class,
      label_comparison_fn,
  ):
      curr_knn_labels = knn_labels[:, :k]
      same_label = label_comparison_fn(gt_labels, curr_knn_labels)
      accuracy_per_sample = (
          torch.sum(same_label, dim=1).type(torch.float64) / k
      )
      return maybe_get_avg_of_avgs(
          accuracy_per_sample, gt_labels, avg_of_avgs, return_per_class
      )
  
imports: import torch
  from sklearn.metrics import adjusted_mutual_info_score, normalized_mutual_info_score
  from .None import common_functions
  from .inference import FaissKMeans, FaissKNN
label_desc: Use image node_id 7 for calling a global function with example usage: precision_at_k(knn_labels, gt_labels, k, avg_of_avgs, return_per_class, label_comparison_fn) and returns: maybe_get_avg_of_avgs