code: def _patch_loss(self, evaluator: Evaluator):
      def loss_patch(original_loss, batch):
          reg_loss = 0.0
          count = 0
          for module_name, target_scores in self.scores.items():
              for target_name, score in target_scores.items():
                  target_space = self._target_spaces[module_name][
                      target_name
                  ]
                  if target_space.sparse_threshold is not None:
                      reg_loss += torch.norm(score.sigmoid(), p=1) / score.numel()  # type: ignore
                      count += 1
          ratio = max(
              0.0,
              min(
                  1.0,
                  1 - (self._remaining_times / self.total_times) ** 3,
              ),
          )
          if count > 0:
              reg_loss = self.regular_scale * ratio * reg_loss / count
          return original_loss + reg_loss
  
      evaluator.patch_loss(loss_patch)
  
imports: from __future__ import annotations
  from collections import defaultdict
  import logging
  from typing import Dict, List, overload
  import torch
  from torch.optim import Adam
  from .scheduled_pruner import ScheduledPruner
  from .tools import is_active_target, generate_sparsity
  from ..base.compressor import Compressor
  from ..base.target_space import TargetType
  from ..base.wrapper import ModuleWrapper
  from ..utils import Evaluator, _EVALUATOR_DOCSTRING
label_desc: Use image node_id 8 for calling the MovementPruner obj's underlying member method code with example usage: obj._patch_loss(evaluator) and returns: unknown