code: def generate_masks(self) -> Dict[str, Dict[str, torch.Tensor]]:
      data = self._collect_data()
      metrics = self._calculate_metrics(data)
      return self._generate_sparsity(metrics)
  
imports: from __future__ import annotations
  from collections import defaultdict
  from copy import deepcopy
  import logging
  from typing import Any, Dict, List, Literal, Callable
  import torch
  from torch.utils._pytree import tree_map
  from .config import trans_legacy_config_list, default_config_schema
  from .target_space import TargetSpace, TargetType, DistillationTargetSpace, PruningTargetSpace, QuantizationTargetSpace
  from .wrapper import ModuleWrapper, register_wrappers
  from ..utils import Evaluator, Scaling, _EVALUATOR_DOCSTRING
label_desc: Use image node_id 9 for calling the Pruner obj's underlying member method code with example usage: obj.generate_masks() and returns: self