class_docstr: Builds py:class:`QConfigMapping` from :py:class:`LinearQuantizerConfig`.
class_docstr_tok: ["Builds","py",":","class",":","`","QConfigMapping","`","from",":","py",":","class",":","`","LinearQuantizerConfig","`","."]
docstr: Builds py:class:`QConfigMapping` from :py:class:`LinearQuantizerConfig`.
docstr_tok: ["Builds","py",":","class",":","`","QConfigMapping","`","from",":","py",":","class",":","`","LinearQuantizerConfig","`","."]
code: def get_qconfig_mapping_from_quantization_config(
      self,
      model: _nn.Module,
      quantization_config: _LinearQuantizerConfig,
      quantization_scheme: _QuantizationScheme,
  ) -> _aoquant.QConfigMapping:
      """
      Builds py:class:`QConfigMapping` from :py:class:`LinearQuantizerConfig`.
      """
      qconfig_mapping = self.get_default_qconfig_mapping(
          quantization_scheme
      )
      if quantization_config.global_config is not None:
          qconfig_mapping = self.get_default_qconfig_mapping(
              quantization_scheme,
              self._create_qconfig_from_quantization_config(
                  quantization_config.global_config
              ),
          )
      for (
          mod_type,
          config,
      ) in quantization_config.module_type_configs.items():
          qconfig = (
              self._create_qconfig_from_quantization_config(config)
              if config is not None
              else config
          )
          qconfig = (
              self._adjust_qconfig_for_module_type(mod_type, qconfig)
              if qconfig is not None
              else qconfig
          )
          qconfig_mapping = qconfig_mapping.set_object_type(
              mod_type, qconfig
          )
      for (
          mod_name,
          config,
      ) in quantization_config.module_name_configs.items():
          qconfig = (
              self._create_qconfig_from_quantization_config(config)
              if config is not None
              else config
          )
          mod_names = self._get_module_names_for_setting_qconfig(
              model, mod_name
          )
          for mn in mod_names:
              qconfig_mapping = qconfig_mapping.set_module_name(
                  mn, qconfig
              )
      return qconfig_mapping
  
file_path: coremltools/coremltools/optimize/torch/quantization/_qconfig_mapping.py
imports: from typing import Any
  from typing import Optional
  import torch
  import torch.ao.quantization
  import torch.nn
  from coremltools.optimize.torch.quantization._backend_config import _fixed_qparams_modules
  from coremltools.optimize.torch.quantization._backend_config import get_supported_modules
  from coremltools.optimize.torch.quantization.quantization_config import LinearQuantizerConfig
  from coremltools.optimize.torch.quantization.quantization_config import ModuleLinearQuantizerConfig
  from coremltools.optimize.torch.quantization.quantization_config import ObserverType
  from coremltools.optimize.torch.quantization.quantization_config import QuantizationScheme
  from coremltools.optimize.torch.quantization.quantization_config import _default_quantization_options
label_desc: Use image node_id 6 for calling the _QConfigMappingBuilder obj's underlying member method code with example usage: obj.get_qconfig_mapping_from_quantization_config(model, quantization_config, quantization_scheme) and returns: qconfig_mapping