ai-edge-quantizer-nightly 0.4.0.dev20250916__py3-none-any.whl → 0.4.0.dev20250918__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.
@@ -125,6 +125,8 @@ MIN_MAX_OP_NAME_MATERIALIZE_FUNC_DICT = {
125
125
  _TFLOpName.MAXIMUM: common_quantize.materialize_maximum,
126
126
  _TFLOpName.PADV2: common_quantize.materialize_padv2,
127
127
  _TFLOpName.REDUCE_MIN: common_quantize.materialize_reduce_min,
128
+ _TFLOpName.EQUAL: common_quantize.materialize_equal,
129
+ _TFLOpName.NOT_EQUAL: common_quantize.materialize_not_equal,
128
130
  }
129
131
  for op_name, materialize_func in MIN_MAX_OP_NAME_MATERIALIZE_FUNC_DICT.items():
130
132
  register_quantized_op(
@@ -276,6 +278,8 @@ _OCTAV_OP_NAME_MATERIALIZE_FUNC_DICT = immutabledict({
276
278
  _TFLOpName.MAXIMUM: common_quantize.materialize_maximum,
277
279
  _TFLOpName.PADV2: common_quantize.materialize_padv2,
278
280
  _TFLOpName.REDUCE_MIN: common_quantize.materialize_reduce_min,
281
+ _TFLOpName.EQUAL: common_quantize.materialize_equal,
282
+ _TFLOpName.NOT_EQUAL: common_quantize.materialize_not_equal,
279
283
  })
280
284
 
281
285
  for op_name, materialize_func in _OCTAV_OP_NAME_MATERIALIZE_FUNC_DICT.items():
@@ -957,6 +957,36 @@ def materialize_reduce_min(
957
957
  )
958
958
 
959
959
 
960
+ def materialize_equal(
961
+ get_tensor_quant_params_fn: qtyping.GetTensorQuantParamsFuncSignature,
962
+ op_info: qtyping.OpInfo,
963
+ graph_info: qtyping.GraphInfo,
964
+ tensor_name_to_qsv: dict[str, Any],
965
+ ) -> list[qtyping.TensorTransformationParams]:
966
+ """Materialize tensors in tfl.equal."""
967
+ return common_utils.materialize_standard_op(
968
+ op_info,
969
+ graph_info,
970
+ tensor_name_to_qsv,
971
+ get_tensor_quant_params_fn,
972
+ )
973
+
974
+
975
+ def materialize_not_equal(
976
+ get_tensor_quant_params_fn: qtyping.GetTensorQuantParamsFuncSignature,
977
+ op_info: qtyping.OpInfo,
978
+ graph_info: qtyping.GraphInfo,
979
+ tensor_name_to_qsv: dict[str, Any],
980
+ ) -> list[qtyping.TensorTransformationParams]:
981
+ """Materialize tensors in tfl.not_equal."""
982
+ return common_utils.materialize_standard_op(
983
+ op_info,
984
+ graph_info,
985
+ tensor_name_to_qsv,
986
+ get_tensor_quant_params_fn,
987
+ )
988
+
989
+
960
990
  def _get_tensor_shape_for_blockwise(
961
991
  tensor_shape: Sequence[int], quantized_dim: int, block_size: int
962
992
  ) -> list[int]:
@@ -197,7 +197,9 @@ DEFAULT_JSON_POLICY = """
197
197
  "GATHER",
198
198
  "MAXIMUM",
199
199
  "PADV2",
200
- "REDUCE_MIN"
200
+ "REDUCE_MIN",
201
+ "EQUAL",
202
+ "NOT_EQUAL"
201
203
  ],
202
204
  "static_wi8_ai8": [
203
205
  "ADD",
@@ -244,7 +246,9 @@ DEFAULT_JSON_POLICY = """
244
246
  "HARD_SWISH",
245
247
  "MAXIMUM",
246
248
  "PADV2",
247
- "REDUCE_MIN"
249
+ "REDUCE_MIN",
250
+ "EQUAL",
251
+ "NOT_EQUAL"
248
252
  ],
