ai-edge-quantizer-nightly 0.4.0.dev20251013__py3-none-any.whl → 0.4.0.dev20251014__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.
@@ -132,6 +132,7 @@ MIN_MAX_OP_NAME_MATERIALIZE_FUNC_DICT = {
132
132
  _TFLOpName.EQUAL: common_quantize.materialize_equal,
133
133
  _TFLOpName.NOT_EQUAL: common_quantize.materialize_not_equal,
134
134
  _TFLOpName.MIRROR_PAD: common_quantize.materialize_mirror_pad,
135
+ _TFLOpName.SPACE_TO_DEPTH: common_quantize.materialize_space_to_depth,
135
136
  }
136
137
  for op_name, materialize_func in MIN_MAX_OP_NAME_MATERIALIZE_FUNC_DICT.items():
137
138
  register_quantized_op(
@@ -286,6 +287,7 @@ _OCTAV_OP_NAME_MATERIALIZE_FUNC_DICT = immutabledict({
286
287
  _TFLOpName.EQUAL: common_quantize.materialize_equal,
287
288
  _TFLOpName.NOT_EQUAL: common_quantize.materialize_not_equal,
288
289
  _TFLOpName.MIRROR_PAD: common_quantize.materialize_mirror_pad,
290
+ _TFLOpName.SPACE_TO_DEPTH: common_quantize.materialize_space_to_depth,
289
291
  })
290
292
 
291
293
  for op_name, materialize_func in _OCTAV_OP_NAME_MATERIALIZE_FUNC_DICT.items():
@@ -776,6 +776,33 @@ def materialize_mirror_pad(
776
776
  )
777
777
 
778
778
 
779
+ def materialize_space_to_depth(
780
+ get_tensor_quant_params_fn: qtyping.GetTensorQuantParamsFuncSignature,
781
+ op_info: qtyping.OpInfo,
782
+ graph_info: qtyping.GraphInfo,
783
+ tensor_name_to_qsv: dict[str, Any],
784
+ ) -> list[qtyping.TensorTransformationParams]:
785
+ """Materialize tensors in tfl.space_to_depth.
786
+
787
+ Args:
788
+ get_tensor_quant_params_fn: Function to get quantization parameters for the
789
+ tensor.
790
+ op_info: Aggregated information about the op (e.g., quantization config).
791
+ graph_info: Graph information needed to perform quantization for the op.
792
+ tensor_name_to_qsv: A map of tensor name to quantization parameters.
793
+
794
+ Returns:
795
+ A list of `qtyping.TensorTransformationParams` for the tensors in the op.
796
+ """
797
+ return common_utils.materialize_standard_op(
798
+ op_info,
799
+ graph_info,
800
+ tensor_name_to_qsv,
801
+ get_tensor_quant_params_fn,
802
+ constraint=_OpQuantConstraint.SAME_AS_INPUT_SCALE,
803
+ )
804
+
805
+
779
806
  def materialize_squared_difference(
780
807
  get_tensor_quant_params_fn: qtyping.GetTensorQuantParamsFuncSignature,
781
808
  op_info: qtyping.OpInfo,
@@ -248,7 +248,8 @@ DEFAULT_JSON_POLICY = """
248
248
  "REDUCE_MIN",
249
249
  "EQUAL",
250
250
  "NOT_EQUAL",
251
- "MIRROR_PAD"
251
+ "MIRROR_PAD",
252
+ "SPACE_TO_DEPTH"
252
253
  ],
253
254
  "static_wi4_ai8": ["FULLY_CONNECTED", "CONV_2D", "INPUT", "OUTPUT"],
254
255
  "static_wi4_ai16": ["FULLY_CONNECTED", "CONV_2D", "INPUT", "OUTPUT"],
@@ -81,6 +81,7 @@ class TFLOperationName(str, enum.Enum):
81
81
  EQUAL = 'EQUAL'
82
82
  NOT_EQUAL = 'NOT_EQUAL'
83
83
  MIRROR_PAD = 'MIRROR_PAD'
84
+ SPACE_TO_DEPTH = 'SPACE_TO_DEPTH'
84
85
 
85
86
 
86
87
  class QuantizeMode(enum.Enum):
@@ -28,7 +28,7 @@ class ConstrainedOpsUtilsTest(parameterized.TestCase):
28
28
  dict(
29
29
  testcase_name="same_as_input_scale",
30
30
  constraint=_OpQuantConstraint.SAME_AS_INPUT_SCALE,
31
- expected_num_ops=16,
31
+ expected_num_ops=17,
32
32
  ),
33
33
  dict(
34
34
  testcase_name="same_as_output_scale",
@@ -75,6 +75,7 @@ TFL_OP_NAME_TO_CODE = immutabledict.immutabledict({
75
75
  _TFLOpName.EQUAL: schema.BuiltinOperator.EQUAL,
76
76
  _TFLOpName.NOT_EQUAL: schema.BuiltinOperator.NOT_EQUAL,
77
77
  _TFLOpName.MIRROR_PAD: schema.BuiltinOperator.MIRROR_PAD,
78
+ _TFLOpName.SPACE_TO_DEPTH: schema.BuiltinOperator.SPACE_TO_DEPTH,
78
79
  })
79
80
 
80
81
  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.4.0.dev20251013
3
+ Version: 0.4.0.dev20251014
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=Ri4bNqbSTmtlsYZiJYHtkjNEsl8h5tZ_1uV_stJ3HUY,16156
2
+ ai_edge_quantizer/algorithm_manager.py,sha256=Eev0uVw19oSPrpUJ4sU4CrorSC3h6bsiUEYCOJw1Hsk,16306
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=ZLzIMWB2FSFU4TOatDioYuwp_kLh8iSCefZ5_Q9FU7s,11900
7
7
  ai_edge_quantizer/conftest.py,sha256=SxCz-5LlRD_lQm4hQc4c6IGG7DS8d7IyEWY9gnscPN0,794
8
- ai_edge_quantizer/default_policy.py,sha256=DpQUe0ETpRtx2qWwvrj9pFAhfyEwES1mVTTak8kyPzM,11678
8
+ ai_edge_quantizer/default_policy.py,sha256=i_AcnIIElHqoJNc2jyJFEC2tYqfQ4Nvn4mQlTvormzk,11702
9
9
  ai_edge_quantizer/model_modifier.py,sha256=U70JByv6CItP8tg4bdyMfX-R3UlwylAGSviZkF_FSAM,10468
10
10
  ai_edge_quantizer/model_modifier_test.py,sha256=CV4pgMEQkBJr_qbYR720TO8HBCutbEYLHptDHgdQMUE,7274
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=0w-sDGk84sVNkXoduon1wDqq30sGOHVgBVbdg44QVF4,20153
14
14
  ai_edge_quantizer/params_generator_test.py,sha256=RDYoRZDJfEZRtjlTAU2kZ_4t3JHOqEHxfJX9V4ETAhg,40597
15
- ai_edge_quantizer/qtyping.py,sha256=rp2jdmCuSsP6Ay8rD7NxDCpbFkRNkbYP29Uwe0xBfnA,17196
15
+ ai_edge_quantizer/qtyping.py,sha256=f2NRz4xqM-7gMe0QFpR4x2m5lzTJI3tmsT0cehO5Vsg,17232
16
16
  ai_edge_quantizer/quantizer.py,sha256=teYeONdIS31IAY6ubLujCRi1t6lYAd0LkC8dRPxQdbw,18919
17
17
  ai_edge_quantizer/quantizer_test.py,sha256=9BVwt7oyM8IsSC7jN73nI0O-4MikBkymm_FigJnSeCM,27117
18
18
  ai_edge_quantizer/recipe.py,sha256=MEkfQ2Sg3KAE9LAORHWcbjYNPg06EUbwc1d-VspQA2U,6461
@@ -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=rUHraqNi0iJ0AyUQfAiYkyXG2rSy7GlhnqmwJeoLStg,38952
31
+ ai_edge_quantizer/algorithms/uniform_quantize/common_quantize.py,sha256=HF7aNccdDmCbZGZ21UxeO5UpSpQOLr3TiOEyLwWOVPQ,39888
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
@@ -66,16 +66,16 @@ ai_edge_quantizer/utils/__init__.py,sha256=lpq1g2ayg3lCPLy79t2VicYcnGKw64FfYIj1V
66
66
  ai_edge_quantizer/utils/calibration_utils.py,sha256=iMf_bSCf-O86MzDt5D9hLKqbTydqLwirluaC6BJ9yHo,11553
67
67
  ai_edge_quantizer/utils/calibration_utils_test.py,sha256=4BlksXl7b4yptL8xPR67hmJCnjhN9V10a2PunzfHrUE,9372
68
68
  ai_edge_quantizer/utils/constrained_ops_utils.py,sha256=EAITCf7Ku_PFZcw3K-wd-8hGbyuRd5W5UtNdGvalwAE,4478
69
- ai_edge_quantizer/utils/constrained_ops_utils_test.py,sha256=HNZstSm6-7xgSmM-7ilHRjuOKsq6tivpxayphm9Oghs,1756
69
+ ai_edge_quantizer/utils/constrained_ops_utils_test.py,sha256=i_uERo-KvMj0dvUSuI67kdOBHvRQETg8-qnejs_MgTE,1756
70
70
  ai_edge_quantizer/utils/test_utils.py,sha256=a4Nk-wbeB09dFjTDZiA0K67d26j5DD0UDH_GIVmVG_4,8685
71
- ai_edge_quantizer/utils/tfl_flatbuffer_utils.py,sha256=LN-WonrcJLP9bB4lULd5VIg_8YLTcp891ZuDZ5nDGe8,12006
71
+ ai_edge_quantizer/utils/tfl_flatbuffer_utils.py,sha256=42OWzQsRTXq3XQYmoxlz177_dw2fJfq7mDSJaU--ArQ,12076
72
72
  ai_edge_quantizer/utils/tfl_flatbuffer_utils_test.py,sha256=K1SbK8q92qYVtiVj0I0GtugsPTkpIpEKv9zakvFV_Sc,8555
73
73
  ai_edge_quantizer/utils/tfl_interpreter_utils.py,sha256=EoVjI_hplX_Rml3hfRsGmQOihexmizeJqt4SQcET9aA,14925
74
74
  ai_edge_quantizer/utils/tfl_interpreter_utils_test.py,sha256=6fjkM-rycZ95L4yfvlr0TN6RlrhfPzxNUYrZaYO_F0A,12013
75
75
  ai_edge_quantizer/utils/validation_utils.py,sha256=0sOdH4pzk_Pwh1r8O47iaECRng1Xn0ABn9GVc8UPNcY,4994
76
76
  ai_edge_quantizer/utils/validation_utils_test.py,sha256=1sblJWHLTYTbn1Qi9rwnrREOSXRy5KwHAWSwgI1e_aU,3697
77
- ai_edge_quantizer_nightly-0.4.0.dev20251013.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
78
- ai_edge_quantizer_nightly-0.4.0.dev20251013.dist-info/METADATA,sha256=_PaC8xPzMOnl2xLDR39RJ3OC--oC7tdJXwh3yRMA_5U,1508
79
- ai_edge_quantizer_nightly-0.4.0.dev20251013.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
80
- ai_edge_quantizer_nightly-0.4.0.dev20251013.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
81
- ai_edge_quantizer_nightly-0.4.0.dev20251013.dist-info/RECORD,,
77
+ ai_edge_quantizer_nightly-0.4.0.dev20251014.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
78
+ ai_edge_quantizer_nightly-0.4.0.dev20251014.dist-info/METADATA,sha256=TrlrIOhZNaILuX9hEN1mHXRXKNkHHZE2KubEuGV2oEQ,1508
79
+ ai_edge_quantizer_nightly-0.4.0.dev20251014.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
80
+ ai_edge_quantizer_nightly-0.4.0.dev20251014.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
81
+ ai_edge_quantizer_nightly-0.4.0.dev20251014.dist-info/RECORD,,