Skip to content

Commit f199bfa

Browse files
teijeongtensorflower-gardener
authored andcommitted
Fix test dependencies and move some py_test to py_strict_test when possible
PiperOrigin-RevId: 370802463
1 parent 42b2b62 commit f199bfa

File tree

5 files changed

+7
-10
lines changed

5 files changed

+7
-10
lines changed

tensorflow_model_optimization/python/core/clustering/keras/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ py_test(
132132
],
133133
)
134134

135-
py_test(
135+
py_strict_test(
136136
name = "clustering_centroids_test",
137137
size = "medium",
138138
srcs = ["clustering_centroids_test.py"],

tensorflow_model_optimization/python/core/clustering/keras/clustering_centroids_test.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,17 @@
1616

1717
from absl.testing import parameterized
1818
import tensorflow as tf
19-
import tensorflow.keras.backend as K
2019

2120
from tensorflow_model_optimization.python.core.clustering.keras import cluster_config
2221
from tensorflow_model_optimization.python.core.clustering.keras import clustering_centroids
2322

24-
keras = tf.keras
23+
K = tf.keras.backend
2524
errors_impl = tf.errors
26-
layers = keras.layers
27-
test = tf.test
2825

2926
CentroidInitialization = cluster_config.CentroidInitialization
3027

3128

32-
class ClusteringCentroidsTest(test.TestCase, parameterized.TestCase):
29+
class ClusteringCentroidsTest(tf.test.TestCase, parameterized.TestCase):
3330
"""Unit tests for the clustering_centroids module."""
3431

3532
def setUp(self):
@@ -221,4 +218,4 @@ def testKmeansPlusPlusClusterCentroidsWithSparsityPreservation(
221218

222219

223220
if __name__ == "__main__":
224-
test.main()
221+
tf.test.main()

tensorflow_model_optimization/python/core/quantization/keras/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ py_strict_library(
131131
],
132132
)
133133

134-
py_test(
134+
py_strict_test(
135135
name = "quantize_annotate_test",
136136
srcs = [
137137
"quantize_annotate_test.py",

tensorflow_model_optimization/python/core/quantization/keras/collaborative_optimizations/prune_preserve/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ py_test(
4141
visibility = ["//visibility:private"],
4242
deps = [
4343
":prune_preserve_quantize_registry",
44+
# absl/testing:parameterized dep1,
4445
# tensorflow dep1,
4546
"//tensorflow_model_optimization/python/core/quantization/keras/default_8bit:default_8bit_quantize_registry",
4647
"//tensorflow_model_optimization/python/core/sparsity/keras:prune_registry",

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import numpy as np
2222
import tensorflow as tf
2323

24-
from tensorflow.python.keras.engine.base_layer import Layer
2524
from tensorflow_model_optimization.python.core.quantization.keras import quantize_annotate
2625
from tensorflow_model_optimization.python.core.quantization.keras import quantize_config as quantize_config_mod
2726

@@ -54,7 +53,7 @@ def get_config(self):
5453

5554
def testAnnotateLayerCallPassesTraningBoolean(self):
5655

57-
class MockLayer(Layer):
56+
class MockLayer(tf.keras.layers.Layer):
5857
self.training = None
5958

6059
def call(self, training=None):

0 commit comments

Comments
 (0)