code: def get_mean_value(x, target_dim=None):
      if target_dim is None:
          return torch.mean(x)
  
      indices = list(range(len(x.shape)))
      assert target_dim < len(
          indices
      ), "target_dim needs to be less than the number of dim of the tensor"
      del indices[target_dim]
  
      mean_val = torch.mean(x, dim=indices, keepdim=True)
      return mean_val
  
file_path: nni/nni/compression/utils/quantization/utils.py
imports: import torch
  from nni.common.version import TORCH_VERSION
  from .literal import QuantDtype, QuantScheme, QuantType
label_desc: Use image node_id 5 for calling a global function with example usage: get_mean_value(x, target_dim) and returns: mean_val, torch