Skip to content

Commit db8f756

Browse files
teijeongtensorflower-gardener
authored andcommitted
Fix dependencies for core/quantization/keras
PiperOrigin-RevId: 370391725
1 parent 3221a86 commit db8f756

File tree

8 files changed

+118
-72
lines changed

8 files changed

+118
-72
lines changed

tensorflow_model_optimization/python/core/quantization/keras/BUILD

Lines changed: 56 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
1+
# buildifier: disable=same-origin-load
2+
load("//tensorflow_model_optimization:tensorflow_model_optimization.bzl", "py_strict_library")
3+
4+
# buildifier: disable=same-origin-load
5+
load("//tensorflow_model_optimization:tensorflow_model_optimization.bzl", "py_strict_test")
6+
17
package(default_visibility = [
28
"//tensorflow_model_optimization:__subpackages__",
39
"//third_party/tensorflow:__subpackages__",
410
])
511

612
licenses(["notice"]) # Apache 2.0
713

8-
py_library(
14+
py_strict_library(
915
name = "keras",
1016
srcs = [
1117
"__init__.py",
1218
],
1319
srcs_version = "PY3",
1420
deps = [
15-
":quantize",
21+
":quantize", # build-cleaner: keep
1622
# APIs are not exposed, but still needed for internal imports.
17-
"//tensorflow_model_optimization/python/core/quantization/keras/graph_transformations",
18-
"//tensorflow_model_optimization/python/core/quantization/keras/layers",
19-
"//tensorflow_model_optimization/python/core/quantization/keras/default_8bit",
20-
"//tensorflow_model_optimization/python/core/quantization/keras/collaborative_optimizations",
23+
"//tensorflow_model_optimization/python/core/quantization/keras/graph_transformations", # buildcleaner: keep
24+
"//tensorflow_model_optimization/python/core/quantization/keras/layers", # buildcleaner: keep
25+
"//tensorflow_model_optimization/python/core/quantization/keras/default_8bit", # buildcleaner: keep
26+
"//tensorflow_model_optimization/python/core/quantization/keras/collaborative_optimizations", # buildcleaner: keep
2127
],
2228
)
2329

24-
py_library(
30+
py_strict_library(
2531
name = "quant_ops",
2632
srcs = ["quant_ops.py"],
2733
srcs_version = "PY3",
@@ -32,19 +38,21 @@ py_library(
3238
],
3339
)
3440

35-
py_test(
41+
py_strict_test(
3642
name = "quant_ops_test",
3743
size = "small",
3844
srcs = ["quant_ops_test.py"],
3945
python_version = "PY3",
4046
deps = [
4147
":quant_ops",
48+
# absl/testing:parameterized dep1,
4249
# tensorflow dep1,
50+
# python/keras tensorflow dep2,
4351
"//tensorflow_model_optimization/python/core/keras:compat",
4452
],
4553
)
4654

47-
py_library(
55+
py_strict_library(
4856
name = "quantizers",
4957
srcs = [
5058
"quantizers.py",
@@ -58,7 +66,7 @@ py_library(
5866
],
5967
)
6068

61-
py_test(
69+
py_strict_test(
6270
name = "quantizers_test",
6371
srcs = [
6472
"quantizers_test.py",
@@ -70,11 +78,12 @@ py_test(
7078
# absl/testing:parameterized dep1,
7179
# numpy dep1,
7280
# tensorflow dep1,
73-
"//tensorflow_model_optimization/python/core/keras:test_utils",
81+
# python/keras tensorflow dep2,
82+
"//tensorflow_model_optimization/python/core/keras:compat",
7483
],
7584
)
7685

77-
py_library(
86+
py_strict_library(
7887
name = "quantize_config",
7988
srcs = [
8089
"quantize_config.py",
@@ -83,11 +92,10 @@ py_library(
8392
visibility = ["//visibility:public"],
8493
deps = [
8594
# six dep1,
86-
# tensorflow dep1,
8795
],
8896
)
8997

90-
py_library(
98+
py_strict_library(
9199
name = "quantize_registry",
92100
srcs = [
93101
"quantize_registry.py",
@@ -96,32 +104,29 @@ py_library(
96104
visibility = ["//visibility:public"],
97105
deps = [
98106
# six dep1,
99-
# tensorflow dep1,
100107
],
101108
)
102109

103-
py_library(
110+
py_strict_library(
104111
name = "quantize_layout_transform",
105112
srcs = [
106113
"quantize_layout_transform.py",
107114
],
108115
srcs_version = "PY3",
109116
visibility = ["//visibility:public"],
110117
deps = [
111-
# tensorflow dep1,
112-
# python/keras tensorflow dep2,
118+
# six dep1,
113119
],
114120
)
115121

116-
py_library(
122+
py_strict_library(
117123
name = "quantize_annotate",
118124
srcs = [
119125
"quantize_annotate.py",
120126
],
121127
srcs_version = "PY3",
122128
visibility = ["//visibility:public"],
123129
deps = [
124-
":quantize_config",
125130
# tensorflow dep1,
126131
],
127132
)
@@ -141,21 +146,20 @@ py_test(
141146
],
142147
)
143148

144-
py_library(
149+
py_strict_library(
145150
name = "quantize_aware_activation",
146151
srcs = [
147152
"quantize_aware_activation.py",
148153
],
149154
srcs_version = "PY3",
150155
visibility = ["//visibility:public"],
151156
deps = [
152-
":quant_ops",
153157
# tensorflow dep1,
154158
"//tensorflow_model_optimization/python/core/keras:utils",
155159
],
156160
)
157161

158-
py_test(
162+
py_strict_test(
159163
name = "quantize_aware_activation_test",
160164
srcs = [
161165
"quantize_aware_activation_test.py",
@@ -165,12 +169,14 @@ py_test(
165169
deps = [
166170
":quantize_aware_activation",
167171
":quantizers",
172+
# absl/testing:parameterized dep1,
168173
# numpy dep1,
169174
# tensorflow dep1,
175+
# python/keras tensorflow dep2,
170176
],
171177
)
172178

173-
py_library(
179+
py_strict_library(
174180
name = "quantize_layer",
175181
srcs = [
176182
"quantize_layer.py",
@@ -184,7 +190,7 @@ py_library(
184190
],
185191
)
186192

187-
py_test(
193+
py_strict_test(
188194
name = "quantize_layer_test",
189195
srcs = [
190196
"quantize_layer_test.py",
@@ -193,13 +199,13 @@ py_test(
193199
visibility = ["//visibility:public"],
194200
deps = [
195201
":quantize_layer",
196-
# absl/testing:parameterized dep1,
202+
":quantizers",
197203
# numpy dep1,
198204
# tensorflow dep1,
199205
],
200206
)
201207

202-
py_library(
208+
py_strict_library(
203209
name = "quantize_wrapper",
204210
srcs = [
205211
"quantize_wrapper.py",
@@ -208,15 +214,14 @@ py_library(
208214
visibility = ["//visibility:public"],
209215
deps = [
210216
":quantize_aware_activation",
211-
":quantize_config",
212-
":quantizers",
213217
# tensorflow dep1,
218+
# python/util tensorflow dep2,
214219
"//tensorflow_model_optimization/python/core/keras:metrics",
215220
"//tensorflow_model_optimization/python/core/keras:utils",
216221
],
217222
)
218223

219-
py_test(
224+
py_strict_test(
220225
name = "quantize_wrapper_test",
221226
srcs = [
222227
"quantize_wrapper_test.py",
@@ -233,7 +238,7 @@ py_test(
233238
],
234239
)
235240

236-
py_library(
241+
py_strict_library(
237242
name = "quantize",
238243
srcs = [
239244
"quantize.py",
@@ -242,8 +247,11 @@ py_library(
242247
visibility = ["//visibility:public"],
243248
deps = [
244249
":quantize_annotate",
250+
":quantize_aware_activation",
251+
":quantize_config",
245252
":quantize_layer",
246253
":quantize_wrapper",
254+
":quantizers",
247255
# tensorflow dep1,
248256
"//tensorflow_model_optimization/python/core/keras:metrics",
249257
"//tensorflow_model_optimization/python/core/quantization/keras/default_8bit:default_8bit_quantize_registry",
@@ -252,39 +260,43 @@ py_library(
252260
],
253261
)
254262

255-
py_test(
263+
py_strict_test(
256264
name = "quantize_test",
257265
srcs = ["quantize_test.py"],
258266
python_version = "PY3",
259267
visibility = ["//visibility:public"],
260268
deps = [
261269
":quantize",
270+
":quantize_annotate",
271+
":quantize_config",
262272
":quantize_layer",
263273
":quantize_wrapper",
264-
# absl/testing:parameterized dep1,
265274
# numpy dep1,
266275
# tensorflow dep1,
267276
"//tensorflow_model_optimization/python/core/keras:test_utils",
268277
"//tensorflow_model_optimization/python/core/quantization/keras/default_8bit:default_8bit_quantize_registry",
269278
],
270279
)
271280

272-
py_test(
281+
py_strict_test(
273282
name = "quantize_integration_test",
274283
srcs = ["quantize_integration_test.py"],
275284
python_version = "PY3",
276285
deps = [
277286
":quantize",
287+
":quantize_config",
288+
":quantizers",
278289
":utils",
279290
# absl/testing:parameterized dep1,
280291
# numpy dep1,
281292
# tensorflow dep1,
293+
# python/keras tensorflow dep2,
282294
"//tensorflow_model_optimization/python/core/keras:compat",
283295
"//tensorflow_model_optimization/python/core/keras:test_utils",
284296
],
285297
)
286298

287-
py_test(
299+
py_strict_test(
288300
name = "quantize_models_test",
289301
size = "large",
290302
srcs = ["quantize_models_test.py"],
@@ -297,12 +309,11 @@ py_test(
297309
# absl/testing:parameterized dep1,
298310
# numpy dep1,
299311
# tensorflow dep1,
300-
"//tensorflow_model_optimization/python/core/keras:compat",
301-
"//tensorflow_model_optimization/python/core/keras:test_utils",
312+
# python/keras tensorflow dep2,
302313
],
303314
)
304315

305-
py_test(
316+
py_strict_test(
306317
name = "quantize_functional_test",
307318
size = "large",
308319
srcs = ["quantize_functional_test.py"],
@@ -315,13 +326,13 @@ py_test(
315326
# absl/testing:parameterized dep1,
316327
# numpy dep1,
317328
# tensorflow dep1,
329+
# python/keras tensorflow dep2,
318330
"//tensorflow_model_optimization/python/core/keras:compat",
319-
"//tensorflow_model_optimization/python/core/keras:test_utils",
320331
"//tensorflow_model_optimization/python/core/keras/testing:test_utils_mnist",
321332
],
322333
)
323334

324-
py_library(
335+
py_strict_library(
325336
name = "utils",
326337
srcs = [
327338
"utils.py",
@@ -330,14 +341,18 @@ py_library(
330341
visibility = ["//visibility:public"],
331342
deps = [
332343
# tensorflow dep1,
344+
"//tensorflow_model_optimization/python/core/keras:compat",
333345
],
334346
)
335347

336-
py_library(
348+
py_strict_library(
337349
name = "quantize_scheme",
338350
srcs = [
339351
"quantize_scheme.py",
340352
],
341353
srcs_version = "PY3",
342354
visibility = ["//visibility:public"],
355+
deps = [
356+
# six dep1,
357+
],
343358
)
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
load("//tensorflow_model_optimization:tensorflow_model_optimization.bzl", "py_strict_library")
2+
13
package(default_visibility = ["//tensorflow_model_optimization:__subpackages__"])
24

35
licenses(["notice"])
46

5-
py_library(
7+
py_strict_library(
68
name = "collaborative_optimizations",
79
srcs = ["__init__.py"],
810
srcs_version = "PY3",
911
deps = [
10-
"//tensorflow_model_optimization/python/core/quantization/keras/collaborative_optimizations/cluster_preserve",
11-
"//tensorflow_model_optimization/python/core/quantization/keras/collaborative_optimizations/prune_preserve",
12+
"//tensorflow_model_optimization/python/core/quantization/keras/collaborative_optimizations/cluster_preserve", # buildcleaner: keep
13+
"//tensorflow_model_optimization/python/core/quantization/keras/collaborative_optimizations/prune_preserve", # buildcleaner: keep
1214
],
1315
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ py_library(
1111
],
1212
srcs_version = "PY3",
1313
deps = [
14-
":default_8bit_cluster_preserve_quantize_scheme",
14+
":default_8bit_cluster_preserve_quantize_scheme", # buildcleaner: keep
1515
],
1616
)
1717

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ py_library(
1111
],
1212
srcs_version = "PY3",
1313
deps = [
14-
":default_8bit_prune_preserve_quantize_scheme",
14+
":default_8bit_prune_preserve_quantize_scheme", # buildcleaner: keep
1515
],
1616
)
1717

0 commit comments

Comments
 (0)