code: def _apply_mask_helper(
      self, target: Tensor, target_space: PruningTargetSpace
  ) -> Tensor:
      # NOTE: if mask is None, and is registered as buffer during training, will cause DDP sync problem.
      if target_space.mask is not None:
          if target_space.apply_method in pruning_apply_methods:
              return pruning_apply_methods[target_space.apply_method](
                  target, target_space
              )
          else:
              raise TypeError(
                  f"Only {list(pruning_apply_methods.keys())} are supported for mask `apply_method`."
              )
      elif (
          target_space.type is TargetType.PARAMETER
          and target is not None
      ):
          # Prevent registering buffer as a parameter
          return target * 1.0
      else:
          return target
  
imports: from __future__ import annotations
  from collections import defaultdict
  import logging
  import inspect
  import functools
  from typing import Any, Callable, Dict, List, Tuple, Type, Union, Literal
  import torch
  import torch.nn
  from torch import Tensor
  from .apply_method import pruning_apply_methods, quant_apply_methods
  from .config import select_modules_by_config
  from .setting import INPUT_PREFIX, OUTPUT_PREFIX, canonicalize_settings
  from .target_space import TargetSpace, TargetType, PruningTargetSpace, QuantizationTargetSpace, DistillationTargetSpace
  from .fuse_modules import fuse_modules
  from ..utils import check_bias, update_config, validate_fused_modules_config, get_fused_module_list, get_nested_attr
label_desc: Use image node_id 16 for calling the ModuleWrapper obj's underlying member method code with example usage: obj._apply_mask_helper(target, target_space) and returns: pruning_apply_methods, unknown, target