code: def _reduce_loss(loss, reduction):
      if reduction == "none":
          return loss
      elif reduction == "elementwise_mean":
          return loss.mean()
      elif reduction == "sum":
          return loss.sum()
      else:
          raise ValueError(reduction + " is not valid")
  
imports: import torch
  from torch.nn.modules.loss import _Loss
  from advertorch.utils import clamp
label_desc: Use image node_id 5 for calling a global function with example usage: _reduce_loss(loss, reduction) and returns: loss, loss, loss