code: def _reduce_loss(losses: Tensor, reduction: str) -> Tensor:
      if reduction == "none":
          return losses
      return (
          torch.mean(losses)
          if reduction == "mean"
          else torch.sum(losses)
      )
  
file_path: kornia/kornia/losses/divergence.py
imports: from __future__ import annotations
  import torch
  import torch.nn.functional
  from kornia.core import Tensor
label_desc: Use image node_id 3 for calling a global function with example usage: _reduce_loss(losses, reduction) and returns: unknown, losses