code: def _make_pruning_permanent_on_state_dict(
      self, pl_module: LightningModule
  ) -> Dict[str, Any]:
      state_dict = pl_module.state_dict()
  
      # find the mask and the original weights.
      map_pruned_params = {
          k.replace("_mask", "")
          for k in state_dict
          if k.endswith("_mask")
      }
      for tensor_name in map_pruned_params:
          orig = state_dict.pop(tensor_name + "_orig")
          mask = state_dict.pop(tensor_name + "_mask")
          # make weights permanent
          state_dict[tensor_name] = mask.to(dtype=orig.dtype) * orig
  
      def move_to_cpu(tensor: Tensor) -> Tensor:
          # each tensor and move them on cpu
          return tensor.cpu()
  
      return apply_to_collection(state_dict, Tensor, move_to_cpu)
  
imports: import inspect
  import logging
  from copy import deepcopy
  from functools import partial
  from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
  import torch.nn.utils.prune
  from lightning_utilities.core.apply_func import apply_to_collection
  from torch import Tensor, nn
  from typing_extensions import TypedDict, override
  import lightning.pytorch
  from lightning.pytorch.callbacks.callback import Callback
  from lightning.pytorch.core.module import LightningModule
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.rank_zero import rank_zero_debug, rank_zero_only
label_desc: Use image node_id 19 for calling the ModelPruning obj's underlying member method code with example usage: obj._make_pruning_permanent_on_state_dict(pl_module) and returns: apply_to_collection, tensor