class_docstr: Base class for all pruners which use a PruningMethod (implemented in
class_docstr_tok: ["Base","class","for","all","pruners","which","use","a","PruningMethod","(","implemented","in"]
docstr: Returns a dictionary with important statistics related to current state of pruning.
  Each key in the dictionary corresponds to a module name and the value is a dictionary
  containing the statistics such as ``unstructured_weight_sparsity``,
  number of parameters, etc. Also contains a ``global`` key containing the same statistics
  aggregated over all the modules set up for pruning.
docstr_tok: ["Returns","a","dictionary","with","important","statistics","related","to","current","state","of","pruning",".","Each","key","in","the","dictionary","corresponds","to","a","module","name","and","the","value","is","a","dictionary","containing","the","statistics","such","as","``","unstructured_weight_sparsity","``",",","number","of","parameters",",","etc",".","Also","contains","a","``","global","``","key","containing","the","same","statistics","aggregated","over","all","the","modules","set","up","for","pruning","."]
code: def report(self) -> _Report:
      """
      Returns a dictionary with important statistics related to current state of pruning.
      Each key in the dictionary corresponds to a module name and the value is a dictionary
      containing the statistics such as ``unstructured_weight_sparsity``,
      number of parameters, etc. Also contains a ``global`` key containing the same statistics
      aggregated over all the modules set up for pruning.
      """
      report = _Report()
      with _get_eval_model(self._model):
          with _torch.no_grad():
              # add submodule level sparsity summary
              total_num_params = 0
              for name, pruner_info in self._pruner_info.items():
                  submodule = pruner_info.module
                  if hasattr(submodule, "pruning_method"):
                      submod_config = pruner_info.config
                      num_params = (
                          getattr(submodule, submod_config.param_name)
                          .detach()
                          .numel()
                      )
                      summary = {"#params": int(num_params)}
                      summary.update(
                          submodule.pruning_method.get_sparsity_summary(
                              submodule
                          )
                      )
                      total_num_params += num_params
                      report[name] = summary
              # get global sparsity summary
              global_summaries = {"#params": total_num_params}
              for sparsity_type in [
                  "structured",
                  "unstructured",
                  "block2",
              ]:
                  layer_numel = [
                      val["#params"] for _, val in report.items()
                  ]
                  layer_sparsities = [
                      val[f"{sparsity_type}_weight_sparsity"]
                      for _, val in report.items()
                  ]
                  global_summaries[
                      f"{sparsity_type}_weight_sparsity"
                  ] = _get_global_sparsity_summaries(
                      layer_sparsities, layer_numel
                  )
              report["global"] = global_summaries
      return report
  
file_path: coremltools/coremltools/optimize/torch/pruning/_base_pruner.py
imports: import copy
  import logging
  from typing import Optional
  from typing import Tuple
  import torch
  from coremltools.optimize.torch._utils.torch_utils import get_eval_model
  from coremltools.optimize.torch.base_model_optimizer import BaseModelOptimizer
  from coremltools.optimize.torch.base_model_optimizer import _Report
  from coremltools.optimize.torch.optimization_config import OptimizationConfig
  from coremltools.optimize.torch.pruning._utils import get_global_sparsity_summaries
label_desc: Use image node_id 6 for calling the BasePrunerWithPruningMethod obj's underlying member method code with example usage: obj.report() and returns: report