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: Adverarial weights for softmax.
          
docstr_tok: ["Adverarial","weights","for","softmax","."]
code: def adverarial_weight(self, score):
      """Adverarial weights for softmax."""
      adv_score = self.neg_adv_temp * score
      adv_softmax = softmax(adv_score, axis=-1)
      adv_softmax.stop_gradient = True
      return adv_softmax
  
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 3 for calling the LossFunction obj's underlying member method code with example usage: obj.adverarial_weight(score) and returns: adv_softmax