ai-edge-quantizer-nightly 0.3.0.dev20250618__py3-none-any.whl → 0.3.0.dev20250619__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.
- ai_edge_quantizer/algorithms/uniform_quantize/uniform_quantize_tensor.py +5 -9
- ai_edge_quantizer/algorithms/uniform_quantize/uniform_quantize_tensor_test.py +2 -6
- {ai_edge_quantizer_nightly-0.3.0.dev20250618.dist-info → ai_edge_quantizer_nightly-0.3.0.dev20250619.dist-info}/METADATA +1 -1
- {ai_edge_quantizer_nightly-0.3.0.dev20250618.dist-info → ai_edge_quantizer_nightly-0.3.0.dev20250619.dist-info}/RECORD +7 -7
- {ai_edge_quantizer_nightly-0.3.0.dev20250618.dist-info → ai_edge_quantizer_nightly-0.3.0.dev20250619.dist-info}/LICENSE +0 -0
- {ai_edge_quantizer_nightly-0.3.0.dev20250618.dist-info → ai_edge_quantizer_nightly-0.3.0.dev20250619.dist-info}/WHEEL +0 -0
- {ai_edge_quantizer_nightly-0.3.0.dev20250618.dist-info → ai_edge_quantizer_nightly-0.3.0.dev20250619.dist-info}/top_level.txt +0 -0
@@ -435,8 +435,7 @@ def _is_valid_quantization_params(
|
|
435
435
|
"""Checks if the quantization parameters are valid.
|
436
436
|
|
437
437
|
A valid quantization params requires:
|
438
|
-
1. scale and zero point
|
439
|
-
scalar.
|
438
|
+
1. scale and zero point have the same shape (TFL Runtime requirement).
|
440
439
|
2. scale and zero point have the same rank as the tensor content (avoid
|
441
440
|
ambiguous broadcasting).
|
442
441
|
|
@@ -447,20 +446,17 @@ def _is_valid_quantization_params(
|
|
447
446
|
Returns:
|
448
447
|
True if the quantization parameters are valid.
|
449
448
|
"""
|
450
|
-
if
|
451
|
-
quantization_params.scale.shape != quantization_params.zero_point.shape
|
452
|
-
and quantization_params.zero_point.size != 1
|
453
|
-
):
|
449
|
+
if quantization_params.scale.shape != quantization_params.zero_point.shape:
|
454
450
|
raise ValueError(
|
455
|
-
"scale and zero_point must have the same shape
|
456
|
-
f"
|
451
|
+
"scale and zero_point must have the same shape. Got"
|
452
|
+
f" {quantization_params.scale.shape} and"
|
457
453
|
f" {quantization_params.zero_point.shape}"
|
458
454
|
)
|
459
455
|
|
460
456
|
tensor_rank = tensor_data.ndim
|
461
457
|
scale_rank = quantization_params.scale.ndim
|
462
458
|
zero_point_rank = quantization_params.zero_point.ndim
|
463
|
-
if tensor_rank != scale_rank or (tensor_rank != zero_point_rank):
|
459
|
+
if (tensor_rank != scale_rank) or (tensor_rank != zero_point_rank):
|
464
460
|
raise ValueError(
|
465
461
|
f"Ranks of scales ({scale_rank}) and zps"
|
466
462
|
f" ({zero_point_rank}) must be the same as the tensor rank"
|
@@ -160,9 +160,7 @@ class TensorUtilsTest(parameterized.TestCase):
|
|
160
160
|
def test_uniform_quantize_wrong_shape(self):
|
161
161
|
tensor = [-3.0, 1.3, 2.4, 16.0]
|
162
162
|
|
163
|
-
error_message =
|
164
|
-
"Ranks of scales (3) and zps (2) must be the same as the tensor rank"
|
165
|
-
)
|
163
|
+
error_message = "scale and zero_point must have the same shape."
|
166
164
|
with self.assertRaisesWithPredicateMatch(
|
167
165
|
ValueError, lambda err: error_message in str(err)
|
168
166
|
):
|
@@ -235,9 +233,7 @@ class TensorUtilsTest(parameterized.TestCase):
|
|
235
233
|
def test_uniform_dequantize_wrong_shape(self):
|
236
234
|
tensor = [-3.0, 1.3, 2.4, 16.0]
|
237
235
|
|
238
|
-
error_message =
|
239
|
-
"Ranks of scales (3) and zps (2) must be the same as the tensor rank"
|
240
|
-
)
|
236
|
+
error_message = "scale and zero_point must have the same shape."
|
241
237
|
with self.assertRaisesWithPredicateMatch(
|
242
238
|
ValueError, lambda err: error_message in str(err)
|
243
239
|
):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ai-edge-quantizer-nightly
|
3
|
-
Version: 0.3.0.
|
3
|
+
Version: 0.3.0.dev20250619
|
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
|
@@ -38,8 +38,8 @@ ai_edge_quantizer/algorithms/uniform_quantize/naive_min_max_quantize.py,sha256=8
|
|
38
38
|
ai_edge_quantizer/algorithms/uniform_quantize/naive_min_max_quantize_test.py,sha256=zoF_EHjYqsKkuev8wfuutIITEmp_maa70IpJI_Df3ck,7431
|
39
39
|
ai_edge_quantizer/algorithms/uniform_quantize/octav.py,sha256=Umxh4kJyeHddZf-Wd4aXE5MTI1XWFa5KRuM17uYU714,6922
|
40
40
|
ai_edge_quantizer/algorithms/uniform_quantize/octav_test.py,sha256=sha1d99Xk87bI87tgz0g5LeDC-EeE4WMfM5rRC98-m4,9140
|
41
|
-
ai_edge_quantizer/algorithms/uniform_quantize/uniform_quantize_tensor.py,sha256=
|
42
|
-
ai_edge_quantizer/algorithms/uniform_quantize/uniform_quantize_tensor_test.py,sha256=
|
41
|
+
ai_edge_quantizer/algorithms/uniform_quantize/uniform_quantize_tensor.py,sha256=W2QbXP96xeleAmA7qFwco1iq_bOtArGDK6Qj_g6kNl8,15986
|
42
|
+
ai_edge_quantizer/algorithms/uniform_quantize/uniform_quantize_tensor_test.py,sha256=MgG7Qh2_z4I6InBqEEDSVlaR0q48aMz4xqAlxeG2EMk,12436
|
43
43
|
ai_edge_quantizer/algorithms/utils/__init__.py,sha256=lpq1g2ayg3lCPLy79t2VicYcnGKw64FfYIj1V7J-4m8,676
|
44
44
|
ai_edge_quantizer/algorithms/utils/common_utils.py,sha256=UoZxeAQmZk3b3hK51KFwq6XfdbeduXVjdYIxAxlAzB8,34982
|
45
45
|
ai_edge_quantizer/algorithms/utils/common_utils_test.py,sha256=zqapGEfYhjQWe9cNGPLmdbwtEUUYQRhlO_kNe0cXX6E,18104
|
@@ -70,8 +70,8 @@ ai_edge_quantizer/utils/tfl_interpreter_utils.py,sha256=EtOv6cpKM_F0uv2bWuSXylYm
|
|
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.3.0.
|
74
|
-
ai_edge_quantizer_nightly-0.3.0.
|
75
|
-
ai_edge_quantizer_nightly-0.3.0.
|
76
|
-
ai_edge_quantizer_nightly-0.3.0.
|
77
|
-
ai_edge_quantizer_nightly-0.3.0.
|
73
|
+
ai_edge_quantizer_nightly-0.3.0.dev20250619.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
74
|
+
ai_edge_quantizer_nightly-0.3.0.dev20250619.dist-info/METADATA,sha256=_1ICby0AKllEQdwCpKgxbguZWlBDy6vIyrNOJ7LhR7s,1528
|
75
|
+
ai_edge_quantizer_nightly-0.3.0.dev20250619.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
76
|
+
ai_edge_quantizer_nightly-0.3.0.dev20250619.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
|
77
|
+
ai_edge_quantizer_nightly-0.3.0.dev20250619.dist-info/RECORD,,
|
File without changes
|
File without changes
|