class_docstr: Loss functions.
  
  Args:
      name (str):
          Loss function name.
      margin (float, optional):
          Margin parameter for MarginRankingLoss.
      pairwise (bool, optional):
          Whether compute loss of positive and negative samples pairwise.
      neg_adv_spl (bool, optional):
          Whether use negative adversarial sampling.
      neg_adv_temp (float, optional):
          Temperature of negative adversarial sampling.
class_docstr_tok: ["Loss","functions",".","Args",":","name","(","str",")",":","Loss","function","name",".","margin","(","float",",","optional",")",":","Margin","parameter","for","MarginRankingLoss",".","pairwise","(","bool",",","optional",")",":","Whether","compute","loss","of","positive","and","negative","samples","pairwise",".","neg_adv_spl","(","bool",",","optional",")",":","Whether","use","negative","adversarial","sampling",".","neg_adv_temp","(","float",",","optional",")",":","Temperature","of","negative","adversarial","sampling","."]
docstr: Return loss function objective.
          
docstr_tok: ["Return","loss","function","objective","."]
code: def get_loss_func(self):
      """Return loss function objective."""
      if self.name == "Hinge":
          self.neg_label = -1
          return MarginRankingLoss(margin=self.margin)
      elif self.name == "Logsigmoid":
          self.neg_label = -1
          return LogSigmoidLoss()
      elif self.name == "BCE":
          self.neg_label = 0
          return BCELoss()
      elif self.name == "Softplus":
          self.neg_label = -1
          return SoftplusLoss()
      else:
          raise ValueError("loss %s not implemented!" % self.name)
  
file_path: PGL/apps/Graph4KG/models/loss_func.py
imports: import paddle
  from paddle.nn import BCELoss, MarginRankingLoss
  from paddle.nn.functional import log_sigmoid, softmax, softplus
label_desc: Use image node_id 4 for calling the LossFunction obj's underlying member method code with example usage: obj.get_loss_func() and returns: MarginRankingLoss, LogSigmoidLoss, BCELoss, SoftplusLoss