docstr: Implementation of the Generalized End-to-End loss defined in https://arxiv.org/abs/1710.10467 [1]
  Accepts an input of size (N, M, D)
      where N is the number of speakers in the batch,
      M is the number of utterances per speaker,
      and D is the dimensionality of the embedding vector (e.g. d-vector)
  Args:
      - init_w (float): defines the initial value of w in Equation (5) of [1]
      - init_b (float): definies the initial value of b in Equation (5) of [1]
docstr_tok: ["Implementation","of","the","Generalized","End-to-End","loss","defined","in","https",":","\/\/arxiv.org\/abs\/1710.10467","[","1","]","Accepts","an","input","of","size","(","N",",","M",",","D",")","where","N","is","the","number","of","speakers","in","the","batch",",","M","is","the","number","of","utterances","per","speaker",",","and","D","is","the","dimensionality","of","the","embedding","vector","(","e.g",".","d-vector",")","Args",":","-","init_w","(","float",")",":","defines","the","initial","value","of","w","in","Equation","(","5",")","of","[","1","]","-","init_b","(","float",")",":","definies","the","initial","value","of","b","in","Equation","(","5",")","of","[","1","]"]
code: def __init__(self, init_w=10.0, init_b=-5.0, loss_method="softmax"):
      """
      Implementation of the Generalized End-to-End loss defined in https://arxiv.org/abs/1710.10467 [1]
      Accepts an input of size (N, M, D)
          where N is the number of speakers in the batch,
          M is the number of utterances per speaker,
          and D is the dimensionality of the embedding vector (e.g. d-vector)
      Args:
          - init_w (float): defines the initial value of w in Equation (5) of [1]
          - init_b (float): definies the initial value of b in Equation (5) of [1]
      """
      super().__init__()
      # pylint: disable=E1102
      self.w = nn.Parameter(torch.tensor(init_w))
      # pylint: disable=E1102
      self.b = nn.Parameter(torch.tensor(init_b))
      self.loss_method = loss_method
  
      print(" > Initialized Generalized End-to-End loss")
  
      assert self.loss_method in ["softmax", "contrast"]
  
      if self.loss_method == "softmax":
          self.embed_loss = self.embed_loss_softmax
      if self.loss_method == "contrast":
          self.embed_loss = self.embed_loss_contrast
  
imports: import torch
  import torch.nn.functional
  from torch import nn
label_desc: Use image node_id 1 to create a new GE2ELoss object from inherited base classes: nn with example: obj = GE2ELoss(init_w, init_b, loss_method)