ai-edge-quantizer-nightly 0.3.0.dev20250706__py3-none-any.whl → 0.3.0.dev20250708__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.
@@ -114,6 +114,8 @@ MIN_MAX_OP_NAME_MATERIALIZE_FUNC_DICT = {
114
114
  _TFLOpName.MAX_POOL_2D: common_quantize.materialize_max_pool_2d,
115
115
  _TFLOpName.RESIZE_BILINEAR: common_quantize.materialize_resize_bilinear,
116
116
  _TFLOpName.GATHER_ND: common_quantize.materialize_gather_nd,
117
+ _TFLOpName.PACK: common_quantize.materialize_pack,
118
+ _TFLOpName.UNPACK: common_quantize.materialize_unpack,
117
119
  }
118
120
  for op_name, materialize_func in MIN_MAX_OP_NAME_MATERIALIZE_FUNC_DICT.items():
119
121
  register_quantized_op(
@@ -254,6 +256,8 @@ _OCTAV_OP_NAME_MATERIALIZE_FUNC_DICT = immutabledict({
254
256
  _TFLOpName.MAX_POOL_2D: common_quantize.materialize_max_pool_2d,
255
257
  _TFLOpName.RESIZE_BILINEAR: common_quantize.materialize_resize_bilinear,
256
258
  _TFLOpName.GATHER_ND: common_quantize.materialize_gather_nd,
259
+ _TFLOpName.PACK: common_quantize.materialize_pack,
260
+ _TFLOpName.UNPACK: common_quantize.materialize_unpack,
257
261
  })
258
262
 
259
263
  for op_name, materialize_func in _OCTAV_OP_NAME_MATERIALIZE_FUNC_DICT.items():
@@ -762,6 +762,38 @@ def materialize_gather_nd(
762
762
  )
763
763
 
764
764
 
765
+ def materialize_pack(
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.pack."""
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
+
781
+ def materialize_unpack(
782
+ get_tensor_quant_params_fn: qtyping.GetTensorQuantParamsFuncSignature,
783
+ op_info: qtyping.OpInfo,
784
+ graph_info: qtyping.GraphInfo,
785
+ tensor_name_to_qsv: dict[str, Any],
786
+ ) -> list[qtyping.TensorTransformationParams]:
787
+ """Materialize tensors in tfl.unpack."""
788
+ return common_utils.materialize_standard_op(
789
+ op_info,
790
+ graph_info,
791
+ tensor_name_to_qsv,
792
+ get_tensor_quant_params_fn,
793
+ constraint=_OpQuantConstraint.SAME_AS_INPUT_SCALE,
794
+ )
795
+
796
+
765
797
  def _get_tensor_shape_for_blockwise(
766
798
  tensor_shape: Sequence[int], quantized_dim: int, block_size: int
767
799
  ) -> list[int]:
@@ -187,7 +187,9 @@ DEFAULT_JSON_POLICY = """
187
187
  "PAD",
188
188
  "MAX_POOL_2D",
189
189
  "RESIZE_BILINEAR",
190
- "GATHER_ND"
190
+ "GATHER_ND",
191
+ "PACK",
192
+ "UNPACK"
191
193
  ],
192
194
  "static_wi8_ai8": [
193
195
  "ADD",
@@ -223,7 +225,9 @@ DEFAULT_JSON_POLICY = """
223
225
  "SQUARED_DIFFERENCE",
224
226
  "MAX_POOL_2D",
225
227
  "RESIZE_BILINEAR",
226
- "GATHER_ND"
228
+ "GATHER_ND",
229
+ "PACK",
230
+ "UNPACK"
227
231
  ],
228
232
  "static_wi4_ai8": ["FULLY_CONNECTED", "CONV_2D", "INPUT", "OUTPUT", "EMBEDDING_LOOKUP"],
229
233
  "static_wi4_ai16": ["FULLY_CONNECTED", "CONV_2D", "INPUT", "OUTPUT", "EMBEDDING_LOOKUP"],
@@ -67,6 +67,8 @@ class TFLOperationName(str, enum.Enum):
67
67
  MAX_POOL_2D = 'MAX_POOL_2D'
68
68
  RESIZE_BILINEAR = 'RESIZE_BILINEAR'
69
69
  GATHER_ND = 'GATHER_ND'
70
+ PACK = 'PACK'
71
+ UNPACK = 'UNPACK'
70
72
 
71
73
 
72
74
  class QuantizeMode(enum.Enum):
@@ -61,6 +61,8 @@ TFL_OP_NAME_TO_CODE = immutabledict.immutabledict({
61
61
  _TFLOpName.MAX_POOL_2D: schema.BuiltinOperator.MAX_POOL_2D,
62
62
  _TFLOpName.RESIZE_BILINEAR: schema.BuiltinOperator.RESIZE_BILINEAR,
63
63
  _TFLOpName.GATHER_ND: schema.BuiltinOperator.GATHER_ND,
64
+ _TFLOpName.PACK: schema.BuiltinOperator.PACK,
65
+ _TFLOpName.UNPACK: schema.BuiltinOperator.UNPACK,
64
66
  })
65
67
 
66
68
  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.dev20250706
3
+ Version: 0.3.0.dev20250708
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=UZVS6ZClIAyaX9RzhXvvymbQv_scR0ybMPYl2CgSPVo,12346
2
+ ai_edge_quantizer/algorithm_manager.py,sha256=-a3FMPJ-mLG20v5wO1CbzJryLlbWqqvTzxdyt0CafX0,12574
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=C_oWOaRugPKYX74jF-eRFH-k6nGOdA8I9_uPiocaOuE,11900
7
7
  ai_edge_quantizer/conftest.py,sha256=SxCz-5LlRD_lQm4hQc4c6IGG7DS8d7IyEWY9gnscPN0,794
8
- ai_edge_quantizer/default_policy.py,sha256=0Am2TrgyV7gNl7dbul07rVp58OKDuPyJW9SIqRTrD2g,11280
8
+ ai_edge_quantizer/default_policy.py,sha256=HHOPkBxuPP5NO-aLfqKCKyrmoZJ4vKT16vwn4d5BOFA,11340
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=gC7G6Ne4Fumc8RSmIAbx96ZBhszZlHqBKSmE9p6RPTo,20099
14
14
  ai_edge_quantizer/params_generator_test.py,sha256=RDYoRZDJfEZRtjlTAU2kZ_4t3JHOqEHxfJX9V4ETAhg,40597
15
- ai_edge_quantizer/qtyping.py,sha256=vq-9jwDViSndHhcC1_RVu2Bk0qu5MgYPGLTRO9z2Naw,16604
15
+ ai_edge_quantizer/qtyping.py,sha256=uCguCckBh9QTnsyCw-EX8IbXROAA5fwZ21_iX5Yu0z8,16640
16
16
  ai_edge_quantizer/quantizer.py,sha256=g3DMqFMrMpt9jQttCE0WcdNbMtk0JZnmN5MmCHrNdyM,13202
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=juXQWnzBTvasxydeDTNxWuE9ag9j6GOmfHMjC4JQu1Y,30799
31
+ ai_edge_quantizer/algorithms/uniform_quantize/common_quantize.py,sha256=uvPe3QGSMZSeVfHCt2DXhXf_iX7Gu4H-pDmlC_2p34E,31788
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=spqUmSNciOKPQHCBkHE7Zo34eMFq_BfBCAnMT3jAulU,8615
65
- ai_edge_quantizer/utils/tfl_flatbuffer_utils.py,sha256=NnD57Gkx9upNP8Mso-_yp8Z3x1AqlIWb06jPg-hyRkc,10890
65
+ ai_edge_quantizer/utils/tfl_flatbuffer_utils.py,sha256=7r3XL2Gq44yQy6dY6mTr4YcP77nNZr2hHJmjFT74ar0,10994
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=vTyy6-4PgfFPL3C8uTq_iPFBwdxCjhrWzUiec4DdFPw,14323
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.dev20250706.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
72
- ai_edge_quantizer_nightly-0.3.0.dev20250706.dist-info/METADATA,sha256=iiEScWmdrSZaglFLj1hTPr3uioD5sqiGPDnXMg74QZA,1528
73
- ai_edge_quantizer_nightly-0.3.0.dev20250706.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
74
- ai_edge_quantizer_nightly-0.3.0.dev20250706.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
75
- ai_edge_quantizer_nightly-0.3.0.dev20250706.dist-info/RECORD,,
71
+ ai_edge_quantizer_nightly-0.3.0.dev20250708.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
72
+ ai_edge_quantizer_nightly-0.3.0.dev20250708.dist-info/METADATA,sha256=DhGkV9cMtiSijHzCcRuSGrNoGioKczIzcwBKiy5A16g,1528
73
+ ai_edge_quantizer_nightly-0.3.0.dev20250708.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
74
+ ai_edge_quantizer_nightly-0.3.0.dev20250708.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
75
+ ai_edge_quantizer_nightly-0.3.0.dev20250708.dist-info/RECORD,,