code: def __init__(self, reduction: str = "mean"):
      super().__init__()
      REDUCTIONS = ["none", "mean", "sum"]
      if reduction not in REDUCTIONS:
          raise ValueError(f"Reduction is not in {REDUCTIONS}")
  
      self.reduction = reduction
  
imports: from abc import ABC
  import torch.nn
  from poutyne.framework.metrics.metrics_registering import do_register_metric_func, register_metric_func
label_desc: Use image node_id 1 to create a new BatchMetric object from inherited base classes: ABC, nn with example: obj = BatchMetric(reduction)