--- /dev/null
+from ..pattern_utils import get_default_quant_patterns
+
+def get_fbgemm_backend_config_dict():
+ """ Get the backend config dictionary for fbgemm backend
+ NOTE: Current api will change in the future, it's just to unblock experimentation for
+ new backends, please don't use it right now.
+ """
+ # TODO: add output_activation_post_process_map
+ return {
+ "quant_patterns": get_default_quant_patterns()
+ }
from .pattern_utils import (
MatchResult,
- get_default_quant_patterns,
get_default_output_activation_post_process_map,
)
weight_dtype,
)
+from .backend_config_dict import get_fbgemm_backend_config_dict
+from .backend_config_dict import validate_backend_config_dict
+
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
def is_activation_post_process_node(node: Node, modules: Dict[str, torch.nn.Module]) -> bool:
prepare_custom_config_dict = {}
if equalization_qconfig_dict is None:
equalization_qconfig_dict = {}
+ if backend_config_dict is None:
+ backend_config_dict = get_fbgemm_backend_config_dict()
+
+ validate_backend_config_dict(backend_config_dict)
additional_quant_patterns = \
prepare_custom_config_dict.get("additional_quant_pattern", {})
# ((<function relu at 0x7f766a7360d0>, <built-in function add>):
# <class 'torch.quantization.fx.quantize.Add'>),
# }
+ quant_patterns = backend_config_dict["quant_patterns"]
patterns: Dict[Pattern, QuantizeHandler] = get_combined_dict(
- get_default_quant_patterns(), additional_quant_patterns)
+ quant_patterns, additional_quant_patterns)
convert_dict_to_ordered_dict(qconfig_dict)
convert_dict_to_ordered_dict(equalization_qconfig_dict)