ai-edge-quantizer-nightly 0.3.0.dev20250807__py3-none-any.whl → 0.3.0.dev20250809__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.
- ai_edge_quantizer/algorithm_manager.py +4 -0
- ai_edge_quantizer/algorithms/uniform_quantize/common_quantize.py +31 -0
- ai_edge_quantizer/default_policy.py +5 -2
- ai_edge_quantizer/qtyping.py +2 -0
- ai_edge_quantizer/utils/tfl_flatbuffer_utils.py +2 -0
- {ai_edge_quantizer_nightly-0.3.0.dev20250807.dist-info → ai_edge_quantizer_nightly-0.3.0.dev20250809.dist-info}/METADATA +1 -1
- {ai_edge_quantizer_nightly-0.3.0.dev20250807.dist-info → ai_edge_quantizer_nightly-0.3.0.dev20250809.dist-info}/RECORD +10 -10
- {ai_edge_quantizer_nightly-0.3.0.dev20250807.dist-info → ai_edge_quantizer_nightly-0.3.0.dev20250809.dist-info}/LICENSE +0 -0
- {ai_edge_quantizer_nightly-0.3.0.dev20250807.dist-info → ai_edge_quantizer_nightly-0.3.0.dev20250809.dist-info}/WHEEL +0 -0
- {ai_edge_quantizer_nightly-0.3.0.dev20250807.dist-info → ai_edge_quantizer_nightly-0.3.0.dev20250809.dist-info}/top_level.txt +0 -0
@@ -120,6 +120,8 @@ MIN_MAX_OP_NAME_MATERIALIZE_FUNC_DICT = {
|
|
120
120
|
_TFLOpName.BROADCAST_TO: common_quantize.materialize_broadcast_to,
|
121
121
|
_TFLOpName.SQRT: common_quantize.materialize_sqrt,
|
122
122
|
_TFLOpName.GATHER: common_quantize.materialize_gather,
|
123
|
+
_TFLOpName.HARD_SWISH: common_quantize.materialize_hard_swish,
|
124
|
+
_TFLOpName.MAXIMUM: common_quantize.materialize_maximum,
|
123
125
|
}
|
124
126
|
for op_name, materialize_func in MIN_MAX_OP_NAME_MATERIALIZE_FUNC_DICT.items():
|
125
127
|
register_quantized_op(
|
@@ -266,6 +268,8 @@ _OCTAV_OP_NAME_MATERIALIZE_FUNC_DICT = immutabledict({
|
|
266
268
|
_TFLOpName.BROADCAST_TO: common_quantize.materialize_broadcast_to,
|
267
269
|
_TFLOpName.SQRT: common_quantize.materialize_sqrt,
|
268
270
|
_TFLOpName.GATHER: common_quantize.materialize_gather,
|
271
|
+
_TFLOpName.HARD_SWISH: common_quantize.materialize_hard_swish,
|
272
|
+
_TFLOpName.MAXIMUM: common_quantize.materialize_maximum,
|
269
273
|
})
|
270
274
|
|
271
275
|
for op_name, materialize_func in _OCTAV_OP_NAME_MATERIALIZE_FUNC_DICT.items():
|
@@ -762,6 +762,22 @@ def materialize_gather_nd(
|
|
762
762
|
)
|
763
763
|
|
764
764
|
|
765
|
+
def materialize_maximum(
|
766
|
+
get_tensor_quant_params_fn: qtyping.GetTensorQuantParamsFuncSignature,
|
767
|
+
op_info: qtyping.OpInfo,
|
768
|
+
graph_info: qtyping.GraphInfo,
|
769
|
+
tensor_name_to_qsv: dict[str, Any],
|
770
|
+
) -> list[qtyping.TensorTransformationParams]:
|
771
|
+
"""Materialize tensors in tfl.maximum."""
|
772
|
+
return common_utils.materialize_standard_op(
|
773
|
+
op_info,
|
774
|
+
graph_info,
|
775
|
+
tensor_name_to_qsv,
|
776
|
+
get_tensor_quant_params_fn,
|
777
|
+
constraint=_OpQuantConstraint.SAME_AS_OUTPUT_SCALE,
|
778
|
+
)
|
779
|
+
|
780
|
+
|
765
781
|
def materialize_pack(
|
766
782
|
get_tensor_quant_params_fn: qtyping.GetTensorQuantParamsFuncSignature,
|
767
783
|
op_info: qtyping.OpInfo,
|
@@ -841,6 +857,21 @@ def materialize_sqrt(
|
|
841
857
|
)
|
842
858
|
|
843
859
|
|
860
|
+
def materialize_hard_swish(
|
861
|
+
get_tensor_quant_params_fn: qtyping.GetTensorQuantParamsFuncSignature,
|
862
|
+
op_info: qtyping.OpInfo,
|
863
|
+
graph_info: qtyping.GraphInfo,
|
864
|
+
tensor_name_to_qsv: dict[str, Any],
|
865
|
+
) -> list[qtyping.TensorTransformationParams]:
|
866
|
+
"""Materialize tensors in tfl.hard_swish."""
|
867
|
+
return common_utils.materialize_standard_op(
|
868
|
+
op_info,
|
869
|
+
graph_info,
|
870
|
+
tensor_name_to_qsv,
|
871
|
+
get_tensor_quant_params_fn,
|
872
|
+
)
|
873
|
+
|
874
|
+
|
844
875
|
def materialize_gather(
|
845
876
|
get_tensor_quant_params_fn: qtyping.GetTensorQuantParamsFuncSignature,
|
846
877
|
op_info: qtyping.OpInfo,
|
@@ -193,7 +193,8 @@ DEFAULT_JSON_POLICY = """
|
|
193
193
|
"DIV",
|
194
194
|
"BROADCAST_TO",
|
195
195
|
"SQRT",
|
196
|
-
"GATHER"
|
196
|
+
"GATHER",
|
197
|
+
"MAXIMUM"
|
197
198
|
],
|
198
199
|
"static_wi8_ai8": [
|
199
200
|
"ADD",
|
@@ -235,7 +236,9 @@ DEFAULT_JSON_POLICY = """
|
|
235
236
|
"DIV",
|
236
237
|
"BROADCAST_TO",
|
237
238
|
"SQRT",
|
238
|
-
"GATHER"
|
239
|
+
"GATHER",
|
240
|
+
"HARD_SWISH",
|
241
|
+
"MAXIMUM"
|
239
242
|
],
|
240
243
|
"static_wi4_ai8": ["FULLY_CONNECTED", "CONV_2D", "INPUT", "OUTPUT", "EMBEDDING_LOOKUP"],
|
241
244
|
"static_wi4_ai16": ["FULLY_CONNECTED", "CONV_2D", "INPUT", "OUTPUT", "EMBEDDING_LOOKUP"],
|
ai_edge_quantizer/qtyping.py
CHANGED
@@ -67,6 +67,8 @@ TFL_OP_NAME_TO_CODE = immutabledict.immutabledict({
|
|
67
67
|
_TFLOpName.BROADCAST_TO: schema.BuiltinOperator.BROADCAST_TO,
|
68
68
|
_TFLOpName.SQRT: schema.BuiltinOperator.SQRT,
|
69
69
|
_TFLOpName.GATHER: schema.BuiltinOperator.GATHER,
|
70
|
+
_TFLOpName.HARD_SWISH: schema.BuiltinOperator.HARD_SWISH,
|
71
|
+
_TFLOpName.MAXIMUM: schema.BuiltinOperator.MAXIMUM,
|
70
72
|
})
|
71
73
|
|
72
74
|
TFL_OP_CODE_TO_NAME = immutabledict.immutabledict(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ai-edge-quantizer-nightly
|
3
|
-
Version: 0.3.0.
|
3
|
+
Version: 0.3.0.dev20250809
|
4
4
|
Summary: A quantizer for advanced developers to quantize converted AI Edge models.
|
5
5
|
Home-page: https://github.com/google-ai-edge/ai-edge-quantizer
|
6
6
|
Keywords: On-Device ML,AI,Google,TFLite,Quantization,LLMs,GenAI
|
@@ -1,18 +1,18 @@
|
|
1
1
|
ai_edge_quantizer/__init__.py,sha256=4pFSkukSwahYyzwqia0yPRyz8TnFQfGRthVJhYpMWas,793
|
2
|
-
ai_edge_quantizer/algorithm_manager.py,sha256=
|
2
|
+
ai_edge_quantizer/algorithm_manager.py,sha256=wiX9MTXUEMyUnhQv06EVFtLgFgM6gWCezGUXKotnPPU,13306
|
3
3
|
ai_edge_quantizer/algorithm_manager_api.py,sha256=u903TG0s1uIDhJqfeJne3CFl8A93phZrwgV2-hwdcXU,9247
|
4
4
|
ai_edge_quantizer/algorithm_manager_api_test.py,sha256=w6bSONvXkX6bzXAGc0-7b6gNDt9oz9ieq97KP8Sg_JU,7666
|
5
5
|
ai_edge_quantizer/calibrator.py,sha256=Sms7_AIHPH9G5xFaz5Ef3a5gPhxuIWQI8d2LUM8C96I,12071
|
6
6
|
ai_edge_quantizer/calibrator_test.py,sha256=ejKc5YC7id8J1Ll9HAYCzMnKzxd0FUENSD06zkSSV0c,11900
|
7
7
|
ai_edge_quantizer/conftest.py,sha256=SxCz-5LlRD_lQm4hQc4c6IGG7DS8d7IyEWY9gnscPN0,794
|
8
|
-
ai_edge_quantizer/default_policy.py,sha256=
|
8
|
+
ai_edge_quantizer/default_policy.py,sha256=OyWc3fm5A7L28VjMag50yNbQXWJ7GX17JMpwn_pz1GA,11524
|
9
9
|
ai_edge_quantizer/model_modifier.py,sha256=teGa8I6kGvn6TQY6Xv53YFIc_pQEhNvM9Zb4bvhezyw,7110
|
10
10
|
ai_edge_quantizer/model_modifier_test.py,sha256=cJd04SLOG-fQZZNZPcisoBLx3cLtWEwGqUBbLb-pif4,4751
|
11
11
|
ai_edge_quantizer/model_validator.py,sha256=Hj0_5o-Oa3dSlJ3ryVjRhvsyelHNyek1GrtG9buMczg,13153
|
12
12
|
ai_edge_quantizer/model_validator_test.py,sha256=EeqOP_mrZsnZ3rug756s0ryDDqd2KgIDld5Lm_gDuWY,13020
|
13
13
|
ai_edge_quantizer/params_generator.py,sha256=hcgMHJlERZERUyIAEi6AHJcLJ8gsKIBAEojzFFz-tqk,20098
|
14
14
|
ai_edge_quantizer/params_generator_test.py,sha256=RDYoRZDJfEZRtjlTAU2kZ_4t3JHOqEHxfJX9V4ETAhg,40597
|
15
|
-
ai_edge_quantizer/qtyping.py,sha256=
|
15
|
+
ai_edge_quantizer/qtyping.py,sha256=62OjOcIPV477bICisjU822L6EtnFoJV0kmWgVSrJxXg,16772
|
16
16
|
ai_edge_quantizer/quantizer.py,sha256=WeKwhh8cYZ07DUwvS0S1EdNzEZSfPODlynqIBvJ-Br4,13624
|
17
17
|
ai_edge_quantizer/quantizer_test.py,sha256=K_HBA56JkFI3HL8VLWCqGEfC0ISh5ldMKoNyBdGRAJg,20368
|
18
18
|
ai_edge_quantizer/recipe.py,sha256=FR0uJceumZrnle2VRSOQZ1uXup4S1cTYKRH-N53mWRo,2919
|
@@ -28,7 +28,7 @@ ai_edge_quantizer/algorithms/nonlinear_quantize/__init__.py,sha256=lpq1g2ayg3lCP
|
|
28
28
|
ai_edge_quantizer/algorithms/nonlinear_quantize/float_casting.py,sha256=Bs9CK7wZAw6jNaZ8xEtbwO2vM34VYXNZSMVWvxJo9nw,9297
|
29
29
|
ai_edge_quantizer/algorithms/nonlinear_quantize/float_casting_test.py,sha256=EqIHGEZ1LgUrTN7zf880RuAzEv3Qy7kgh5ivObJGHSo,22646
|
30
30
|
ai_edge_quantizer/algorithms/uniform_quantize/__init__.py,sha256=lpq1g2ayg3lCPLy79t2VicYcnGKw64FfYIj1V7J-4m8,676
|
31
|
-
ai_edge_quantizer/algorithms/uniform_quantize/common_quantize.py,sha256=
|
31
|
+
ai_edge_quantizer/algorithms/uniform_quantize/common_quantize.py,sha256=7H_QHhFKqVxGjhYp-_MXMAUR_VBk2kpATbta9EdhId0,34749
|
32
32
|
ai_edge_quantizer/algorithms/uniform_quantize/common_quantize_test.py,sha256=GGf_n3wIeg3GB_eGsmyNJ0fTcxgpeMMbugTMRONK6TQ,3553
|
33
33
|
ai_edge_quantizer/algorithms/uniform_quantize/dequantized_weight_recovery.py,sha256=BDdn_uBZakfHyzdMJPKadsOqxqyC-s6W2ZzFH99L4fE,8652
|
34
34
|
ai_edge_quantizer/algorithms/uniform_quantize/dequantized_weight_recovery_test.py,sha256=sT5eX5TLZEHTtPfnSkCPDlS0sQxlTFWbCsbvOuj--yY,8889
|
@@ -62,14 +62,14 @@ ai_edge_quantizer/utils/__init__.py,sha256=lpq1g2ayg3lCPLy79t2VicYcnGKw64FfYIj1V
|
|
62
62
|
ai_edge_quantizer/utils/calibration_utils.py,sha256=e3dG7Nm94Ix0hkTWTWPUhEG6a8QR_cAM3PSwblfJV5g,15106
|
63
63
|
ai_edge_quantizer/utils/calibration_utils_test.py,sha256=4BlksXl7b4yptL8xPR67hmJCnjhN9V10a2PunzfHrUE,9372
|
64
64
|
ai_edge_quantizer/utils/test_utils.py,sha256=a4Nk-wbeB09dFjTDZiA0K67d26j5DD0UDH_GIVmVG_4,8685
|
65
|
-
ai_edge_quantizer/utils/tfl_flatbuffer_utils.py,sha256=
|
65
|
+
ai_edge_quantizer/utils/tfl_flatbuffer_utils.py,sha256=5QcNk7VTpVJzHhj6wuU4kN-nO609oFvRWVD-9Jbdky0,11330
|
66
66
|
ai_edge_quantizer/utils/tfl_flatbuffer_utils_test.py,sha256=K1SbK8q92qYVtiVj0I0GtugsPTkpIpEKv9zakvFV_Sc,8555
|
67
67
|
ai_edge_quantizer/utils/tfl_interpreter_utils.py,sha256=EoVjI_hplX_Rml3hfRsGmQOihexmizeJqt4SQcET9aA,14925
|
68
68
|
ai_edge_quantizer/utils/tfl_interpreter_utils_test.py,sha256=6fjkM-rycZ95L4yfvlr0TN6RlrhfPzxNUYrZaYO_F0A,12013
|
69
69
|
ai_edge_quantizer/utils/validation_utils.py,sha256=oYw33Sg547AqtGw-choPUJmp9SAKkV46J_ddqSsum2Q,3950
|
70
70
|
ai_edge_quantizer/utils/validation_utils_test.py,sha256=V_qNDikPD4OPB-siOLQCWNVWTAu87h2IgNYt7teFd-o,2934
|
71
|
-
ai_edge_quantizer_nightly-0.3.0.
|
72
|
-
ai_edge_quantizer_nightly-0.3.0.
|
73
|
-
ai_edge_quantizer_nightly-0.3.0.
|
74
|
-
ai_edge_quantizer_nightly-0.3.0.
|
75
|
-
ai_edge_quantizer_nightly-0.3.0.
|
71
|
+
ai_edge_quantizer_nightly-0.3.0.dev20250809.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
72
|
+
ai_edge_quantizer_nightly-0.3.0.dev20250809.dist-info/METADATA,sha256=VYQT_1Vr6nrwr2KhtHiA2YpwtU2ZPWCks1bBeZLy09U,1528
|
73
|
+
ai_edge_quantizer_nightly-0.3.0.dev20250809.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
74
|
+
ai_edge_quantizer_nightly-0.3.0.dev20250809.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
|
75
|
+
ai_edge_quantizer_nightly-0.3.0.dev20250809.dist-info/RECORD,,
|
File without changes
|
File without changes
|