class_docstr: Implementation of https://arxiv.org/pdf/1612.02295.pdf
class_docstr_tok: ["Implementation","of","https",":","\/\/arxiv.org\/pdf\/1612.02295.pdf"]
code: def __init__(
      self, num_classes, embedding_size, margin=4, scale=1, **kwargs
  ):
      super().__init__(**kwargs)
      c_f.assert_distance_type(self, CosineSimilarity)
      self.margin = margin
      self.num_classes = num_classes
      self.scale = scale
      self.add_to_recordable_attributes(
          list_of_names=["num_classes", "margin", "scale"],
          is_stat=False,
      )
      self.add_to_recordable_attributes(name="avg_angle", is_stat=True)
      self.init_margin()
      self.W = torch.nn.Parameter(
          torch.Tensor(embedding_size, num_classes)
      )
      self.weight_init_func(self.W)
      self.cross_entropy = torch.nn.CrossEntropyLoss(reduction="none")
  
imports: import math
  import numpy
  import scipy.special
  import torch
  from ..distances import CosineSimilarity
  from ..utils import common_functions
  from ..utils import loss_and_miner_utils
  from .base_metric_loss_function import BaseMetricLossFunction
  from .mixins import WeightRegularizerMixin
label_desc: Use image node_id 1 to create a new LargeMarginSoftmaxLoss object from inherited base classes: WeightRegularizerMixin, BaseMetricLossFunction with example: obj = LargeMarginSoftmaxLoss(num_classes, embedding_size, margin, scale)