code: def factory(cls, config):
      loss_type = config.loss_type
      if loss_type == "hinge":
          return HingeLoss(config)
      elif loss_type == "global_hinge":
          return GlobalHingeLoss(config)
      elif loss_type == "softmax_with_cross_entropy":
          return lambda logits, label: L.reduce_mean(
              L.softmax_with_cross_entropy(logits, label)
          )
      else:
          raise ValueError
  
file_path: PGL/legacy/examples/erniesage/models/loss.py
imports: import time
  import glob
  import os
  import numpy
  import pgl
  import paddle.fluid
  import paddle.fluid.layers
label_desc: Use image node_id 2 for calling the Loss obj's underlying member method code with example usage: obj.factory(cls, config) and returns: HingeLoss, GlobalHingeLoss, function