Skip to content

Commit 2f3a949

Browse files
jerryzh168malfet
authored andcommitted
[quant][fx] Add cat to backend_config_dict (#75259)
Summary: Pull Request resolved: #75259 att Test Plan: python test/test_quantization.py TestQuantizeFx python test/test_quantization.py TestQuantizeFxOps python test/test_quantization.py TestFXNumericSuiteCoreAPIs Imported from OSS Reviewed By: andrewor14 Differential Revision: D35403586 fbshipit-source-id: 066ace239a7ca5a49463f6fcc2fa10e3efef8794 (cherry picked from commit e4b7d91)
1 parent 86485f6 commit 2f3a949

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

torch/ao/quantization/fx/backend_config/native.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,14 @@ def _get_binary_op_configs():
344344
],
345345
}
346346

347+
_CAT_CONFIG = {
348+
"pattern": torch.cat,
349+
"observation_type": ObservationType.OUTPUT_SHARE_OBSERVER_WITH_INPUT,
350+
"dtype_configs": [
351+
default_op_quint8_dtype_config,
352+
]
353+
}
354+
347355
def get_native_backend_config_dict():
348356
""" Get backend_config_dict for PyTorch Native backend (fbgemm/qnnpack). """
349357
return {
@@ -355,5 +363,6 @@ def get_native_backend_config_dict():
355363
*_get_conv_configs(),
356364
*_get_binary_op_configs(),
357365
_HARDSIGMOID_MODULE_CONFIG,
366+
_CAT_CONFIG,
358367
],
359368
}

torch/ao/quantization/fx/quantization_patterns.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,8 @@ def is_standalone_module(self):
121121
class BinaryOpQuantizeHandler(QuantizeHandler):
122122
pass
123123

124-
@register_quant_pattern(torch.cat)
125124
class CatQuantizeHandler(QuantizeHandler):
126-
def is_general_tensor_value_op(self) -> bool:
127-
return True
125+
pass
128126

129127
# TODO: remove this class
130128
class ConvReluQuantizeHandler(QuantizeHandler):

0 commit comments

Comments
 (0)