code: def weighted_act_configs(
      mod: _Type[_nn.Module],
      func_mod: _Callable,
      act: _Type[_nn.Module],
      fused_mod: _Type[_nn.Module],
      qat_mod: _Type[_nn.Module],
      ref_quant_mod: _Type[_nn.Module],
  ) -> _List[_BackendPatternConfig]:
      """
      Returns backend pattern configs for the following sequence of ops:
  
      input -> mod -> activation -> output
  
      where mod is a module with a weight associated with it, such as convolution and linear.
      """
      return [
          # conv/linear module + act module
          _BackendPatternConfig(get_fusion_pattern((act, mod)))
          .set_dtype_configs(weighted_dtype_configs)
          .set_fuser_method(get_fuser_method(fused_mod))
          .set_fused_module(fused_mod),
          # conv/linear func + act module
          _BackendPatternConfig(get_fusion_pattern((act, func_mod)))
          .set_observation_type(
              _ObservationType.OUTPUT_USE_DIFFERENT_OBSERVER_AS_INPUT
          )
          .set_dtype_configs(weighted_dtype_configs),
          # conv/linear + act fused
          fused_mod_config(
              mod=fused_mod,
              fused_mod=fused_mod,
              qat_mod=qat_mod,
              ref_quant_mod=ref_quant_mod,
          ),
          # qat conv/linear + act
          qat_mod_config(
              mod=fused_mod,
              qat_mod=qat_mod,
              ref_quant_mod=ref_quant_mod,
          ),
      ]
  
imports: from copy import deepcopy
  from typing import Any
  from typing import Callable
  from typing import List
  from typing import Optional
  from typing import Tuple
  from typing import Type
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.ao.quantization.backend_config import BackendPatternConfig
  from torch.ao.quantization.backend_config import DTypeConfig
  from torch.ao.quantization.backend_config import DTypeWithConstraints
  from torch.ao.quantization.backend_config import ObservationType
  from coremltools.optimize.torch._utils.version_utils import is_torch_2
label_desc: Use image node_id 7 for calling a global function with example usage: weighted_act_configs(mod, func_mod, act, fused_mod, qat_mod, ref_quant_mod) and returns: list