code: def get_matches_and_diffs(labels, ref_labels=None):
      if ref_labels is None:
          ref_labels = labels
      labels1 = labels.unsqueeze(1)
      labels2 = ref_labels.unsqueeze(0)
      matches = (labels1 == labels2).byte()
      diffs = matches ^ 1
      if ref_labels is labels:
          matches.fill_diagonal_(0)
      return matches, diffs
  
imports: import math
  import numpy
  import torch
  from .None import common_functions
label_desc: Use image node_id 3 for calling a global function with example usage: get_matches_and_diffs(labels, ref_labels) and returns: matches,  diffs