code: def _get_anchor_positive_triplet_mask(labels):
      # Check that i and j are distinct
      indices_equal = torch.eye(
          labels.size(0), dtype=torch.bool, device=labels.device
      )
      indices_not_equal = ~indices_equal
  
      # Check if labels[i] == labels[j]
      labels_equal = labels.unsqueeze(0) == labels.unsqueeze(1)
  
      return labels_equal & indices_not_equal
  
file_path: vision/references/similarity/loss.py
imports: import torch
  import torch.nn
label_desc: Use image node_id 4 for calling a global function with example usage: _get_anchor_positive_triplet_mask(labels) and returns: unknown