ai-edge-quantizer-nightly 0.5.0.dev20251222__py3-none-any.whl → 0.5.0.dev20251223__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.
@@ -118,6 +118,9 @@ MIN_MAX_OP_NAME_MATERIALIZE_FUNC_DICT = {
118
118
  ),
119
119
  _TFLOpName.MAX_POOL_2D: common_quantize.materialize_max_pool_2d,
120
120
  _TFLOpName.RESIZE_BILINEAR: common_quantize.materialize_resize_bilinear,
121
+ _TFLOpName.RESIZE_NEAREST_NEIGHBOR: (
122
+ common_quantize.materialize_resize_nearest_neighbor
123
+ ),
121
124
  _TFLOpName.GATHER_ND: common_quantize.materialize_gather_nd,
122
125
  _TFLOpName.PACK: common_quantize.materialize_pack,
123
126
  _TFLOpName.UNPACK: common_quantize.materialize_unpack,
@@ -274,6 +277,9 @@ _OCTAV_OP_NAME_MATERIALIZE_FUNC_DICT = immutabledict({
274
277
  ),
275
278
  _TFLOpName.MAX_POOL_2D: common_quantize.materialize_max_pool_2d,
276
279
  _TFLOpName.RESIZE_BILINEAR: common_quantize.materialize_resize_bilinear,
280
+ _TFLOpName.RESIZE_NEAREST_NEIGHBOR: (
281
+ common_quantize.materialize_resize_nearest_neighbor
282
+ ),
277
283
  _TFLOpName.GATHER_ND: common_quantize.materialize_gather_nd,
278
284
  _TFLOpName.PACK: common_quantize.materialize_pack,
279
285
  _TFLOpName.UNPACK: common_quantize.materialize_unpack,
@@ -879,6 +879,23 @@ def materialize_resize_bilinear(
879
879
  )
880
880
 
881
881
 
882
+ def materialize_resize_nearest_neighbor(
883
+ get_tensor_quant_params_fn: qtyping.GetTensorQuantParamsFuncSignature,
884
+ op_info: qtyping.OpInfo,
885
+ graph_info: qtyping.GraphInfo,
886
+ tensor_name_to_qsv: dict[str, Any],
887
+ ) -> list[qtyping.TensorTransformationParams]:
888
+ """Materialize tensors in tfl.resize_nearest_neighbor."""
889
+ return common_utils.materialize_standard_op(
890
+ op_info,
891
+ graph_info,
892
+ tensor_name_to_qsv,
893
+ get_tensor_quant_params_fn,
894
+ constraint=_OpQuantConstraint.SAME_AS_INPUT_SCALE,
895
+ inputs_to_ignore=[1], # Resize size does not need to be quantized.
896
+ )
897
+
898
+
882
899
  def materialize_gather_nd(
883
900
  get_tensor_quant_params_fn: qtyping.GetTensorQuantParamsFuncSignature,
884
901
  op_info: qtyping.OpInfo,
@@ -186,6 +186,7 @@ DEFAULT_JSON_POLICY = """
186
186
  "PAD",
187
187
  "MAX_POOL_2D",
188
188
  "RESIZE_BILINEAR",
189
+ "RESIZE_NEAREST_NEIGHBOR",
189
190
  "GATHER_ND",
190
191
  "PACK",
191
192
  "UNPACK",
@@ -235,6 +236,7 @@ DEFAULT_JSON_POLICY = """
235
236
  "SQUARED_DIFFERENCE",
236
237
  "MAX_POOL_2D",
237
238
  "RESIZE_BILINEAR",
239
+ "RESIZE_NEAREST_NEIGHBOR",
238
240
  "GATHER_ND",
239
241
  "PACK",
240
242
  "UNPACK",
@@ -67,6 +67,7 @@ class TFLOperationName(str, enum.Enum):
67
67
  SQUARED_DIFFERENCE = 'SQUARED_DIFFERENCE'
68
68
  MAX_POOL_2D = 'MAX_POOL_2D'
69
69
  RESIZE_BILINEAR = 'RESIZE_BILINEAR'
70
+ RESIZE_NEAREST_NEIGHBOR = 'RESIZE_NEAREST_NEIGHBOR'
70
71
  GATHER_ND = 'GATHER_ND'
71
72
  PACK = 'PACK'
72
73
  UNPACK = 'UNPACK'
@@ -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=17,
31
+ expected_num_ops=18,
32
32
  ),
33
33
  dict(
34
34
  testcase_name="same_as_output_scale",
@@ -61,6 +61,9 @@ TFL_OP_NAME_TO_CODE = immutabledict.immutabledict({
61
61
  _TFLOpName.SQUARED_DIFFERENCE: schema.BuiltinOperator.SQUARED_DIFFERENCE,
62
62
  _TFLOpName.MAX_POOL_2D: schema.BuiltinOperator.MAX_POOL_2D,
63
63
  _TFLOpName.RESIZE_BILINEAR: schema.BuiltinOperator.RESIZE_BILINEAR,
64
+ _TFLOpName.RESIZE_NEAREST_NEIGHBOR: (
65
+ schema.BuiltinOperator.RESIZE_NEAREST_NEIGHBOR
66
+ ),
64
67
  _TFLOpName.GATHER_ND: schema.BuiltinOperator.GATHER_ND,
65
68
  _TFLOpName.PACK: schema.BuiltinOperator.PACK,
66
69
  _TFLOpName.UNPACK: schema.BuiltinOperator.UNPACK,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ai-edge-quantizer-nightly
3
- Version: 0.5.0.dev20251222
3
+ Version: 0.5.0.dev20251223
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=GuFls-3z23dk6wKxRDvmg2WI0uvAzCwbDDC3q5OXeVs,16628
2
+ ai_edge_quantizer/algorithm_manager.py,sha256=ZJcmIBREZ7maqxQbMkvwGaQhTxYWFHrdiqNF6c53Jb8,16846
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=nkHUmxdWy16Vw3EOD3B_7EkGiX8V-XJRXXFynweGfG8,9744
6
6
  ai_edge_quantizer/calibrator_test.py,sha256=c2ZCjl7PQYU9KtAovpDO9JX8sClgaLGO0P7oqoL6rP0,8830
7
7
  ai_edge_quantizer/conftest.py,sha256=SxCz-5LlRD_lQm4hQc4c6IGG7DS8d7IyEWY9gnscPN0,794
8
- ai_edge_quantizer/default_policy.py,sha256=POPuYzAXjNFZDGozZcvfxyUkiuT-8KMQ5SpGxAFB9xo,11365
8
+ ai_edge_quantizer/default_policy.py,sha256=ou__mTzh6hcrO2-_ZHxhOZjbVLAwNfCzckxcyISYRMc,11431
9
9
  ai_edge_quantizer/model_modifier.py,sha256=RxzfB1UULxLZlFEtgvFu0WrdTo7SLofc52KZchV_2vQ,10421
10
10
  ai_edge_quantizer/model_modifier_test.py,sha256=5vUCodVNk9GPcecjGwovV0677vD0BUZjfq9PGOnMEmM,7227
11
11
  ai_edge_quantizer/model_validator.py,sha256=mU6MLMvNQK7fxEJmh11H44OGnkUof0CVP6kYjb_du2A,13931
12
12
  ai_edge_quantizer/model_validator_test.py,sha256=EeqOP_mrZsnZ3rug756s0ryDDqd2KgIDld5Lm_gDuWY,13020
13
13
  ai_edge_quantizer/params_generator.py,sha256=-tbXB6crutiFhmLFEMe_-sxGylsvgd_cRZQ2fB67bNE,20436
14
14
  ai_edge_quantizer/params_generator_test.py,sha256=gJlq_qCPC0dWkbkyCpQiqAsmCYoWYxtxM2xYMEkrr3g,40436
15
- ai_edge_quantizer/qtyping.py,sha256=0AVvoCN0TPzbkSsE8bp3vb-b4hctZZ-q098cjnp46c8,18027
15
+ ai_edge_quantizer/qtyping.py,sha256=RPJTlcculzgx_QxAU6I_TS6JnJYTlqnx2WfxnLKK1dg,18081
16
16
  ai_edge_quantizer/quantizer.py,sha256=dgBkHR1VXuXzwKKdv7D39OL2z0ASp30xbN0vwFUX31M,19125
17
17
  ai_edge_quantizer/quantizer_test.py,sha256=6gcOLsZO-XW9VoKmcf_9CalG-_2lSUAe_fcmH2zHcoU,30167
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=XZ79vEVqUF7CGLC2M4PEbGFbdPKeMFmOpkyjdX2MCso,41468
31
+ ai_edge_quantizer/algorithms/uniform_quantize/common_quantize.py,sha256=_ItPnd2TXj95QimjiPaJOKcyfW_C5emIougygNTaZxA,42072
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=VjBDxGxjITHJc7xJABqBbZt6_qhobtZAl2gnVQrYJgc,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=dFDsjc3CXaDFNbCMyoPrMVubd3EDtG0ZwIY3Tmbb0sw,11506
67
67
  ai_edge_quantizer/utils/calibration_utils_test.py,sha256=jod4iokZkG00y9JrYaFzVvg4JwiA6mX8_whAMkNyoEc,9334
68
68
  ai_edge_quantizer/utils/constrained_ops_utils.py,sha256=z0sm1R9anRRVgdgI23XQKwDRcdARdpTo_6UBDB_lHXE,4502
69
- ai_edge_quantizer/utils/constrained_ops_utils_test.py,sha256=O0ull_vJeFlYG9Yl6L0IIJlx0Kn882xc4yl1uqA4-bo,1756
69
+ ai_edge_quantizer/utils/constrained_ops_utils_test.py,sha256=zmMIAS1WIvYK1Z9ZMMxYovIGtxfek-jvfZqrois1ahE,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=VeE8oYSnswXndKlvp8pCMvliKu_6g1liHV_kXg8TSlc,12063
71
+ ai_edge_quantizer/utils/tfl_flatbuffer_utils.py,sha256=3mngikx_lF-qKBc5KxGX-5kELH_XGKpeGjwUyR5dfZI,12167
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=ptdlC3WVUE9aBznT7kZQ0ZOk3EKgOBQdMDAaCdGedIM,15093
74
74
  ai_edge_quantizer/utils/tfl_interpreter_utils_test.py,sha256=EPOXbmXqbt3tAewo3BQQjh2mjuxrrFit5tkF0wUVYHU,12471
75
75
  ai_edge_quantizer/utils/validation_utils.py,sha256=Mr0D6X-pTDLODFAnCX3IlqdV1OL02tlq0ZjHbqx8nzg,7439
76
76
  ai_edge_quantizer/utils/validation_utils_test.py,sha256=T8K5mCWeMcihND2KS_dHvCJUU9lEdG2sD95EgPkaX3w,5584
77
- ai_edge_quantizer_nightly-0.5.0.dev20251222.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
78
- ai_edge_quantizer_nightly-0.5.0.dev20251222.dist-info/METADATA,sha256=EKijMBZI7W4jZHlaDODZJ0Pf6FR4Pvb6Tq-KOkFWaA4,1729
79
- ai_edge_quantizer_nightly-0.5.0.dev20251222.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
80
- ai_edge_quantizer_nightly-0.5.0.dev20251222.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
81
- ai_edge_quantizer_nightly-0.5.0.dev20251222.dist-info/RECORD,,
77
+ ai_edge_quantizer_nightly-0.5.0.dev20251223.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
78
+ ai_edge_quantizer_nightly-0.5.0.dev20251223.dist-info/METADATA,sha256=b73XsNez9eIcTWC-w_qxddRQo9YY-jOj_8UZZ4QDxPo,1729
79
+ ai_edge_quantizer_nightly-0.5.0.dev20251223.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
80
+ ai_edge_quantizer_nightly-0.5.0.dev20251223.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
81
+ ai_edge_quantizer_nightly-0.5.0.dev20251223.dist-info/RECORD,,