code: def harmonic_mean(x: Tensor, dim: int, eps: float = 1e-6) -> Tensor:
      """
      Compute harmonic mean along given dimension.
  
      Args:
          x: Input tensor of arbitrary shape
          dim: Dimension to reduce
  
      Returns:
          Tensor
      """
      x = torch.reciprocal(x.clamp_min(eps))
      x = torch.mean(x, dim=dim)
      x = torch.reciprocal(x.clamp_min(eps))
      return x
  
imports: import itertools
  from collections.abc import Sized, Iterable
  from typing import Union, Tuple
  import torch
  from torch import Tensor
  from ..utils.support import pytorch_toolbelt_deprecated
label_desc: Use image node_id 23 for calling a global function with example usage: harmonic_mean(x, dim, eps) and returns: x