quantizers 1.2.0__tar.gz → 1.2.2__tar.gz
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.
- {quantizers-1.2.0/src/quantizers.egg-info → quantizers-1.2.2}/PKG-INFO +2 -2
- {quantizers-1.2.0 → quantizers-1.2.2}/pyproject.toml +2 -2
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers/_version.py +2 -2
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers/fixed_point/_fixed_point_ops.py +2 -2
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers/fixed_point/fixed_point_ops_np.py +1 -1
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers/stateful_quantizers.py +3 -3
- {quantizers-1.2.0 → quantizers-1.2.2/src/quantizers.egg-info}/PKG-INFO +2 -2
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers.egg-info/requires.txt +1 -1
- {quantizers-1.2.0 → quantizers-1.2.2}/test/test_stateless_quantizer.py +1 -1
- {quantizers-1.2.0 → quantizers-1.2.2}/.clang-format +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/.github/workflows/python-publish.yml +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/.github/workflows/python-test.yml +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/.gitignore +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/.pre-commit-config.yaml +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/LICENSE +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/README.md +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/setup.cfg +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers/__init__.py +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers/binary/__init__.py +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers/binary/_binary_ops.py +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers/binary/binary_ops.py +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers/binary/binary_ops_np.py +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers/fixed_point/__init__.py +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers/fixed_point/fixed_point_ops.py +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers/minifloat/__init__.py +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers/minifloat/_float_point_ops.py +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers/minifloat/float_point_ops.py +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers/minifloat/float_point_ops_np.py +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers.egg-info/SOURCES.txt +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers.egg-info/dependency_links.txt +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/src/quantizers.egg-info/top_level.txt +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/ap_types/ap_binary.h +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/ap_types/ap_common.h +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/ap_types/ap_decl.h +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/ap_types/ap_fixed.h +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/ap_types/ap_fixed_base.h +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/ap_types/ap_fixed_ref.h +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/ap_types/ap_fixed_special.h +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/ap_types/ap_float.h +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/ap_types/ap_int.h +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/ap_types/ap_int_base.h +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/ap_types/ap_int_ref.h +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/ap_types/ap_int_special.h +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/ap_types/ap_shift_reg.h +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/ap_types/etc/ap_private.h +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/ap_types/hls_math.h +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/ap_types/hls_stream.h +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/ap_types/test.cpp +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/ap_types/utils/x_hls_utils.h +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/cpp_source/quantizers.h +0 -0
- {quantizers-1.2.0 → quantizers-1.2.2}/test/test_quantizer_match.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: quantizers
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Author-email: Chang Sun <chsun@cern.ch>
|
|
5
5
|
License: GNU Lesser General Public License v3 (LGPLv3)
|
|
6
6
|
Project-URL: repository, https://github.com/calad0i/quantizers
|
|
@@ -15,7 +15,7 @@ License-File: LICENSE
|
|
|
15
15
|
Provides-Extra: dependencies
|
|
16
16
|
Requires-Dist: numpy; extra == "dependencies"
|
|
17
17
|
Provides-Extra: grad
|
|
18
|
-
Requires-Dist: keras>=3; extra == "grad"
|
|
18
|
+
Requires-Dist: keras>=3.10; extra == "grad"
|
|
19
19
|
Provides-Extra: test
|
|
20
20
|
Requires-Dist: pytest; extra == "test"
|
|
21
21
|
Requires-Dist: pytest-cov; extra == "test"
|
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
|
|
6
6
|
[project]
|
|
7
7
|
name = "quantizers"
|
|
8
|
-
version = "1.2.
|
|
8
|
+
version = "1.2.2"
|
|
9
9
|
authors = [{ name = "Chang Sun", email = "chsun@cern.ch" }]
|
|
10
10
|
description = ""
|
|
11
11
|
readme = "README.md"
|
|
@@ -36,7 +36,7 @@ write_to = "src/quantizers/_version.py"
|
|
|
36
36
|
[project.optional-dependencies]
|
|
37
37
|
dependencies = ["numpy"]
|
|
38
38
|
|
|
39
|
-
grad = ['keras>=3']
|
|
39
|
+
grad = ['keras>=3.10']
|
|
40
40
|
test = [
|
|
41
41
|
'pytest',
|
|
42
42
|
'pytest-cov',
|
|
@@ -3,7 +3,7 @@ from functools import wraps
|
|
|
3
3
|
from typing import Any, TypeVar
|
|
4
4
|
|
|
5
5
|
from keras import ops
|
|
6
|
-
from keras.
|
|
6
|
+
from keras.random import SeedGenerator
|
|
7
7
|
from numpy.typing import ArrayLike
|
|
8
8
|
|
|
9
9
|
round_mode_registry: dict[str, Callable[[Any], Any]] = {}
|
|
@@ -124,7 +124,7 @@ def wrap_sm_fn(x, k, i, f, training=None, quant_fn: Callable = lambda x: x):
|
|
|
124
124
|
eps = 2.0**-f
|
|
125
125
|
high = 2.0**i - eps
|
|
126
126
|
low = -(high + eps) * k
|
|
127
|
-
interval = 2 ** (i + k)
|
|
127
|
+
interval = 2.0 ** (i + k)
|
|
128
128
|
c1 = ((x) / interval) % 2 >= 1 # type: ignore
|
|
129
129
|
c1 = c1 & (ops.abs(x) > eps / 2)
|
|
130
130
|
c2 = ((x + eps / 2) / (interval / 2)) % 2 >= 1 # type: ignore
|
|
@@ -117,7 +117,7 @@ def wrap_sm_fn(x, k, i, f, training=None, quant_fn: Callable = lambda x: x):
|
|
|
117
117
|
eps = 2.0**-f
|
|
118
118
|
high = 2.0**i - eps
|
|
119
119
|
low = -(high + eps) * k
|
|
120
|
-
interval = 2 ** (i + k)
|
|
120
|
+
interval = 2.0 ** (i + k)
|
|
121
121
|
c1 = ((x) / interval) % 2 >= 1
|
|
122
122
|
c1 = c1 & (np.abs(x) > eps / 2)
|
|
123
123
|
c2 = ((x + eps / 2) / (interval / 2)) % 2 >= 1
|
|
@@ -87,11 +87,11 @@ class FixedQ:
|
|
|
87
87
|
def __call__(self, x):
|
|
88
88
|
use_numpy = not is_tensor(x)
|
|
89
89
|
k, i, f = self.signed, self.integer - self.signed, self.width - self.integer
|
|
90
|
-
k, i, f = float(k), float(i), float(f)
|
|
90
|
+
# k, i, f = float(k), float(i), float(f)
|
|
91
91
|
if use_numpy:
|
|
92
92
|
q = get_fixed_quantizer_np(self.rounding, self.overflow)
|
|
93
93
|
else:
|
|
94
|
-
from keras
|
|
94
|
+
from keras import ops
|
|
95
95
|
|
|
96
96
|
k, i, f = ops.convert_to_tensor(k), ops.convert_to_tensor(i), ops.convert_to_tensor(f)
|
|
97
97
|
q = get_fixed_quantizer(self.rounding, self.overflow)
|
|
@@ -131,7 +131,7 @@ class MinifloatQ:
|
|
|
131
131
|
if use_numpy:
|
|
132
132
|
return float_quantize_np(x, s, e, e0)
|
|
133
133
|
else:
|
|
134
|
-
from keras
|
|
134
|
+
from keras import ops
|
|
135
135
|
|
|
136
136
|
s, e, e0 = ops.convert_to_tensor(s), ops.convert_to_tensor(e), ops.convert_to_tensor(e0)
|
|
137
137
|
return float_quantize(x, s, e, e0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: quantizers
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Author-email: Chang Sun <chsun@cern.ch>
|
|
5
5
|
License: GNU Lesser General Public License v3 (LGPLv3)
|
|
6
6
|
Project-URL: repository, https://github.com/calad0i/quantizers
|
|
@@ -15,7 +15,7 @@ License-File: LICENSE
|
|
|
15
15
|
Provides-Extra: dependencies
|
|
16
16
|
Requires-Dist: numpy; extra == "dependencies"
|
|
17
17
|
Provides-Extra: grad
|
|
18
|
-
Requires-Dist: keras>=3; extra == "grad"
|
|
18
|
+
Requires-Dist: keras>=3.10; extra == "grad"
|
|
19
19
|
Provides-Extra: test
|
|
20
20
|
Requires-Dist: pytest; extra == "test"
|
|
21
21
|
Requires-Dist: pytest-cov; extra == "test"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|