|
51 | 51 | from nncf.common.utils.debug import DEBUG_LOG_DIR
|
52 | 52 | from nncf.common.utils.debug import is_debug
|
53 | 53 | from nncf.common.utils.dot_file_rw import write_dot_graph
|
| 54 | +from nncf.config.schemata.defaults import QUANTIZATION_NARROW_RANGE |
54 | 55 |
|
55 | 56 |
|
56 | 57 | class TransitionStatus(Enum):
|
@@ -160,6 +161,7 @@ def is_final_qconfig_compatible_to_initial(initial_qconfig: QuantizerConfig) ->
|
160 | 161 | final_qconfig.per_channel == initial_qconfig.per_channel
|
161 | 162 | and final_qconfig.mode == initial_qconfig.mode
|
162 | 163 | and final_qconfig.num_bits == initial_qconfig.num_bits
|
| 164 | + and final_qconfig.narrow_range == initial_qconfig.narrow_range |
163 | 165 | and (
|
164 | 166 | final_qconfig.signedness_to_force == initial_qconfig.signedness_to_force
|
165 | 167 | or initial_qconfig.signedness_to_force is None
|
@@ -301,7 +303,13 @@ class QuantizerPropagationSolver:
|
301 | 303 | """
|
302 | 304 |
|
303 | 305 | DEFAULT_QUANTIZATION_TYPES = [
|
304 |
| - QuantizerConfig(num_bits=8, mode=QuantizationMode.SYMMETRIC, signedness_to_force=None, per_channel=False) |
| 306 | + QuantizerConfig( |
| 307 | + num_bits=8, |
| 308 | + mode=QuantizationMode.SYMMETRIC, |
| 309 | + signedness_to_force=None, |
| 310 | + per_channel=False, |
| 311 | + narrow_range=QUANTIZATION_NARROW_RANGE, |
| 312 | + ) |
305 | 313 | ]
|
306 | 314 |
|
307 | 315 | DEFAULT_PROPAGATION_STRATEGY = QuantizerPropagationRule.MERGE_ALL_IN_ONE
|
@@ -1373,7 +1381,7 @@ def get_merged_qconfigs_for_downward_branching_case(
|
1373 | 1381 | Returns a tuple, of which the first node is the qconfig list for the quantizer to be placed
|
1374 | 1382 | above the branching node (i.e. that will affect all of the downward branches), and a list
|
1375 | 1383 | of nodes which are either None (which means that the corresponding branch quantizer has been successfully
|
1376 |
| - merged, or qconfigs list to be set for the corresponding branch quantizer if it cannot be merged (e.g. if |
| 1384 | + merged), or qconfigs list to be set for the corresponding branch quantizer if it cannot be merged (e.g. if |
1377 | 1385 | requantization to a lower bitwidth has to be done for this branch)
|
1378 | 1386 |
|
1379 | 1387 | :param potential_qconfigs_for_each_branch: For each branch defines the list of available configurations
|
@@ -1495,7 +1503,8 @@ def __disambiguate_config_list(
|
1495 | 1503 | """
|
1496 | 1504 | The input list should be sorted in descending order of priority. In case some qconfigs in the list have the
|
1497 | 1505 | same priority, this function will resolve the ambiguity in ordering these qconfigs in the final returned
|
1498 |
| - list. |
| 1506 | + list. Quantization configs could not contain different narrow range parameters, so it does |
| 1507 | + not participate in __lt__ method of the QConfigComparator. |
1499 | 1508 | """
|
1500 | 1509 |
|
1501 | 1510 | class QConfigComparator:
|
|
0 commit comments