class_docstr: The parameters are defined as in the paper https://openaccess.thecvf.com/content_CVPR_2019/papers/Aziere_Ensemble_Deep_Manifold_Similarity_Learning_Using_Hard_Proxies_CVPR_2019_paper.pdf
  - l: embedding size.
  
  - K: number of proxies. Optional
  
  - lambdaC: regularization weight. Used in the formula
              :math:`loss = loss^{int} + \lambda_C*loss^{ctx}`.
      For :math:`\lambda_C=0` use only intrinsic loss, for :math:`\lambda_C=\infty` use only context loss.
      Optional
  
  - alpha: parameter of the Random Walk. It is contained in :math:`(0,1)` and specifies the amount of similarity from
         each node is passed to neighbor nodes. Optional
  
  - margin: margin used in the calculation of the loss. Optional
class_docstr_tok: ["The","parameters","are","defined","as","in","the","paper","https",":","\/\/openaccess.thecvf.com\/content_CVPR_2019\/papers\/Aziere_Ensemble_Deep_Manifold_Similarity_Learning_Using_Hard_Proxies_CVPR_2019_paper.pdf","-","l",":","embedding","size",".","-","K",":","number","of","proxies",".","Optional","-","lambdaC",":","regularization","weight",".","Used","in","the","formula",":","math",":","`","loss","=","loss^","{","int","}","+","\\lambda_C","*","loss^","{","ctx","}","`",".","For",":","math",":","`","\\lambda_C=0","`","use","only","intrinsic","loss",",","for",":","math",":","`","\\lambda_C=\\infty","`","use","only","context","loss",".","Optional","-","alpha",":","parameter","of","the","Random","Walk",".","It","is","contained","in",":","math",":","`","(","0,1",")","`","and","specifies","the","amount","of","similarity","from","each","node","is","passed","to","neighbor","nodes",".","Optional","-","margin",":","margin","used","in","the","calculation","of","the","loss",".","Optional"]
code: def __init__(
      self,
      l: int,
      K: int = 50,
      lambdaC: float = 1.0,
      alpha: float = 0.8,
      margin: float = 5e-4,
      **kwargs,
  ):
      super().__init__(**kwargs)
      if lambdaC < 0:
          raise ValueError(
              f"Incorrect value for lambdaC argument. "
              f"Given lambdaC={lambdaC} but accepted only non-negative values"
          )
  
      self.K = K
      self.l = l
      self.proxies = nn.Parameter(torch.randn(K, l))
      self.lambdaC = lambdaC
      self.alpha = alpha
      self.margin = margin
      self.add_to_recordable_attributes(
          list_of_names=["K", "l", "lambdaC", "alpha", "margin"],
          is_stat=False,
      )
  
file_path: pytorch-metric-learning/src/pytorch_metric_learning/losses/manifold_loss.py
imports: import numpy
  import torch
  from torch import nn
  from ..distances import CosineSimilarity
  from ..utils import common_functions
  from .base_metric_loss_function import BaseMetricLossFunction
label_desc: Use image node_id 1 to create a new ManifoldLoss object from inherited base classes: BaseMetricLossFunction with example: obj = ManifoldLoss(l, K, lambdaC, alpha, margin)