ai-edge-quantizer-nightly 0.3.0.dev20250604__py3-none-any.whl → 0.3.0.dev20250606__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.
@@ -17,6 +17,7 @@
17
17
 
18
18
  from typing import Any, Optional, Union
19
19
 
20
+ import ml_dtypes
20
21
  import numpy as np
21
22
 
22
23
  from ai_edge_quantizer import qtyping
@@ -339,6 +340,15 @@ def _create_random_integers(
339
340
  return rng.integers(min_value, max_value, size=shape, dtype=dtype)
340
341
 
341
342
 
343
+ def _create_random_bool(
344
+ rng: np.random.Generator,
345
+ shape: tuple[int, ...],
346
+ dtype: np.dtype,
347
+ ) -> dict[str, Any]:
348
+ """Creates a random bool dataset sample for given input details."""
349
+ return rng.choice([True, False], size=shape, replace=False).astype(dtype)
350
+
351
+
342
352
  def create_random_dataset(
343
353
  input_details: dict[str, Any],
344
354
  num_samples: int,
@@ -364,8 +374,10 @@ def create_random_dataset(
364
374
  shape = input_tensor["shape"]
365
375
  if dtype in (np.int32, np.int64):
366
376
  new_data = _create_random_integers(rng, shape, dtype)
367
- elif dtype == np.float32:
377
+ elif dtype in (np.float32, ml_dtypes.bfloat16):
368
378
  new_data = _create_random_normal(rng, shape, dtype)
379
+ elif dtype == np.bool:
380
+ new_data = _create_random_bool(rng, shape, dtype)
369
381
  else:
370
382
  raise ValueError(f"Unsupported dtype: {input_tensor['dtype']}")
371
383
  input_data[arg_name] = new_data
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ai-edge-quantizer-nightly
3
- Version: 0.3.0.dev20250604
3
+ Version: 0.3.0.dev20250606
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
@@ -66,12 +66,12 @@ ai_edge_quantizer/utils/calibration_utils_test.py,sha256=Z-AcdTieesWFKyKBb08ZXm4
66
66
  ai_edge_quantizer/utils/test_utils.py,sha256=fXwQ353P7tSy7W4Hs6YskIbCLLaBYGA724hMMbcqCUk,7129
67
67
  ai_edge_quantizer/utils/tfl_flatbuffer_utils.py,sha256=zNlR_SJAkDi-EX63O3pNpFLVqSktysScZKgKk1XT3c8,10616
68
68
  ai_edge_quantizer/utils/tfl_flatbuffer_utils_test.py,sha256=K1SbK8q92qYVtiVj0I0GtugsPTkpIpEKv9zakvFV_Sc,8555
69
- ai_edge_quantizer/utils/tfl_interpreter_utils.py,sha256=WoewyiZpaua80oP0tpgyrw5Ws1v7f4vl88vdzS0UjDE,13490
69
+ ai_edge_quantizer/utils/tfl_interpreter_utils.py,sha256=EtOv6cpKM_F0uv2bWuSXylYmTeXT6zUc182pw4sdYSI,13889
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.dev20250604.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
74
- ai_edge_quantizer_nightly-0.3.0.dev20250604.dist-info/METADATA,sha256=iG1n9JA6Ei_m2GcCgokIMsjnjbhZIUp8wdCy88U2iQQ,1528
75
- ai_edge_quantizer_nightly-0.3.0.dev20250604.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
76
- ai_edge_quantizer_nightly-0.3.0.dev20250604.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
77
- ai_edge_quantizer_nightly-0.3.0.dev20250604.dist-info/RECORD,,
73
+ ai_edge_quantizer_nightly-0.3.0.dev20250606.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
74
+ ai_edge_quantizer_nightly-0.3.0.dev20250606.dist-info/METADATA,sha256=s7_-COAXeDIYmaeeTtTaoxI_dGf76elQM3A_NK8RHYM,1528
75
+ ai_edge_quantizer_nightly-0.3.0.dev20250606.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
76
+ ai_edge_quantizer_nightly-0.3.0.dev20250606.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
77
+ ai_edge_quantizer_nightly-0.3.0.dev20250606.dist-info/RECORD,,