class_docstr: Loss function with dynamical margin parameter introduced in https://openaccess.thecvf.com/content_ICCV_2019/papers/Zhang_Learning_Local_Descriptors_With_a_CDF-Based_Dynamic_Soft_Margin_ICCV_2019_paper.pdf
  
  Args:
      min_val: minimum significative value for `d_pos - d_neg`
      num_bins: number of equally spaced bins for the partition of the interval [min_val, :math:`+\infty`]
      momentum: weight assigned to the histogram computed from the current batch
class_docstr_tok: ["Loss","function","with","dynamical","margin","parameter","introduced","in","https",":","\/\/openaccess.thecvf.com\/content_ICCV_2019\/papers\/Zhang_Learning_Local_Descriptors_With_a_CDF-Based_Dynamic_Soft_Margin_ICCV_2019_paper.pdf","Args",":","min_val",":","minimum","significative","value","for","`","d_pos","-","d_neg","`","num_bins",":","number","of","equally","spaced","bins","for","the","partition","of","the","interval","[","min_val",",",":","math",":","`","+\\infty","`","]","momentum",":","weight","assigned","to","the","histogram","computed","from","the","current","batch"]
code: def __init__(
      self, min_val=-2.0, num_bins=10, momentum=0.01, **kwargs
  ):
      super().__init__(**kwargs)
      c_f.assert_distance_type(
          self, LpDistance, normalize_embeddings=True, p=2
      )
      self.min_val = min_val
      self.num_bins = int(num_bins)
      self.delta = 2 * abs(min_val) / num_bins
      self.momentum = momentum
      self.hist_ = torch.zeros((num_bins,))
      self.add_to_recordable_attributes(
          list_of_names=["num_bins"], is_stat=False
      )
  
file_path: pytorch-metric-learning/src/pytorch_metric_learning/losses/dynamic_soft_margin_loss.py
imports: import numpy
  import torch
  from ..distances import LpDistance
  from ..utils import common_functions
  from ..utils import loss_and_miner_utils
  from .base_metric_loss_function import BaseMetricLossFunction
label_desc: Use image node_id 1 to create a new DynamicSoftMarginLoss object from inherited base classes: BaseMetricLossFunction with example: obj = DynamicSoftMarginLoss(min_val, num_bins, momentum)