Skip to content

Commit c3c0042

Browse files
Replace tensorflow.python.keras with keras. tensorflow.python.keras is an old copy and is deprecated.
PiperOrigin-RevId: 490106692
1 parent 56fa13f commit c3c0042

File tree

6 files changed

+8
-15
lines changed

6 files changed

+8
-15
lines changed

tensorflow_model_optimization/python/core/quantization/keras/quant_ops_test.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,16 @@
1818
from __future__ import division
1919
from __future__ import print_function
2020

21-
from absl.testing import parameterized
2221
import tensorflow as tf
2322

2423
# TODO(b/139939526): move to public API.
25-
from tensorflow.python.keras import keras_parameterized
2624
from tensorflow_model_optimization.python.core.keras import compat
2725
from tensorflow_model_optimization.python.core.quantization.keras import quant_ops
2826

2927
_SYMMETRIC_RANGE_RATIO = 0.9921875 # 127 / 128
3028

3129

32-
@keras_parameterized.run_all_keras_modes
33-
class QuantOpsTest(tf.test.TestCase, parameterized.TestCase):
30+
class QuantOpsTest(tf.test.TestCase):
3431

3532
def testAllValuesQuantiize_TrainingAssign(self):
3633
min_value, max_value = self._GetMinMaxValues(

tensorflow_model_optimization/python/core/quantization/keras/quantize_aware_activation_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import numpy as np
2424
import tensorflow as tf
2525

26-
from tensorflow.python.keras import keras_parameterized
2726
from tensorflow_model_optimization.python.core.quantization.keras import quantize_aware_activation
2827
from tensorflow_model_optimization.python.core.quantization.keras import quantizers
2928

@@ -37,7 +36,8 @@
3736
MovingAverageQuantizer = quantizers.MovingAverageQuantizer
3837

3938

40-
@keras_parameterized.run_all_keras_modes
39+
@tf.__internal__.distribute.combinations.generate(
40+
tf.__internal__.test.combinations.combine(mode=['graph', 'eager']))
4141
class QuantizeAwareQuantizationTest(tf.test.TestCase, parameterized.TestCase):
4242

4343
def setUp(self):

tensorflow_model_optimization/python/core/quantization/keras/quantize_functional_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import tensorflow as tf
2626

2727
# TODO(b/139939526): move to public API.
28-
from tensorflow.python.keras import keras_parameterized
2928
from tensorflow_model_optimization.python.core.keras import compat
3029
from tensorflow_model_optimization.python.core.keras.testing import test_utils_mnist
3130
from tensorflow_model_optimization.python.core.quantization.keras import quantize
@@ -34,8 +33,9 @@
3433
layers = tf.keras.layers
3534

3635

37-
@keras_parameterized.run_all_keras_modes(always_skip_v1=True)
38-
class QuantizeFunctionalTest(tf.test.TestCase, parameterized.TestCase):
36+
@tf.__internal__.distribute.combinations.generate(
37+
tf.__internal__.test.combinations.combine(mode=['graph', 'eager']))
38+
class QuantizeFunctionalTest(tf.test.TestCase):
3939

4040
# TODO(pulkitb): Parameterize test and include functional mnist, and
4141
# other RNN models.

tensorflow_model_optimization/python/core/quantization/keras/quantize_integration_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import tensorflow as tf
2727

2828
# TODO(b/139939526): move to public API.
29-
from tensorflow.python.keras import keras_parameterized
3029

3130
from tensorflow_model_optimization.python.core.keras import compat
3231
from tensorflow_model_optimization.python.core.keras import test_utils
@@ -44,7 +43,8 @@
4443
# TODO(tfmot): enable for v1. Currently fails because the decorator
4544
# on graph mode wraps everything in a graph, which is not compatible
4645
# with the TFLite converter's call to clear_session().
47-
@keras_parameterized.run_all_keras_modes(always_skip_v1=True)
46+
@tf.__internal__.distribute.combinations.generate(
47+
tf.__internal__.test.combinations.combine(mode=['graph', 'eager']))
4848
class QuantizeIntegrationTest(tf.test.TestCase, parameterized.TestCase):
4949

5050
def _batch(self, dims, batch_size):

tensorflow_model_optimization/python/core/quantization/keras/quantize_models_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@
2626
import numpy as np
2727
import tensorflow as tf
2828

29-
from tensorflow.python.keras import keras_parameterized
3029
from tensorflow_model_optimization.python.core.quantization.keras import quantize
3130
from tensorflow_model_optimization.python.core.quantization.keras import utils
3231

3332

34-
@keras_parameterized.run_all_keras_modes(always_skip_v1=True)
3533
class QuantizeModelsTest(tf.test.TestCase, parameterized.TestCase):
3634

3735
# Derived using

tensorflow_model_optimization/python/core/quantization/keras/quantizers_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@
2323
import numpy as np
2424
import tensorflow as tf
2525

26-
from tensorflow.python.keras import keras_parameterized
2726
from tensorflow_model_optimization.python.core.keras import compat
2827
from tensorflow_model_optimization.python.core.quantization.keras import quantizers
2928

3029
deserialize_keras_object = tf.keras.utils.deserialize_keras_object
3130
serialize_keras_object = tf.keras.utils.serialize_keras_object
3231

3332

34-
@keras_parameterized.run_all_keras_modes
3533
@parameterized.parameters(
3634
quantizers.LastValueQuantizer,
3735
quantizers.MovingAverageQuantizer,

0 commit comments

Comments
 (0)