ai-edge-quantizer-nightly 0.1.0.dev20250502__py3-none-any.whl → 0.1.0.dev20250504__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.
@@ -416,12 +416,21 @@ def materialize_sum(
416
416
  tensor_name_to_qsv: dict[str, Any],
417
417
  ) -> list[qtyping.TensorTransformationParams]:
418
418
  """Materialize tensors in tfl.sum."""
419
+ # For 8 bits the reference kernel calls a function without input/output
420
+ # constraints. For all others it calls a function that enforces input/output
421
+ # scale/zero point checks. See:
422
+ # https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/kernels/reduce.cc#L909
423
+ activation_config = op_info.op_quant_config.activation_tensor_config
424
+ if activation_config is not None and activation_config.num_bits == 8:
425
+ constraint = _OpQuantConstraint.NO_CONSTRAIN
426
+ else:
427
+ constraint = _OpQuantConstraint.SAME_AS_INPUT_SCALE
419
428
  return common_utils.materialize_standard_op(
420
429
  op_info,
421
430
  graph_info,
422
431
  tensor_name_to_qsv,
423
432
  get_tensor_quant_params_fn,
424
- constraint=_OpQuantConstraint.SAME_AS_INPUT_SCALE,
433
+ constraint=constraint,
425
434
  inputs_to_ignore=[1], # Axis index does not need to be quantized.
426
435
  )
427
436
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ai-edge-quantizer-nightly
3
- Version: 0.1.0.dev20250502
3
+ Version: 0.1.0.dev20250504
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
@@ -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=s64eDDH9bmRWy6Bl1peHnhGewLnFJjvnhYOdjo1zYOA,22625
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=SVu1RSX5xOWhuNEi9hHqgIDGe_ywyHBZAczp7KAcl3k,27220
31
+ ai_edge_quantizer/algorithms/uniform_quantize/common_quantize.py,sha256=JyMuqVns3meKOA1DomXYopxqhZE65yamlVZjBF6yOmY,27731
32
32
  ai_edge_quantizer/algorithms/uniform_quantize/common_quantize_test.py,sha256=qMmKbWqxrCoVKbLKHn9WuCrGKPfHkEyU0Nmhokh8Qeo,2597
33
33
  ai_edge_quantizer/algorithms/uniform_quantize/dequantized_weight_recovery.py,sha256=Fk3s9Qy2A_hjUepFOUmTwIZ_wKYVPbdDX4eoP-eoAQU,8726
34
34
  ai_edge_quantizer/algorithms/uniform_quantize/dequantized_weight_recovery_test.py,sha256=sT5eX5TLZEHTtPfnSkCPDlS0sQxlTFWbCsbvOuj--yY,8889
@@ -66,8 +66,8 @@ ai_edge_quantizer/utils/tfl_interpreter_utils.py,sha256=WoewyiZpaua80oP0tpgyrw5W
66
66
  ai_edge_quantizer/utils/tfl_interpreter_utils_test.py,sha256=6fjkM-rycZ95L4yfvlr0TN6RlrhfPzxNUYrZaYO_F0A,12013
67
67
  ai_edge_quantizer/utils/validation_utils.py,sha256=oYw33Sg547AqtGw-choPUJmp9SAKkV46J_ddqSsum2Q,3950
68
68
  ai_edge_quantizer/utils/validation_utils_test.py,sha256=V_qNDikPD4OPB-siOLQCWNVWTAu87h2IgNYt7teFd-o,2934
69
- ai_edge_quantizer_nightly-0.1.0.dev20250502.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
70
- ai_edge_quantizer_nightly-0.1.0.dev20250502.dist-info/METADATA,sha256=QjTwOBeYtlLbghRB5usWTJyu32NStqk-p1-Pcnjskdk,1527
71
- ai_edge_quantizer_nightly-0.1.0.dev20250502.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
72
- ai_edge_quantizer_nightly-0.1.0.dev20250502.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
73
- ai_edge_quantizer_nightly-0.1.0.dev20250502.dist-info/RECORD,,
69
+ ai_edge_quantizer_nightly-0.1.0.dev20250504.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
70
+ ai_edge_quantizer_nightly-0.1.0.dev20250504.dist-info/METADATA,sha256=0fdBa5QnfTIETxfCMqiriPM_UbEUdszPQrS_aehi44w,1527
71
+ ai_edge_quantizer_nightly-0.1.0.dev20250504.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
72
+ ai_edge_quantizer_nightly-0.1.0.dev20250504.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
73
+ ai_edge_quantizer_nightly-0.1.0.dev20250504.dist-info/RECORD,,