File tree Expand file tree Collapse file tree 4 files changed +216
-94
lines changed Expand file tree Collapse file tree 4 files changed +216
-94
lines changed Original file line number Diff line number Diff line change 35
35
#from .qtools.run_qtools import QTools
36
36
#from .qtools.settings import cfg
37
37
from .quantizers import * # pylint: disable=wildcard-import
38
+ from .registry import * # pylint: disable=wildcard-import
38
39
from .safe_eval import * # pylint: disable=wildcard-import
39
40
40
41
Original file line number Diff line number Diff line change
1
+ # Copyright 2024 Google LLC
2
+ #
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ # ==============================================================================
16
+ """Registry for QKeras quantizers."""
17
+
18
+ from . import registry
19
+
20
+ # Global registry for all QKeras quantizers.
21
+ _QUANTIZERS_REGISTRY = registry .Registry ()
22
+
23
+
24
+ def register_quantizer (quantizer ):
25
+ """Decorator for registering a quantizer."""
26
+ _QUANTIZERS_REGISTRY .register (quantizer )
27
+ # Return the quantizer after registering. This ensures any registered
28
+ # quantizer class is properly defined.
29
+ return quantizer
30
+
31
+
32
+ def lookup_quantizer (name ):
33
+ """Retrieves a quantizer from the quantizers registry."""
34
+ return _QUANTIZERS_REGISTRY .lookup (name )
You can’t perform that action at this time.
0 commit comments