ai-edge-quantizer-nightly 0.4.0.dev20251028__py3-none-any.whl → 0.4.0.dev20251030__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 +6 -3
- ai_edge_quantizer/algorithms/uniform_quantize/uniform_quantize_tensor_test.py +4 -1
- {ai_edge_quantizer_nightly-0.4.0.dev20251028.dist-info → ai_edge_quantizer_nightly-0.4.0.dev20251030.dist-info}/METADATA +1 -1
- {ai_edge_quantizer_nightly-0.4.0.dev20251028.dist-info → ai_edge_quantizer_nightly-0.4.0.dev20251030.dist-info}/RECORD +7 -7
- {ai_edge_quantizer_nightly-0.4.0.dev20251028.dist-info → ai_edge_quantizer_nightly-0.4.0.dev20251030.dist-info}/LICENSE +0 -0
- {ai_edge_quantizer_nightly-0.4.0.dev20251028.dist-info → ai_edge_quantizer_nightly-0.4.0.dev20251030.dist-info}/WHEEL +0 -0
- {ai_edge_quantizer_nightly-0.4.0.dev20251028.dist-info → ai_edge_quantizer_nightly-0.4.0.dev20251030.dist-info}/top_level.txt +0 -0
|
@@ -381,10 +381,13 @@ def symmetric_quantize_bias_tensor(
|
|
|
381
381
|
quantized_vars = uniform_quantize(bias_content, bias_quant_params)
|
|
382
382
|
if check_error:
|
|
383
383
|
dequantized_bias = uniform_dequantize(quantized_vars, bias_quant_params)
|
|
384
|
-
|
|
385
|
-
|
|
384
|
+
max_quant_error = np.max(np.abs(dequantized_bias - bias_content))
|
|
385
|
+
error_tolerance = np.maximum(1e-6, np.max(effective_output_scale))
|
|
386
|
+
if max_quant_error > error_tolerance:
|
|
386
387
|
raise ValueError(
|
|
387
|
-
"Quantization error is too large for bias tensor quantization."
|
|
388
|
+
"Quantization error is too large for bias tensor quantization. Max"
|
|
389
|
+
f" quantization error is {max_quant_error}, which exceed"
|
|
390
|
+
f" the threshold {error_tolerance}"
|
|
388
391
|
)
|
|
389
392
|
|
|
390
393
|
# Save the int32 quantized bias as int64 if the input tensor is quantized to
|
|
@@ -431,7 +431,10 @@ class TensorUtilsTest(parameterized.TestCase):
|
|
|
431
431
|
)
|
|
432
432
|
# This will result in quantized bias of 3e9, which is larger than int32 max.
|
|
433
433
|
bias_tensor_data = np.array([3e7])
|
|
434
|
-
with self.
|
|
434
|
+
with self.assertRaisesRegex(
|
|
435
|
+
ValueError,
|
|
436
|
+
"Quantization error is too large for bias tensor quantization.",
|
|
437
|
+
):
|
|
435
438
|
uniform_quantize_tensor.symmetric_quantize_bias_tensor(
|
|
436
439
|
bias_tensor_data,
|
|
437
440
|
input_quant_config,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ai-edge-quantizer-nightly
|
|
3
|
-
Version: 0.4.0.
|
|
3
|
+
Version: 0.4.0.dev20251030
|
|
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
|
|
@@ -40,8 +40,8 @@ ai_edge_quantizer/algorithms/uniform_quantize/naive_min_max_quantize.py,sha256=1
|
|
|
40
40
|
ai_edge_quantizer/algorithms/uniform_quantize/naive_min_max_quantize_test.py,sha256=nscKDvNb14ErZdAfG0aXRWyRs6bTvhMqMjKx2vxvUK0,8725
|
|
41
41
|
ai_edge_quantizer/algorithms/uniform_quantize/octav.py,sha256=Umxh4kJyeHddZf-Wd4aXE5MTI1XWFa5KRuM17uYU714,6922
|
|
42
42
|
ai_edge_quantizer/algorithms/uniform_quantize/octav_test.py,sha256=sha1d99Xk87bI87tgz0g5LeDC-EeE4WMfM5rRC98-m4,9140
|
|
43
|
-
ai_edge_quantizer/algorithms/uniform_quantize/uniform_quantize_tensor.py,sha256=
|
|
44
|
-
ai_edge_quantizer/algorithms/uniform_quantize/uniform_quantize_tensor_test.py,sha256=
|
|
43
|
+
ai_edge_quantizer/algorithms/uniform_quantize/uniform_quantize_tensor.py,sha256=frGVia4J2cWxQZzo2bT8MxWnEF5zGLIHfn4nnrWt_no,19746
|
|
44
|
+
ai_edge_quantizer/algorithms/uniform_quantize/uniform_quantize_tensor_test.py,sha256=NjqvNYZBZYhaZFaWD2dmCNTQ92MmznqV-_kCCJ6UB-0,16032
|
|
45
45
|
ai_edge_quantizer/algorithms/utils/__init__.py,sha256=lpq1g2ayg3lCPLy79t2VicYcnGKw64FfYIj1V7J-4m8,676
|
|
46
46
|
ai_edge_quantizer/algorithms/utils/common_utils.py,sha256=4eAlGph6DDW18bUdoY0XcUoOXEr3P_3_W1ptidD8qK4,37611
|
|
47
47
|
ai_edge_quantizer/algorithms/utils/common_utils_test.py,sha256=zqapGEfYhjQWe9cNGPLmdbwtEUUYQRhlO_kNe0cXX6E,18104
|
|
@@ -74,8 +74,8 @@ ai_edge_quantizer/utils/tfl_interpreter_utils.py,sha256=EoVjI_hplX_Rml3hfRsGmQOi
|
|
|
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=QTYyQ_HDVrFTGPIsrA240Lv8tUw1fwWp2fu9kTVISkE,6224
|
|
76
76
|
ai_edge_quantizer/utils/validation_utils_test.py,sha256=lO51rGskhzpXePRdZMU87u_YO35_sDp9_eQ85CmupL4,4600
|
|
77
|
-
ai_edge_quantizer_nightly-0.4.0.
|
|
78
|
-
ai_edge_quantizer_nightly-0.4.0.
|
|
79
|
-
ai_edge_quantizer_nightly-0.4.0.
|
|
80
|
-
ai_edge_quantizer_nightly-0.4.0.
|
|
81
|
-
ai_edge_quantizer_nightly-0.4.0.
|
|
77
|
+
ai_edge_quantizer_nightly-0.4.0.dev20251030.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
78
|
+
ai_edge_quantizer_nightly-0.4.0.dev20251030.dist-info/METADATA,sha256=kEyzUto7tG3yMLuozS764ypS7pHLWGJbsqVFiZkNsWA,1508
|
|
79
|
+
ai_edge_quantizer_nightly-0.4.0.dev20251030.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
80
|
+
ai_edge_quantizer_nightly-0.4.0.dev20251030.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
|
|
81
|
+
ai_edge_quantizer_nightly-0.4.0.dev20251030.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|