class_docstr: Implementation of https://arxiv.org/pdf/1801.07698.pdf
class_docstr_tok: ["Implementation","of","https",":","\/\/arxiv.org\/pdf\/1801.07698.pdf"]
code: def modify_cosine_of_target_classes(self, cosine_of_target_classes):
      angles = self.get_angles(cosine_of_target_classes)
  
      # Compute cos of (theta + margin) and cos of theta
      cos_theta_plus_margin = torch.cos(angles + self.margin)
      cos_theta = torch.cos(angles)
  
      # Keep the cost function monotonically decreasing
      unscaled_logits = torch.where(
          angles <= np.deg2rad(180) - self.margin,
          cos_theta_plus_margin,
          cos_theta - self.margin * np.sin(self.margin),
      )
  
      return unscaled_logits
  
file_path: pytorch-metric-learning/src/pytorch_metric_learning/losses/arcface_loss.py
imports: import numpy
  import torch
  from ..utils import common_functions
  from .large_margin_softmax_loss import LargeMarginSoftmaxLoss
label_desc: Use image node_id 4 for calling the ArcFaceLoss obj's underlying member method code with example usage: obj.modify_cosine_of_target_classes(cosine_of_target_classes) and returns: unscaled_logits