code: def _torch_median(output: torch.Tensor) -> float:
      output = output.view(-1)
      len_ = len(output)
  
      if len_ % 2 == 0:
          return float(
              (
                  torch.kthvalue(output, len_ // 2)[0]
                  + torch.kthvalue(output, len_ // 2 + 1)[0]
              )
              / 2
          )
      else:
          return float(torch.kthvalue(output, len_ // 2 + 1)[0])
  
file_path: ignite/ignite/contrib/metrics/regression/_base.py
imports: from abc import abstractmethod
  from typing import Tuple
  import torch
  from ignite.metrics import Metric
  from ignite.metrics.metric import reinit__is_reduced
label_desc: Use image node_id 3 for calling a global function with example usage: _torch_median(output) and returns: float, float