code: def compute_mean_error_metrics(
      y_pred: torch.Tensor, y: torch.Tensor, func: Callable
  ) -> torch.Tensor:
      # reducing in only channel + spatial dimensions (not batch)
      # reduction of batch handled inside __call__() using do_metric_reduction() in respective calling class
      flt = partial(torch.flatten, start_dim=1)
      return torch.mean(flt(func(y - y_pred)), dim=-1, keepdim=True)
  
imports: from __future__ import annotations
  import math
  from abc import abstractmethod
  from collections.abc import Callable, Sequence
  from functools import partial
  from typing import Any
  import torch
  import torch.nn.functional
  from monai.metrics.utils import do_metric_reduction
  from monai.utils import MetricReduction, StrEnum, convert_data_type, ensure_tuple_rep
  from monai.utils.type_conversion import convert_to_dst_type
  from .metric import CumulativeIterationMetric
label_desc: Use image node_id 1 for calling a global function with example usage: compute_mean_error_metrics(y_pred, y, func) and returns: torch