code: def get_lone_query_labels(
      query_labels,
      label_counts,
      ref_includes_query,
      label_comparison_fn,
  ):
      unique_labels, match_counts = label_counts
      if ref_includes_query:
          label_matches_itself = label_comparison_fn(
              unique_labels, unique_labels
          )
          lone_condition = (
              match_counts - label_matches_itself.type(torch.long) <= 0
          )
      else:
          lone_condition = match_counts == 0
      lone_query_labels = unique_labels[lone_condition]
      if len(lone_query_labels) > 0:
          comparison = query_labels[:, None] == lone_query_labels
          not_lone_query_mask = ~torch.any(
              c_f.torch_all_from_dim_to_end(comparison, 2), dim=1
          )
      else:
          not_lone_query_mask = torch.ones(
              query_labels.shape[0],
              dtype=torch.bool,
              device=query_labels.device,
          )
      return lone_query_labels, not_lone_query_mask
  
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 9 for calling a global function with example usage: get_lone_query_labels(query_labels, label_counts, ref_includes_query, label_comparison_fn) and returns: lone_query_labels,  not_lone_query_mask