From 3d60be24f555195aa1eb5b6388d74b932bfdfa50 Mon Sep 17 00:00:00 2001 From: Shan Li Date: Thu, 28 Sep 2023 12:34:48 -0700 Subject: [PATCH] No public description PiperOrigin-RevId: 569259447 Change-Id: Ic83bcaf2991e859dbc49f46f92506b5a56d7f49e --- qkeras/qconvolutional.py | 2 +- qkeras/qrecurrent.py | 2 +- .../quantized_operators/quantizer_factory.py | 20 +++++++++---------- qkeras/quantizers.py | 4 ++-- qkeras/utils.py | 6 +++--- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/qkeras/qconvolutional.py b/qkeras/qconvolutional.py index fbe3ff60..477b8527 100644 --- a/qkeras/qconvolutional.py +++ b/qkeras/qconvolutional.py @@ -33,7 +33,7 @@ from tensorflow.keras.layers import InputSpec from tensorflow.python.eager import context from tensorflow.python.ops import array_ops -# Google internal code, commented out by copybara +# from tensorflow.python.ops import array_ops from .qlayers import get_auto_range_constraint_initializer from .qlayers import QActivation from .quantizers import get_quantized_initializer diff --git a/qkeras/qrecurrent.py b/qkeras/qrecurrent.py index c8e8b688..c8609abe 100644 --- a/qkeras/qrecurrent.py +++ b/qkeras/qrecurrent.py @@ -32,7 +32,7 @@ from tensorflow.keras.layers import Bidirectional from tensorflow.python.util import nest from tensorflow.python.ops import array_ops -# Google internal code, commented out by copybara +# from tensorflow.python.ops import array_ops from tensorflow.python.framework import ops from tensorflow_model_optimization.python.core.sparsity.keras.prunable_layer import PrunableLayer diff --git a/qkeras/qtools/quantized_operators/quantizer_factory.py b/qkeras/qtools/quantized_operators/quantizer_factory.py index 9d8da0db..94d95a79 100644 --- a/qkeras/qtools/quantized_operators/quantizer_factory.py +++ b/qkeras/qtools/quantized_operators/quantizer_factory.py @@ -20,8 +20,8 @@ import copy from qkeras import quantizers -# Google internal code, commented out by copybara -# Google internal code, commented out by copybara +# from qkeras.google_internals import experimental_quantizers +# from qkeras.google_internals import experimental_quantizer_impl from qkeras.qtools.quantized_operators import quantizer_impl from qkeras.qtools.settings import cfg @@ -53,10 +53,10 @@ def __init__(self): quantizer_impl.QuantizedTanh, quantizers.quantized_ulaw: quantizer_impl.QuantizedUlaw, - # Google internal code, commented out by copybara - # Google internal code, commented out by copybara - # Google internal code, commented out by copybara - # Google internal code, commented out by copybara + # experimental_quantizers.quantized_bits_learnable_scale: + # experimental_quantizer_impl.QuantizedBitsLearnableScale, + # experimental_quantizers.parametric_quantizer_d_xmax: + # experimental_quantizer_impl.ParametricQuantizer, # add following quantizer types for the use in GraphUpdateEdge quantizer_impl.QuantizedBits: @@ -83,10 +83,10 @@ def __init__(self): quantizer_impl.StochasticTernary, quantizer_impl.QuantizedUlaw: quantizer_impl.StochasticTernary, - # Google internal code, commented out by copybara - # Google internal code, commented out by copybara - # Google internal code, commented out by copybara - # Google internal code, commented out by copybara + # experimental_quantizer_impl.QuantizedBitsLearnableScale: + # experimental_quantizer_impl.QuantizedBitsLearnableScale, + #experimental_quantizer_impl.ParametricQuantizer: + # experimental_quantizer_impl.ParametricQuantizer, } self._default_interm_quantizer = cfg.default_interm_quantizer diff --git a/qkeras/quantizers.py b/qkeras/quantizers.py index 4f0b3c78..41d8b381 100644 --- a/qkeras/quantizers.py +++ b/qkeras/quantizers.py @@ -28,8 +28,8 @@ from tensorflow.keras.utils import deserialize_keras_object from tensorflow.python.framework import smart_cond as tf_utils from .safe_eval import safe_eval -# Google internal code, commented out by copybara -# Google internal code, commented out by copybara +# from .google_internals.experimental_quantizers import quantized_bits_learnable_scale +# from .google_internals.experimental_quantizers import parametric_quantizer_d_xmax # # Library of auxiliary functions diff --git a/qkeras/utils.py b/qkeras/utils.py index 2264c54f..40ca10c2 100644 --- a/qkeras/utils.py +++ b/qkeras/utils.py @@ -70,8 +70,8 @@ from .quantizers import stochastic_binary from .quantizers import stochastic_ternary from .quantizers import ternary -# Google internal code, commented out by copybara -# Google internal code, commented out by copybara +# from .google_internals.experimental_quantizers import quantized_bits_learnable_scale +# from .google_internals.experimental_quantizers import parametric_quantizer_d_xmax from .safe_eval import safe_eval from tensorflow.python.ops import math_ops from .qmac import QScaleShift @@ -1051,7 +1051,7 @@ def _add_supported_quantized_objects(custom_objects): custom_objects["quantized_sigmoid"] = quantized_sigmoid custom_objects["quantized_po2"] = quantized_po2 custom_objects["quantized_relu_po2"] = quantized_relu_po2 - # Google internal code, commented out by copybara + # custom_objects["quantized_bits_learnable_scale"] = quantized_bits_learnable_scale custom_objects["QConv2DBatchnorm"] = QConv2DBatchnorm custom_objects["QDepthwiseConv2DBatchnorm"] = QDepthwiseConv2DBatchnorm