code: def reduce(self, losses, target_lengths):
      if self.config_reduction == "mean_batch":
          losses = losses.mean()  # global batch size average
      elif self.config_reduction == "mean_volume":
          losses = (
              losses.sum() / target_lengths.sum()
          )  # same as above but longer samples weigh more
  
      return losses
  
file_path: NeMo/nemo/collections/asr/losses/ctc.py
imports: import torch
  from torch import nn
  from nemo.core.classes import Serialization, Typing, typecheck
  from nemo.core.neural_types import LabelsType, LengthsType, LogprobsType, LossType, NeuralType
label_desc: Use image node_id 4 for calling the CTCLoss obj's underlying member method code with example usage: obj.reduce(losses, target_lengths) and returns: losses