class_docstr: Compute contrastive loss between positive pairs and mine negative pairs which are not in the intersection of the two point clouds (taken from https://github.com/chrischoy/FCGF)
  Let :math:`(f_i, f^{+}_i)_{i=1 \dots N}` set of positive_pairs and :math:`(f_i, f^{-}_i)_{i=1 \dots M}` a set of negative pairs
  The loss is computed as:
  .. math::
      L = \frac{1}{N^2} \sum_{i=1}^N \sum_{j=1}^N [d^{+}_{ij} - \lambda_+]_+ + \frac{1}{M} \sum_{i=1}^M [\lambda_{-} - d^{-}_i]_+
  
  where:
  .. math::
      d^{+}_{ij} = ||f_{i} - f^{+}_{j}||
  
  and
  .. math::
      d^{-}_{i} = \min_{j}(||f_{i} - f^{-}_{j}||)
  
  In this loss, we only mine the negatives
  Parameters
  ----------
  
  pos_thresh:
      positive threshold of the positive distance
  neg_thresh:
      negative threshold of the negative distance
  num_pos:
      number of positive pairs
  num_hn_samples:
      number of negative point we mine.
class_docstr_tok: ["Compute","contrastive","loss","between","positive","pairs","and","mine","negative","pairs","which","are","not","in","the","intersection","of","the","two","point","clouds","(","taken","from","https",":","\/\/github.com\/chrischoy\/FCGF",")","Let",":","math",":","`","(","f_i",",","f^","{","+","}","_i",")","_","{","i=1","\\dots","N","}","`","set","of","positive_pairs","and",":","math",":","`","(","f_i",",","f^","{","-","}","_i",")","_","{","i=1","\\dots","M","}","`","a","set","of","negative","pairs","The","loss","is","computed","as",":","..","math",":",":","L","=","\\frac","{","1","}","{","N^2","}","\\sum_","{","i=1","}","^N","\\sum_","{","j=1","}","^N","[","d^","{","+","}","_","{","ij","}","-","\\lambda_+","]","_+","+","\\frac","{","1","}","{","M","}","\\sum_","{","i=1","}","^M","[","\\lambda_","{","-","}","-","d^","{","-","}","_i","]","_+","where",":","..","math",":",":","d^","{","+","}","_","{","ij","}","=","||f_","{","i","}","-","f^","{","+","}","_","{","j","}","||","and","..","math",":",":","d^","{","-","}","_","{","i","}","=","\\min_","{","j","}","(","||f_","{","i","}","-","f^","{","-","}","_","{","j","}","||",")","In","this","loss",",","we","only","mine","the","negatives","Parameters","--","--","--","--","--","pos_thresh",":","positive","threshold","of","the","positive","distance","neg_thresh",":","negative","threshold","of","the","negative","distance","num_pos",":","number","of","positive","pairs","num_hn_samples",":","number","of","negative","point","we","mine","."]
code: def __init__(
      self, pos_thresh, neg_thresh, num_pos=5192, num_hn_samples=2048
  ):
      nn.Module.__init__(self)
      self.pos_thresh = pos_thresh
      self.neg_thresh = neg_thresh
      self.num_pos = num_pos
      self.num_hn_samples = num_hn_samples
  
file_path: torch-points3d/torch_points3d/core/losses/metric_losses.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  import numpy
label_desc: Use image node_id 1 to create a new ContrastiveHardestNegativeLoss object from inherited base classes: nn with example: obj = ContrastiveHardestNegativeLoss(pos_thresh, neg_thresh, num_pos, num_hn_samples)