class_docstr: Custom configuration for :func:`~torch.ao.quantization.quantize_fx.convert_fx`.
  
  Example usage::
  
      convert_custom_config = ConvertCustomConfig()             .set_observed_to_quantized_mapping(ObservedCustomModule, QuantizedCustomModule)             .set_preserved_attributes(["attr1", "attr2"])
class_docstr_tok: ["Custom","configuration","for",":","func",":","`","~torch.ao.quantization.quantize_fx.convert_fx","`",".","Example","usage",":",":","convert_custom_config","=","ConvertCustomConfig","(",")",".set_observed_to_quantized_mapping","(","ObservedCustomModule",",","QuantizedCustomModule",")",".set_preserved_attributes","(","[","``","attr1","''",",","``","attr2","''","]",")"]
docstr: Create a ``ConvertCustomConfig`` from a dictionary with the following items:
  
      "observed_to_quantized_custom_module_class": a nested dictionary mapping from quantization
      mode to an inner mapping from observed module classes to quantized module classes, e.g.::
      {
      "static": {FloatCustomModule: ObservedCustomModule},
      "dynamic": {FloatCustomModule: ObservedCustomModule},
      "weight_only": {FloatCustomModule: ObservedCustomModule}
      }
      "preserved_attributes": a list of attributes that persist even if they are not used in ``forward``
  
  This function is primarily for backward compatibility and may be removed in the future.
docstr_tok: ["Create","a","``","ConvertCustomConfig","``","from","a","dictionary","with","the","following","items",":","``","observed_to_quantized_custom_module_class","''",":","a","nested","dictionary","mapping","from","quantization","mode","to","an","inner","mapping","from","observed","module","classes","to","quantized","module","classes",",","e.g",".",":",":","{","``","static","''",":","{","FloatCustomModule",":","ObservedCustomModule","}",",","``","dynamic","''",":","{","FloatCustomModule",":","ObservedCustomModule","}",",","``","weight_only","''",":","{","FloatCustomModule",":","ObservedCustomModule","}","}","``","preserved_attributes","''",":","a","list","of","attributes","that","persist","even","if","they","are","not","used","in","``","forward","``","This","function","is","primarily","for","backward","compatibility","and","may","be","removed","in","the","future","."]
code: def from_dict(
      cls, convert_custom_config_dict: Dict[str, Any]
  ) -> ConvertCustomConfig:
      """
      Create a ``ConvertCustomConfig`` from a dictionary with the following items:
  
          "observed_to_quantized_custom_module_class": a nested dictionary mapping from quantization
          mode to an inner mapping from observed module classes to quantized module classes, e.g.::
          {
          "static": {FloatCustomModule: ObservedCustomModule},
          "dynamic": {FloatCustomModule: ObservedCustomModule},
          "weight_only": {FloatCustomModule: ObservedCustomModule}
          }
          "preserved_attributes": a list of attributes that persist even if they are not used in ``forward``
  
      This function is primarily for backward compatibility and may be removed in the future.
      """
      conf = cls()
      for (
          quant_type_name,
          custom_module_mapping,
      ) in convert_custom_config_dict.get(
          OBSERVED_TO_QUANTIZED_DICT_KEY, {}
      ).items():
          quant_type = _quant_type_from_str(quant_type_name)
          for (
              observed_class,
              quantized_class,
          ) in custom_module_mapping.items():
              conf.set_observed_to_quantized_mapping(
                  observed_class, quantized_class, quant_type
              )
      conf.set_preserved_attributes(
          convert_custom_config_dict.get(
              PRESERVED_ATTRIBUTES_DICT_KEY, []
          )
      )
      return conf
  
imports: from __future__ import annotations
  from dataclasses import dataclass
  from typing import Any, Dict, List, Optional, Tuple, Type
  from torch.ao.quantization import QConfigMapping
  from torch.ao.quantization.backend_config import BackendConfig
  from torch.ao.quantization.quant_type import QuantType, _quant_type_from_str, _get_quant_type_to_str
label_desc: Use image node_id 5 for calling the ConvertCustomConfig obj's underlying member method code with example usage: obj.from_dict(cls, convert_custom_config_dict) and returns: conf