class_docstr: Pairwise loss function. :math:`x_p` is the predition score of positive examples,
  and :math:`x_n` is the predition score of negative examples.
  
  .. math::
      \text{loss}(x_p, x_n) = \sum_i log(1+\exp(-x_p[i])) + \sum_j log(1+\exp(x_n[j]))
class_docstr_tok: ["Pairwise","loss","function",".",":","math",":","`","x_p","`","is","the","predition","score","of","positive","examples",",","and",":","math",":","`","x_n","`","is","the","predition","score","of","negative","examples",".","..","math",":",":","\\text","{","loss","}","(","x_p",",","x_n",")","=","\\sum_i","log","(","1+\\exp","(","-x_p","[","i","]",")",")","+","\\sum_j","log","(","1+\\exp","(","x_n","[","j","]",")",")"]
code: def forward(self, p_score, n_score):
      if self.adv_flag:
          return (
              self.criterion(-p_score).mean()
              + (self.get_weights(n_score) * self.criterion(n_score))
              .sum(dim=-1)
              .mean()
          ) / 2
      else:
          return (
              self.criterion(-p_score).mean()
              + self.criterion(n_score).mean()
          ) / 2
  
file_path: graph4nlp/graph4nlp/pytorch/modules/loss/kg_loss.py
imports: import torch
  import torch.nn
  from .base import KGLossBase
label_desc: Use image node_id 3 for calling the SoftplusLoss obj's underlying member method code with example usage: obj.forward(p_score, n_score) and returns: unknown, unknown