code: def reduce_loss(loss: Tensor, reduction: str) -> Tensor:
      """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()
  
file_path: mmdetection/mmdet/models/losses/utils.py
imports: import functools
  from typing import Callable, Optional
  import torch
  import torch.nn.functional
  from torch import Tensor
label_desc: Use image node_id 1 for calling a global function with example usage: reduce_loss(loss, reduction) and returns: loss, loss, loss