249
253
  "static_wi4_ai8": ["FULLY_CONNECTED", "CONV_2D", "INPUT", "OUTPUT", "EMBEDDING_LOOKUP"],
250
254
  "static_wi4_ai16": ["FULLY_CONNECTED", "CONV_2D", "INPUT", "OUTPUT", "EMBEDDING_LOOKUP"],
@@ -78,6 +78,8 @@ class TFLOperationName(str, enum.Enum):
78
78
  MAXIMUM = 'MAXIMUM'
79
79
  PADV2 = 'PADV2'
80
80
  REDUCE_MIN = 'REDUCE_MIN'
81
+ EQUAL = 'EQUAL'
82
+ NOT_EQUAL = 'NOT_EQUAL'
81
83
 
82
84
 
83
85
  class QuantizeMode(enum.Enum):
@@ -38,7 +38,7 @@ class ConstrainedOpsUtilsTest(parameterized.TestCase):
38
38
  dict(
39
39
  testcase_name="no_constrain",
40
40
  constraint=_OpQuantConstraint.NO_CONSTRAIN,
41
- expected_num_ops=22,
41
+ expected_num_ops=24,
42
42
  ),
43
43
  )
44
44
  def test_get_constrained_op_list(self, constraint, expected_num_ops):
@@ -72,6 +72,8 @@ TFL_OP_NAME_TO_CODE = immutabledict.immutabledict({
72
72
  _TFLOpName.MAXIMUM: schema.BuiltinOperator.MAXIMUM,
73
73
  _TFLOpName.PADV2: schema.BuiltinOperator.PADV2,
74
74
  _TFLOpName.REDUCE_MIN: schema.BuiltinOperator.REDUCE_MIN,
75
+ _TFLOpName.EQUAL: schema.BuiltinOperator.EQUAL,
76
+ _TFLOpName.NOT_EQUAL: schema.BuiltinOperator.NOT_EQUAL,
75
77
  })
76
78
 
77
79
  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.dev20250916
3
+ Version: 0.4.0.dev20250918
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=zRDIOmtVdyRfCJdMOi-f3b7LcXiiKUIbMFj005A-HYs,13672
2
+ ai_edge_quantizer/algorithm_manager.py,sha256=Xu2JKUUayFE5O3-nQPKvQ-0xjqtqPM8ITXgR7BDugN0,13916
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=LljWT-fvoEIK-cJLS0c6tKg60C-zGhVT6JtBlzqtoAI,11662
8
+ ai_edge_quantizer/default_policy.py,sha256=wiwBENR6uwZjFmIdDFwzzuciC_tyy9hXtHNndHmDiBY,11730
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=O952DgvdE4YwvWeDk5nIdYssrP8aFT4fgNT2eUbEwJg,16838
15
+ ai_edge_quantizer/qtyping.py,sha256=tfrPip-uzJuF_PASgUExx5Oy9gghWUbQaApR0XaBpNw,16882
16
16
  ai_edge_quantizer/quantizer.py,sha256=ckAEOnnBxuCKZuvlzdChevCKPuE-IeDPHCNtFTWr250,17857
17
17
  ai_edge_quantizer/quantizer_test.py,sha256=m6f4ayyaF3yQb9i4V0aFAbmGw0OKZ2Zam1RoTPh-u24,22917
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=7VvH9torbs6O3VZhfsKhr5x1JvdKZ9xrX7IYPBg9Bss,37064
31
+ ai_edge_quantizer/algorithms/uniform_quantize/common_quantize.py,sha256=E17cSR-MoUoAgAVIKLMfrjONmqibwOPRLsD521h1Gh0,37946
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,16 +62,16 @@ ai_edge_quantizer/utils/__init__.py,sha256=lpq1g2ayg3lCPLy79t2VicYcnGKw64FfYIj1V
62
62
  ai_edge_quantizer/utils/calibration_utils.py,sha256=iMf_bSCf-O86MzDt5D9hLKqbTydqLwirluaC6BJ9yHo,11553
