code: def reduce_loss(loss, reduction):
      """Reduce loss as specified.
  
      Args:
          loss (Tensor): Elementwise loss tensor.
          reduction (str): Options are "none", "mean" and "sum".
  
      Return:
          Tensor: Reduced loss tensor.
      """
      reduction_enum = F._Reduction.get_enum(reduction)
      # none: 0, elementwise_mean:1, sum: 2
      if reduction_enum == 0:
          return loss
      elif reduction_enum == 1:
          return loss.mean()
      elif reduction_enum == 2:
          return loss.sum()
  
imports: import functools
  import torch.nn.functional
label_desc: Use image node_id 1 for calling a global function with example usage: reduce_loss(loss, reduction) and returns: loss, loss, loss