code: def get_per_pair_loss(self, pair_dists, pos_or_neg):
      loss_calc_func = (
          self.pos_calc if pos_or_neg == "pos" else self.neg_calc
      )
      margin = (
          self.pos_margin if pos_or_neg == "pos" else self.neg_margin
      )
      per_pair_loss = loss_calc_func(pair_dists, margin)
      return per_pair_loss
  
file_path: pytorch-metric-learning/src/pytorch_metric_learning/losses/contrastive_loss.py
imports: import torch
  from ..reducers import AvgNonZeroReducer
  from ..utils import loss_and_miner_utils
  from .generic_pair_loss import GenericPairLoss
label_desc: Use image node_id 3 for calling the ContrastiveLoss obj's underlying member method code with example usage: obj.get_per_pair_loss(pair_dists, pos_or_neg) and returns: per_pair_loss