class_docstr: P2SGrad:
  https://arxiv.org/abs/1905.02479
  Zhang, X. et al. P2SGrad: Refined gradients for optimizing deep face models.
  in Proc. CVPR 9906-9914, 2019
  
  The gradient formulas defined in Eq.(11) of the paper are equivalent to use an MSE loss with 0
  or 1 as target:
  
  \mathcal{L}_i = \sum_{j=1}^{K} (\cos\theta_{i,j} - \delta(j == y_i))^2
  
  The difference from a common MSE is that the network output is cos angle.
  For this reason the gradient update becomes a new loss function tailored for face recognition systems.
code: def __init__(self, descriptors_dim, num_classes, **kwargs):
      super().__init__(**kwargs)
      self.descriptors_dim = descriptors_dim
      self.num_classes = num_classes
  
      self.weight = Parameter(
          torch.Tensor(descriptors_dim, num_classes)
      )
      self.weight.data.uniform_(-1, 1).renorm_(2, 1, 1e-5).mul_(1e5)
  
      self.m_loss = nn.MSELoss()
  
file_path: pytorch-metric-learning/src/pytorch_metric_learning/losses/p2s_grad_loss.py
imports: import torch
  import torch.nn
  from torch.nn import Parameter
  from ..utils import common_functions
  from .None import BaseMetricLossFunction
label_desc: Use image node_id 1 to create a new P2SGradLoss object from inherited base classes: BaseMetricLossFunction with example: obj = P2SGradLoss(descriptors_dim, num_classes)