code: def get_global_sparsity_summaries(
      layer_sparsities: _List[_torch.Tensor], layer_numel: _List[int]
  ) -> float:
      assert len(layer_sparsities) == len(layer_numel)
  
      weighted_sum, denom = 0.0, 0.0
      for sparsity, numel in zip(layer_sparsities, layer_numel):
          if sparsity >= 0.0:
              denom += numel
              weighted_sum += numel * _cast(float, sparsity)
  
      if _torch.all(_torch.tensor(layer_sparsities) < 0):
          # to indicate the sparsity type is not applicable
          return -1
  
      assert denom > 0.0
      return weighted_sum / denom
  
file_path: coremltools/coremltools/optimize/torch/pruning/_utils.py
imports: import logging
  from typing import List
  from typing import Optional
  from typing import Tuple
  from typing import cast
  import numpy
  import torch
label_desc: Use image node_id 9 for calling a global function with example usage: get_global_sparsity_summaries(layer_sparsities, layer_numel) and returns: unknown, unknown