mct-nightly 2.3.0.20250303.547__py3-none-any.whl → 2.3.0.20250305.525__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mct_nightly-2.3.0.20250303.547.dist-info → mct_nightly-2.3.0.20250305.525.dist-info}/METADATA +1 -1
- {mct_nightly-2.3.0.20250303.547.dist-info → mct_nightly-2.3.0.20250305.525.dist-info}/RECORD +10 -10
- model_compression_toolkit/__init__.py +1 -1
- model_compression_toolkit/core/common/mixed_precision/mixed_precision_candidates_filter.py +3 -12
- model_compression_toolkit/core/common/mixed_precision/solution_refinement_procedure.py +76 -34
- model_compression_toolkit/target_platform_capabilities/targetplatform2framework/attach2pytorch.py +1 -1
- model_compression_toolkit/target_platform_capabilities/tpc_models/tflite_tpc/v1/tpc.py +3 -2
- {mct_nightly-2.3.0.20250303.547.dist-info → mct_nightly-2.3.0.20250305.525.dist-info}/LICENSE.md +0 -0
- {mct_nightly-2.3.0.20250303.547.dist-info → mct_nightly-2.3.0.20250305.525.dist-info}/WHEEL +0 -0
- {mct_nightly-2.3.0.20250303.547.dist-info → mct_nightly-2.3.0.20250305.525.dist-info}/top_level.txt +0 -0
{mct_nightly-2.3.0.20250303.547.dist-info → mct_nightly-2.3.0.20250305.525.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: mct-nightly
|
3
|
-
Version: 2.3.0.
|
3
|
+
Version: 2.3.0.20250305.525
|
4
4
|
Summary: A Model Compression Toolkit for neural networks
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
6
6
|
Classifier: License :: OSI Approved :: Apache Software License
|
{mct_nightly-2.3.0.20250303.547.dist-info → mct_nightly-2.3.0.20250305.525.dist-info}/RECORD
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
model_compression_toolkit/__init__.py,sha256=
|
1
|
+
model_compression_toolkit/__init__.py,sha256=12OGQaehHq34jgmvxWZvkMkK13PqhCx-3FZjElMI7zo,1557
|
2
2
|
model_compression_toolkit/constants.py,sha256=i_R6uXBfO1ph_X6DNJych2x59SUojfJbn7dNjs_mZnc,3846
|
3
3
|
model_compression_toolkit/defaultdict.py,sha256=LSc-sbZYXENMCw3U9F4GiXuv67IKpdn0Qm7Fr11jy-4,2277
|
4
4
|
model_compression_toolkit/logger.py,sha256=L3q7tn3Uht0i_7phnlOWMR2Te2zvzrt2HOz9vYEInts,4529
|
@@ -64,14 +64,14 @@ model_compression_toolkit/core/common/mixed_precision/bit_width_setter.py,sha256
|
|
64
64
|
model_compression_toolkit/core/common/mixed_precision/configurable_quant_id.py,sha256=LLDguK7afsbN742ucLpmJr5TUfTyFpK1vbf2bpVr1v0,882
|
65
65
|
model_compression_toolkit/core/common/mixed_precision/configurable_quantizer_utils.py,sha256=7dKMi5S0zQZ16m8NWn1XIuoXsKuZUg64G4-uK8-j1PQ,5177
|
66
66
|
model_compression_toolkit/core/common/mixed_precision/distance_weighting.py,sha256=-x8edUyudu1EAEM66AuXPtgayLpzbxoLNubfEbFM5kU,2867
|
67
|
-
model_compression_toolkit/core/common/mixed_precision/mixed_precision_candidates_filter.py,sha256=
|
67
|
+
model_compression_toolkit/core/common/mixed_precision/mixed_precision_candidates_filter.py,sha256=6pLUEEIqRTVIlCYQC4JIvY55KAvuBHEX8uTOQ-1Ac4Q,3859
|
68
68
|
model_compression_toolkit/core/common/mixed_precision/mixed_precision_quantization_config.py,sha256=r1t025_QHshyoop-PZvL7x6UuXaeplCCU3h4VNBhJHo,4309
|
69
69
|
model_compression_toolkit/core/common/mixed_precision/mixed_precision_ru_helper.py,sha256=7iJ2YprFvm2Dk9EkXYrwO7-Sf89f537D-KrQP7XhvPs,8889
|
70
70
|
model_compression_toolkit/core/common/mixed_precision/mixed_precision_search_facade.py,sha256=aAuGIzSDKIDiq07nheeWRXLEatzr6Fvoa5ZHv-2BtCI,7130
|
71
71
|
model_compression_toolkit/core/common/mixed_precision/mixed_precision_search_manager.py,sha256=uDX1mEaq7qqWk2FQCfVXUYVlpGWS0OBP0C1CsGCkZYY,32791
|
72
72
|
model_compression_toolkit/core/common/mixed_precision/sensitivity_evaluation.py,sha256=gsigifJ-ykWNafF4t7UMEC_-nd6YPERAk1_z0kT-Y88,27172
|
73
73
|
model_compression_toolkit/core/common/mixed_precision/set_layer_to_bitwidth.py,sha256=P8QtKgFXtt5b2RoubzI5OGlCfbEfZsAirjyrkFzK26A,2846
|
74
|
-
model_compression_toolkit/core/common/mixed_precision/solution_refinement_procedure.py,sha256=
|
74
|
+
model_compression_toolkit/core/common/mixed_precision/solution_refinement_procedure.py,sha256=MQZnBcpBDMd5y6rOunUtH3t41GQH0aBmxVB4muoxNfk,9477
|
75
75
|
model_compression_toolkit/core/common/mixed_precision/resource_utilization_tools/__init__.py,sha256=Rf1RcYmelmdZmBV5qOKvKWF575ofc06JFQSq83Jz99A,696
|
76
76
|
model_compression_toolkit/core/common/mixed_precision/resource_utilization_tools/resource_utilization.py,sha256=T5yVr7lay-6QLuTDBZNI1Ufj02EMBWuY_yHjC8eHx5I,3998
|
77
77
|
model_compression_toolkit/core/common/mixed_precision/resource_utilization_tools/resource_utilization_calculator.py,sha256=DyiE84ECgwtaCATWcisv-7ndmBUbj_TaddZ7GeIjlrU,35307
|
@@ -439,7 +439,7 @@ model_compression_toolkit/target_platform_capabilities/schema/v1.py,sha256=4CGpW
|
|
439
439
|
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/__init__.py,sha256=XjNws3zoiJkeH4ixKqrLA5xBvpv5rq31qX7wYQjNpZM,1447
|
440
440
|
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/attach2fw.py,sha256=HJ8uc3PFfyxg-WpVXPBg4mGaox8Z9bRqtQNbRfIyAk4,3745
|
441
441
|
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/attach2keras.py,sha256=mxc3DBbUi-HDFgSx8Nmnyxr8SIdbx8lmtcRMsQl1BLE,7578
|
442
|
-
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/attach2pytorch.py,sha256=
|
442
|
+
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/attach2pytorch.py,sha256=WPCqs_aFGE28XJf7KKB-SlrYoUNOcD9epgoaqQMCJMw,6320
|
443
443
|
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/attribute_filter.py,sha256=jfhszvuD2Fyy6W2KjlLzXBQKFzTqGAaDZeFVr4-ONQw,8776
|
444
444
|
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/current_tpc.py,sha256=_kFG0USYa6yzvLsi82_Vusv_KR8Hi7J1u680pPXECuo,2192
|
445
445
|
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/framework_quantization_capabilities.py,sha256=UKzckLYLdBcFAptyKnVMwpPpfRkmF0SK1Kl0g0eGjQA,9710
|
@@ -459,7 +459,7 @@ model_compression_toolkit/target_platform_capabilities/tpc_models/qnnpack_tpc/v1
|
|
459
459
|
model_compression_toolkit/target_platform_capabilities/tpc_models/tflite_tpc/__init__.py,sha256=cco4TmeIDIh32nj9ZZXVkws4dd9F2UDrmjKzTN8G0V0,697
|
460
460
|
model_compression_toolkit/target_platform_capabilities/tpc_models/tflite_tpc/latest/__init__.py,sha256=NGnmaFTeLINIdAZ1svx-_OiF6vIs8upH-tz3q9jWBQ4,1554
|
461
461
|
model_compression_toolkit/target_platform_capabilities/tpc_models/tflite_tpc/v1/__init__.py,sha256=t4JKsPcor-7KSCKzIwuaBv0NLNwfhuewAQGlDl6iBeo,717
|
462
|
-
model_compression_toolkit/target_platform_capabilities/tpc_models/tflite_tpc/v1/tpc.py,sha256=
|
462
|
+
model_compression_toolkit/target_platform_capabilities/tpc_models/tflite_tpc/v1/tpc.py,sha256=sd1oN7mYH6fHqJwU2QZf6WU2NJ8EKzQ9-o4-JGU6Plc,12958
|
463
463
|
model_compression_toolkit/trainable_infrastructure/__init__.py,sha256=uewpvlPkH9mBFt8IxoAgIfz6iEcvWbOImm_fb6_BxD8,1543
|
464
464
|
model_compression_toolkit/trainable_infrastructure/common/__init__.py,sha256=huHoBUcKNB6BnY6YaUCcFvdyBtBI172ZoUD8ZYeNc6o,696
|
465
465
|
model_compression_toolkit/trainable_infrastructure/common/annealing_schedulers.py,sha256=qm2_wa61nga08Jdcl3RkgTsJ0zyHNjZ_A6I2--oVOig,2455
|
@@ -524,8 +524,8 @@ model_compression_toolkit/xquant/pytorch/model_analyzer.py,sha256=b93o800yVB3Z-i
|
|
524
524
|
model_compression_toolkit/xquant/pytorch/pytorch_report_utils.py,sha256=UVN_S9ULHBEldBpShCOt8-soT8YTQ5oE362y96qF_FA,3950
|
525
525
|
model_compression_toolkit/xquant/pytorch/similarity_functions.py,sha256=CERxq5K8rqaiE-DlwhZBTUd9x69dtYJlkHOPLB54vm8,2354
|
526
526
|
model_compression_toolkit/xquant/pytorch/tensorboard_utils.py,sha256=mkoEktLFFHtEKzzFRn_jCnxjhJolK12TZ5AQeDHzUO8,9767
|
527
|
-
mct_nightly-2.3.0.
|
528
|
-
mct_nightly-2.3.0.
|
529
|
-
mct_nightly-2.3.0.
|
530
|
-
mct_nightly-2.3.0.
|
531
|
-
mct_nightly-2.3.0.
|
527
|
+
mct_nightly-2.3.0.20250305.525.dist-info/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
|
528
|
+
mct_nightly-2.3.0.20250305.525.dist-info/METADATA,sha256=j5IdMOj7semfwR2QSpcpSMLkgaHDz_eFO3RDO1vXohk,27079
|
529
|
+
mct_nightly-2.3.0.20250305.525.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
530
|
+
mct_nightly-2.3.0.20250305.525.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
|
531
|
+
mct_nightly-2.3.0.20250305.525.dist-info/RECORD,,
|
@@ -27,4 +27,4 @@ from model_compression_toolkit import data_generation
|
|
27
27
|
from model_compression_toolkit import pruning
|
28
28
|
from model_compression_toolkit.trainable_infrastructure.keras.load_model import keras_load_quantized_model
|
29
29
|
|
30
|
-
__version__ = "2.3.0.
|
30
|
+
__version__ = "2.3.0.20250305.000525"
|
@@ -16,7 +16,6 @@ import numpy as np
|
|
16
16
|
|
17
17
|
from model_compression_toolkit.core import ResourceUtilization, FrameworkInfo
|
18
18
|
from model_compression_toolkit.core.common import Graph
|
19
|
-
from model_compression_toolkit.logger import Logger
|
20
19
|
from model_compression_toolkit.target_platform_capabilities.targetplatform2framework.framework_quantization_capabilities import \
|
21
20
|
FrameworkQuantizationCapabilities
|
22
21
|
|
@@ -48,31 +47,23 @@ def filter_candidates_for_mixed_precision(graph: Graph,
|
|
48
47
|
if tru.weight_restricted() and not tru.activation_restricted():
|
49
48
|
# Running mixed precision for weights compression only -
|
50
49
|
# filter out candidates activation only configurable node
|
51
|
-
|
52
|
-
activation_configurable_nodes = [n for n in graph.get_activation_configurable_nodes() if n not in weights_conf]
|
50
|
+
activation_configurable_nodes = [n for n in graph.get_activation_configurable_nodes()]
|
53
51
|
for n in activation_configurable_nodes:
|
54
52
|
base_cfg_nbits = n.get_qco(fqc).base_config.activation_n_bits
|
55
53
|
filtered_conf = [c for c in n.candidates_quantization_cfg if
|
56
54
|
c.activation_quantization_cfg.enable_activation_quantization and
|
57
55
|
c.activation_quantization_cfg.activation_n_bits == base_cfg_nbits]
|
58
56
|
|
59
|
-
if len(filtered_conf) != 1:
|
60
|
-
Logger.critical(f"Running weights only mixed precision failed on layer {n.name} with multiple "
|
61
|
-
f"activation quantization configurations.") # pragma: no cover
|
62
57
|
n.candidates_quantization_cfg = filtered_conf
|
63
58
|
|
64
59
|
elif tru.activation_restricted() and not tru.weight_restricted():
|
65
60
|
# Running mixed precision for activation compression only -
|
66
61
|
# filter out candidates weights only configurable node
|
67
|
-
|
68
|
-
weight_configurable_nodes = [n for n in graph.get_weights_configurable_nodes(fw_info) if n not in activation_conf]
|
62
|
+
weight_configurable_nodes = [n for n in graph.get_weights_configurable_nodes(fw_info)]
|
69
63
|
for n in weight_configurable_nodes:
|
70
|
-
kernel_attr =
|
64
|
+
kernel_attr = fw_info.get_kernel_op_attributes(n.type)[0]
|
71
65
|
base_cfg_nbits = n.get_qco(fqc).base_config.attr_weights_configs_mapping[kernel_attr].weights_n_bits
|
72
66
|
filtered_conf = [c for c in n.candidates_quantization_cfg if
|
73
67
|
c.weights_quantization_cfg.get_attr_config(kernel_attr).enable_weights_quantization and
|
74
68
|
c.weights_quantization_cfg.get_attr_config(kernel_attr).weights_n_bits == base_cfg_nbits]
|
75
|
-
if len(filtered_conf) != 1:
|
76
|
-
Logger.critical(f"Running activation only mixed precision failed on layer {n.name} with multiple "
|
77
|
-
f"weights quantization configurations.") # pragma: no cover
|
78
69
|
n.candidates_quantization_cfg = filtered_conf
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
# ==============================================================================
|
15
15
|
|
16
|
-
from typing import List
|
16
|
+
from typing import List, Tuple, Dict
|
17
17
|
|
18
18
|
from model_compression_toolkit.core import ResourceUtilization
|
19
19
|
from model_compression_toolkit.core.common.mixed_precision.mixed_precision_search_manager import \
|
@@ -21,7 +21,6 @@ from model_compression_toolkit.core.common.mixed_precision.mixed_precision_searc
|
|
21
21
|
from model_compression_toolkit.core.common.quantization.candidate_node_quantization_config import \
|
22
22
|
CandidateNodeQuantizationConfig
|
23
23
|
from model_compression_toolkit.logger import Logger
|
24
|
-
import numpy as np
|
25
24
|
|
26
25
|
|
27
26
|
def greedy_solution_refinement_procedure(mp_solution: List[int],
|
@@ -68,9 +67,11 @@ def greedy_solution_refinement_procedure(mp_solution: List[int],
|
|
68
67
|
node_candidates = current_node.candidates_quantization_cfg
|
69
68
|
|
70
69
|
# only weights kernel attribute is quantized with weights mixed precision
|
71
|
-
|
72
|
-
|
73
|
-
|
70
|
+
valid_candidates = _get_valid_candidates_indices(node_candidates,
|
71
|
+
new_solution[node_idx],
|
72
|
+
target_resource_utilization.activation_restricted(),
|
73
|
+
target_resource_utilization.weight_restricted()
|
74
|
+
)
|
74
75
|
|
75
76
|
# Create a list of ru for the valid candidates.
|
76
77
|
updated_ru = []
|
@@ -108,40 +109,81 @@ def greedy_solution_refinement_procedure(mp_solution: List[int],
|
|
108
109
|
return new_solution
|
109
110
|
|
110
111
|
|
111
|
-
def _get_valid_candidates_indices(
|
112
|
-
|
113
|
-
|
112
|
+
def _get_valid_candidates_indices(
|
113
|
+
node_candidates: List[CandidateNodeQuantizationConfig],
|
114
|
+
current_chosen_index: int,
|
115
|
+
is_activation_restricted: bool,
|
116
|
+
is_weight_restricted: bool
|
117
|
+
) -> List[int]:
|
114
118
|
"""
|
115
|
-
Find node's valid candidates to
|
116
|
-
|
117
|
-
|
119
|
+
Find node's valid candidates to improve the node's MP chosen candidate.
|
120
|
+
|
121
|
+
Valid indices are indices of candidates that have a higher number of bits for both
|
122
|
+
weights and activations. In cases where weights or activations are not restricted (thus,
|
123
|
+
we do not search for an MP solution for them), a candidate is considered to be
|
124
|
+
valid only if the bit-width of the part that is not eligible for MP has equal bit-width
|
125
|
+
to the current candidate.
|
118
126
|
|
119
127
|
Args:
|
120
|
-
node_candidates:
|
121
|
-
current_chosen_index:
|
122
|
-
|
128
|
+
node_candidates (List[CandidateNodeQuantizationConfig]): List of candidate configurations for the node.
|
129
|
+
current_chosen_index (int): Index of the currently chosen candidate in the list.
|
130
|
+
is_activation_restricted (bool): Indicates whether activation resources are restricted.
|
131
|
+
is_weight_restricted (bool): Indicates whether weight resources are restricted.
|
132
|
+
|
123
133
|
|
124
134
|
Returns:
|
125
|
-
List of indices of valid candidates.
|
135
|
+
List[int]: List of indices of valid candidates.
|
126
136
|
"""
|
137
|
+
|
138
|
+
def get_candidate_bits(candidate: CandidateNodeQuantizationConfig) -> Tuple[Dict[str, int], int]:
|
139
|
+
"""
|
140
|
+
Extract weight and activation bits from a candidate.
|
141
|
+
|
142
|
+
Args:
|
143
|
+
candidate (CandidateNodeQuantizationConfig): A candidate node configuration.
|
144
|
+
|
145
|
+
Returns:
|
146
|
+
Tuple[Dict[str, int], int]:
|
147
|
+
- A dictionary mapping weight attributes to their bit-widths.
|
148
|
+
- The activation bit-width.
|
149
|
+
"""
|
150
|
+
weight_attrs = candidate.weights_quantization_cfg.all_weight_attrs
|
151
|
+
weight_attrs_to_nbits: Dict[str, int] = {
|
152
|
+
w_attr: candidate.weights_quantization_cfg.get_attr_config(w_attr).weights_n_bits
|
153
|
+
for w_attr in weight_attrs
|
154
|
+
}
|
155
|
+
activation_n_bits: int = candidate.activation_quantization_cfg.activation_n_bits
|
156
|
+
return weight_attrs_to_nbits, activation_n_bits
|
157
|
+
|
158
|
+
def is_valid_candidate(candidate: CandidateNodeQuantizationConfig) -> bool:
|
159
|
+
"""
|
160
|
+
Check if a candidate satisfies the weight and activation bit-width constraints to be
|
161
|
+
considered as a valid candidate.
|
162
|
+
|
163
|
+
Args:
|
164
|
+
candidate (CandidateNodeQuantizationConfig): A candidate node configuration.
|
165
|
+
|
166
|
+
Returns:
|
167
|
+
bool: True if the candidate is valid, False otherwise.
|
168
|
+
"""
|
169
|
+
candidate_weight_bits, candidate_activation_bits = get_candidate_bits(candidate)
|
170
|
+
|
171
|
+
# Current candidate - no need to check
|
172
|
+
if candidate_activation_bits == current_activation_bits and all(candidate_weight_bits[attr] == current_weight_bits[attr] for attr in current_weight_bits.keys()):
|
173
|
+
return False
|
174
|
+
|
175
|
+
valid_weight = all(
|
176
|
+
candidate_weight_bits[attr] >= current_weight_bits[attr] if is_weight_restricted else
|
177
|
+
candidate_weight_bits[attr] == current_weight_bits[attr]
|
178
|
+
for attr in current_weight_bits.keys()
|
179
|
+
)
|
180
|
+
valid_activation = (
|
181
|
+
candidate_activation_bits >= current_activation_bits if is_activation_restricted else
|
182
|
+
candidate_activation_bits == current_activation_bits
|
183
|
+
)
|
184
|
+
return valid_weight and valid_activation
|
185
|
+
|
127
186
|
current_candidate = node_candidates[current_chosen_index]
|
187
|
+
current_weight_bits, current_activation_bits = get_candidate_bits(current_candidate)
|
128
188
|
|
129
|
-
|
130
|
-
# In this node we only quantize activation, so no need to check weights number of bits
|
131
|
-
activation_num_bits = current_candidate.activation_quantization_cfg.activation_n_bits
|
132
|
-
|
133
|
-
# Filter candidates that have higher bit-width for activations
|
134
|
-
return [i for i, c in enumerate(node_candidates) if
|
135
|
-
c.activation_quantization_cfg.activation_n_bits >= activation_num_bits
|
136
|
-
and not (c.activation_quantization_cfg.activation_n_bits == activation_num_bits)]
|
137
|
-
else:
|
138
|
-
weights_num_bits = current_candidate.weights_quantization_cfg.get_attr_config(kernel_attr).weights_n_bits
|
139
|
-
activation_num_bits = current_candidate.activation_quantization_cfg.activation_n_bits
|
140
|
-
|
141
|
-
# Filter candidates that have higher bit-width for both weights and activations (except for the current index).
|
142
|
-
# TODO: activation bits comparison: should be >= if ACTIVATION or TOTAL ru is used. else should be ==.
|
143
|
-
return [i for i, c in enumerate(node_candidates) if
|
144
|
-
c.activation_quantization_cfg.activation_n_bits == activation_num_bits
|
145
|
-
and c.weights_quantization_cfg.get_attr_config(kernel_attr).weights_n_bits >= weights_num_bits
|
146
|
-
and not (c.activation_quantization_cfg.activation_n_bits == activation_num_bits
|
147
|
-
and c.weights_quantization_cfg.get_attr_config(kernel_attr).weights_n_bits == weights_num_bits)]
|
189
|
+
return [idx for idx, candidate in enumerate(node_candidates) if is_valid_candidate(candidate)]
|
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/attach2pytorch.py
CHANGED
@@ -70,7 +70,7 @@ class AttachTpcToPytorch(AttachTpcToFramework):
|
|
70
70
|
OperatorSetNames.HARDSWISH: [Hardswish, hardswish],
|
71
71
|
OperatorSetNames.FLATTEN: [Flatten, flatten],
|
72
72
|
OperatorSetNames.GET_ITEM: [operator.getitem],
|
73
|
-
OperatorSetNames.RESHAPE: [reshape],
|
73
|
+
OperatorSetNames.RESHAPE: [reshape, torch.Tensor.view],
|
74
74
|
OperatorSetNames.UNSQUEEZE: [unsqueeze],
|
75
75
|
OperatorSetNames.SQUEEZE: [squeeze],
|
76
76
|
OperatorSetNames.PERMUTE: [permute],
|
@@ -137,6 +137,7 @@ def generate_tpc(default_config: OpQuantizationConfig,
|
|
137
137
|
# If the QuantizationConfigOptions contains only one configuration,
|
138
138
|
# this configuration will be used for the operation quantization:
|
139
139
|
default_configuration_options = schema.QuantizationConfigOptions(quantization_configurations=tuple([default_config]))
|
140
|
+
base_configuration_options = schema.QuantizationConfigOptions(quantization_configurations=tuple([base_config]), base_config=base_config)
|
140
141
|
|
141
142
|
# In TFLite, the quantized operator specifications constraint operators quantization
|
142
143
|
# differently. For more details:
|
@@ -179,13 +180,13 @@ def generate_tpc(default_config: OpQuantizationConfig,
|
|
179
180
|
qc_options=default_configuration_options.clone_and_edit(
|
180
181
|
fixed_zero_point=-128, fixed_scale=1 / 256))
|
181
182
|
fc = schema.OperatorsSet(name=schema.OperatorSetNames.FULLY_CONNECTED,
|
182
|
-
qc_options=
|
183
|
+
qc_options=base_configuration_options.clone_and_edit_weight_attribute(
|
183
184
|
weights_per_channel_threshold=False))
|
184
185
|
squeeze = schema.OperatorsSet(name=schema.OperatorSetNames.SQUEEZE,
|
185
186
|
qc_options=default_configuration_options.clone_and_edit(
|
186
187
|
quantization_preserving=True))
|
187
188
|
|
188
|
-
conv2d = schema.OperatorsSet(name=schema.OperatorSetNames.CONV)
|
189
|
+
conv2d = schema.OperatorsSet(name=schema.OperatorSetNames.CONV, qc_options=base_configuration_options)
|
189
190
|
relu = schema.OperatorsSet(name=schema.OperatorSetNames.RELU)
|
190
191
|
relu6 = schema.OperatorsSet(name=schema.OperatorSetNames.RELU6)
|
191
192
|
elu = schema.OperatorsSet(name=schema.OperatorSetNames.ELU)
|
{mct_nightly-2.3.0.20250303.547.dist-info → mct_nightly-2.3.0.20250305.525.dist-info}/LICENSE.md
RENAMED
File without changes
|
File without changes
|
{mct_nightly-2.3.0.20250303.547.dist-info → mct_nightly-2.3.0.20250305.525.dist-info}/top_level.txt
RENAMED
File without changes
|