63
63
  ai_edge_quantizer/utils/calibration_utils_test.py,sha256=4BlksXl7b4yptL8xPR67hmJCnjhN9V10a2PunzfHrUE,9372
64
64
  ai_edge_quantizer/utils/constrained_ops_utils.py,sha256=EAITCf7Ku_PFZcw3K-wd-8hGbyuRd5W5UtNdGvalwAE,4478
65
- ai_edge_quantizer/utils/constrained_ops_utils_test.py,sha256=TA6bwVyJP_HlGLJzysMpI_kTsdKeMxZ4RP7HLRU98KY,1756
65
+ ai_edge_quantizer/utils/constrained_ops_utils_test.py,sha256=5vWIzWRI-uPi7OBppc8rMXNX32Ph4d5IvXGstOHMV3Y,1756
66
66
  ai_edge_quantizer/utils/test_utils.py,sha256=a4Nk-wbeB09dFjTDZiA0K67d26j5DD0UDH_GIVmVG_4,8685
67
- ai_edge_quantizer/utils/tfl_flatbuffer_utils.py,sha256=tCNv2sY8j8P0WD7u8AO7yDgA5IKOvO6BU1xl3SJ33KU,11832
67
+ ai_edge_quantizer/utils/tfl_flatbuffer_utils.py,sha256=anbxbIKS7t8iIkJZJH7AkAR18xYWLtKTzVJ6tVD4DXQ,11944
68
68
  ai_edge_quantizer/utils/tfl_flatbuffer_utils_test.py,sha256=K1SbK8q92qYVtiVj0I0GtugsPTkpIpEKv9zakvFV_Sc,8555
69
69
  ai_edge_quantizer/utils/tfl_interpreter_utils.py,sha256=EoVjI_hplX_Rml3hfRsGmQOihexmizeJqt4SQcET9aA,14925
70
70
  ai_edge_quantizer/utils/tfl_interpreter_utils_test.py,sha256=6fjkM-rycZ95L4yfvlr0TN6RlrhfPzxNUYrZaYO_F0A,12013
71
71
  ai_edge_quantizer/utils/validation_utils.py,sha256=oYw33Sg547AqtGw-choPUJmp9SAKkV46J_ddqSsum2Q,3950
72
72
  ai_edge_quantizer/utils/validation_utils_test.py,sha256=V_qNDikPD4OPB-siOLQCWNVWTAu87h2IgNYt7teFd-o,2934
73
- ai_edge_quantizer_nightly-0.4.0.dev20250916.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
74
- ai_edge_quantizer_nightly-0.4.0.dev20250916.dist-info/METADATA,sha256=1YcyXu4IkOzPWTKzcBYiA3UlG90lo3ziAjR5lxCKmy4,1508
75
- ai_edge_quantizer_nightly-0.4.0.dev20250916.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
76
- ai_edge_quantizer_nightly-0.4.0.dev20250916.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
77
- ai_edge_quantizer_nightly-0.4.0.dev20250916.dist-info/RECORD,,
73
+ ai_edge_quantizer_nightly-0.4.0.dev20250918.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
74
+ ai_edge_quantizer_nightly-0.4.0.dev20250918.dist-info/METADATA,sha256=wE3gJlGT2MljsCRbwt5lKyFGtjVl7RgbdoLuvTwVXJk,1508
75
+ ai_edge_quantizer_nightly-0.4.0.dev20250918.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
76
+ ai_edge_quantizer_nightly-0.4.0.dev20250918.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
77
+ ai_edge_quantizer_nightly-0.4.0.dev20250918.dist-info/RECORD,,