• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Description:
2#   Contains ops for image manipulation.
3
4licenses(["notice"])  # Apache 2.0
5
6exports_files(["LICENSE"])
7
8package(default_visibility = ["//visibility:public"])
9
10load(
11    "//tensorflow:tensorflow.bzl",
12    "tf_cc_test",
13    "tf_custom_op_library",
14    "tf_gen_op_libs",
15    "tf_gen_op_wrapper_py",
16    "tf_kernel_library",
17    "tf_py_test",
18)
19load("//tensorflow:tensorflow.bzl", "cuda_py_test")
20load("//tensorflow:tensorflow.bzl", "tf_custom_op_py_library")
21
22tf_custom_op_library(
23    name = "python/ops/_image_ops.so",
24    srcs = [
25        "kernels/bipartite_match_op.cc",
26        "kernels/image_ops.cc",
27        "kernels/image_ops.h",
28        "kernels/segmentation_ops.cc",
29        "kernels/segmentation_ops.h",
30        "ops/image_ops.cc",
31    ],
32    gpu_srcs = [
33        "kernels/image_ops_gpu.cu.cc",
34        "kernels/image_ops.h",
35    ],
36)
37
38tf_kernel_library(
39    name = "image_ops_kernels",
40    srcs = [
41        "kernels/bipartite_match_op.cc",
42        "kernels/image_ops.cc",
43        "kernels/image_ops.h",
44        "kernels/segmentation_ops.cc",
45        "kernels/segmentation_ops.h",
46    ],
47    gpu_srcs = [
48        "kernels/image_ops_gpu.cu.cc",
49        "kernels/image_ops.h",
50    ],
51    deps = [
52        ":image_ops_op_lib",
53        "//tensorflow/core:framework",
54        "//tensorflow/core:lib",
55        "//third_party/eigen3",
56    ],
57    alwayslink = 1,
58)
59
60tf_gen_op_libs(
61    op_lib_names = ["image_ops"],
62)
63
64tf_gen_op_wrapper_py(
65    name = "image_ops",
66    deps = [":image_ops_op_lib"],
67)
68
69tf_custom_op_py_library(
70    name = "image_py",
71    srcs = [
72        "__init__.py",
73        "python/ops/image_ops.py",
74    ],
75    dso = [":python/ops/_image_ops.so"],
76    kernels = [
77        ":image_ops_kernels",
78    ],
79    srcs_version = "PY2AND3",
80    deps = [
81        ":dense_image_warp_py",
82        ":image_ops",
83        ":interpolate_spline_py",
84        ":sparse_image_warp_py",
85        "//tensorflow/contrib/util:util_py",
86        "//tensorflow/python:array_ops",
87        "//tensorflow/python:common_shapes",
88        "//tensorflow/python:constant_op",
89        "//tensorflow/python:control_flow_ops",
90        "//tensorflow/python:framework_for_generated_wrappers",
91        "//tensorflow/python:linalg_ops",
92        "//tensorflow/python:math_ops",
93        "//tensorflow/python:platform",
94        "//tensorflow/python:util",
95    ],
96)
97
98cuda_py_test(
99    name = "image_ops_test",
100    size = "medium",
101    srcs = ["python/kernel_tests/image_ops_test.py"],
102    additional_deps = [
103        ":distort_image_py",
104        ":image_py",
105        ":single_image_random_dot_stereograms_py",
106        "//third_party/py/numpy",
107        "//tensorflow/python:array_ops",
108        "//tensorflow/python:framework_for_generated_wrappers",
109        "//tensorflow/python:framework_test_lib",
110        "//tensorflow/python:math_ops",
111        "//tensorflow/python:platform_test",
112    ],
113)
114
115tf_custom_op_library(
116    name = "python/ops/_distort_image_ops.so",
117    srcs = [
118        "kernels/adjust_hsv_in_yiq_op.cc",
119        "kernels/adjust_hsv_in_yiq_op.h",
120        "ops/distort_image_ops.cc",
121    ],
122    gpu_srcs = [
123        "kernels/adjust_hsv_in_yiq_op_gpu.cu.cc",
124        "kernels/adjust_hsv_in_yiq_op.h",
125    ],
126    deps = [
127        "//tensorflow/core/kernels:gpu_util_hdrs",
128    ],
129)
130
131tf_kernel_library(
132    name = "distort_image_ops_kernels",
133    srcs = [
134        "kernels/adjust_hsv_in_yiq_op.cc",
135        "kernels/adjust_hsv_in_yiq_op.h",
136    ],
137    gpu_srcs = [
138        "kernels/adjust_hsv_in_yiq_op_gpu.cu.cc",
139        "kernels/adjust_hsv_in_yiq_op.h",
140    ],
141    deps = [
142        ":distort_image_ops_op_lib",
143        "//tensorflow/core:framework",
144        "//tensorflow/core:lib",
145        "//tensorflow/core/kernels:gpu_util_hdrs",
146        "//third_party/eigen3",
147    ],
148    alwayslink = 1,
149)
150
151tf_cc_test(
152    name = "adjust_hsv_in_yiq_op_test",
153    size = "small",
154    srcs = [
155        "kernels/adjust_hsv_in_yiq_op.h",
156        "kernels/adjust_hsv_in_yiq_op_test.cc",
157    ],
158    deps = [
159        "//tensorflow/core:framework",
160        "//tensorflow/core:test",
161        "//tensorflow/core:test_main",
162        "//tensorflow/core:testlib",
163        "//tensorflow/core/kernels:ops_testutil",
164        "//tensorflow/core/kernels:ops_util",
165        "//third_party/eigen3",
166    ],
167)
168
169tf_gen_op_libs(
170    op_lib_names = ["distort_image_ops"],
171)
172
173tf_gen_op_wrapper_py(
174    name = "distort_image_ops",
175    deps = [":distort_image_ops_op_lib"],
176)
177
178tf_custom_op_py_library(
179    name = "distort_image_py",
180    srcs = [
181        "__init__.py",
182        "python/ops/distort_image_ops.py",
183    ],
184    dso = [":python/ops/_distort_image_ops.so"],
185    kernels = [
186        ":distort_image_ops_kernels",
187    ],
188    srcs_version = "PY2AND3",
189    deps = [
190        ":distort_image_ops",
191        ":single_image_random_dot_stereograms_py",
192        "//tensorflow/contrib/util:util_py",
193        "//tensorflow/python:framework_for_generated_wrappers",
194        "//tensorflow/python:image_ops",
195        "//tensorflow/python:platform",
196        "//tensorflow/python:random_ops",
197        "//tensorflow/python:util",
198    ],
199)
200
201cuda_py_test(
202    name = "distort_image_ops_test",
203    size = "medium",
204    srcs = ["python/kernel_tests/distort_image_ops_test.py"],
205    additional_deps = [
206        ":distort_image_py",
207        ":image_py",
208        ":single_image_random_dot_stereograms_py",
209        "//third_party/py/numpy",
210        "//tensorflow/python:client",
211        "//tensorflow/python:client_testlib",
212        "//tensorflow/python:control_flow_ops",
213        "//tensorflow/python:framework_for_generated_wrappers",
214        "//tensorflow/python:framework_test_lib",
215        "//tensorflow/python:math_ops",
216        "//tensorflow/python:platform_test",
217        "//tensorflow/python:random_ops",
218        "//tensorflow/python:variables",
219        "//tensorflow/core:protos_all_py",
220    ],
221)
222
223py_library(
224    name = "dense_image_warp_py",
225    srcs = [
226        "python/ops/dense_image_warp.py",
227    ],
228    srcs_version = "PY2AND3",
229    deps = [
230        "//tensorflow/contrib/util:util_py",
231        "//tensorflow/python:platform",
232        "//tensorflow/python:util",
233        "//third_party/py/numpy",
234    ],
235)
236
237py_library(
238    name = "interpolate_spline_py",
239    srcs = [
240        "python/ops/interpolate_spline.py",
241    ],
242    srcs_version = "PY2AND3",
243    deps = [
244        "//tensorflow/contrib/util:util_py",
245        "//tensorflow/python:platform",
246        "//tensorflow/python:util",
247    ],
248)
249
250py_library(
251    name = "sparse_image_warp_py",
252    srcs = [
253        "python/ops/sparse_image_warp.py",
254    ],
255    srcs_version = "PY2AND3",
256    deps = [
257        ":dense_image_warp_py",
258        ":interpolate_spline_py",
259        "//tensorflow/contrib/util:util_py",
260        "//tensorflow/python:platform",
261        "//tensorflow/python:util",
262    ],
263)
264
265cuda_py_test(
266    name = "sparse_image_warp_test",
267    size = "medium",
268    srcs = ["python/kernel_tests/sparse_image_warp_test.py"],
269    additional_deps = [
270        ":sparse_image_warp_py",
271        "//third_party/py/numpy",
272        "//tensorflow/python:client",
273        "//tensorflow/python:client_testlib",
274        "//tensorflow/python:framework_test_lib",
275        "//tensorflow/python:math_ops",
276        "//tensorflow/python:clip_ops",
277        "//tensorflow/python:io_ops",
278        "//tensorflow/python:platform_test",
279        "//tensorflow/python:random_ops",
280        "//tensorflow/python:image_ops",
281        "//tensorflow/python:variables",
282        "//tensorflow/core:protos_all_py",
283    ],
284    data = [":sparse_image_warp_test_data"],
285    tags = ["no_pip"],
286)
287
288filegroup(
289    name = "sparse_image_warp_test_data",
290    srcs = glob(["python/kernel_tests/test_data/*.png"]),
291)
292
293cuda_py_test(
294    name = "dense_image_warp_test",
295    size = "medium",
296    srcs = ["python/kernel_tests/dense_image_warp_test.py"],
297    additional_deps = [
298        ":dense_image_warp_py",
299        "//third_party/py/numpy",
300        "//tensorflow/python:client",
301        "//tensorflow/python:client_testlib",
302        "//tensorflow/python:framework_test_lib",
303        "//tensorflow/python:math_ops",
304        "//tensorflow/python:clip_ops",
305        "//tensorflow/python:io_ops",
306        "//tensorflow/python:platform_test",
307        "//tensorflow/python:random_ops",
308        "//tensorflow/python:image_ops",
309        "//tensorflow/python:variables",
310        "//tensorflow/core:protos_all_py",
311    ],
312)
313
314cuda_py_test(
315    name = "interpolate_spline_test",
316    size = "medium",
317    srcs = ["python/kernel_tests/interpolate_spline_test.py"],
318    additional_deps = [
319        ":interpolate_spline_py",
320        "//third_party/py/numpy",
321        "//tensorflow/python:client",
322        "//tensorflow/python:client_testlib",
323        "//tensorflow/python:framework_test_lib",
324        "//tensorflow/python:math_ops",
325        "//tensorflow/python:clip_ops",
326        "//tensorflow/python:io_ops",
327        "//tensorflow/python:platform_test",
328        "//tensorflow/python:image_ops",
329        "//tensorflow/python:variables",
330        "//tensorflow/core:protos_all_py",
331    ],
332)
333
334tf_py_test(
335    name = "segmentation_test",
336    size = "medium",
337    srcs = ["python/kernel_tests/segmentation_test.py"],
338    additional_deps = [
339        ":distort_image_py",
340        ":image_py",
341        "//tensorflow/python:array_ops",
342        "//tensorflow/python:framework_for_generated_wrappers",
343        "//tensorflow/python:framework_test_lib",
344        "//tensorflow/python:math_ops",
345        "//tensorflow/python:platform_test",
346    ],
347)
348
349tf_custom_op_library(
350    name = "python/ops/_single_image_random_dot_stereograms.so",
351    srcs = [
352        "kernels/single_image_random_dot_stereograms_ops.cc",
353        "ops/single_image_random_dot_stereograms_ops.cc",
354    ],
355    deps = [
356        "@protobuf_archive//:protobuf",
357    ],
358)
359
360tf_gen_op_libs(
361    op_lib_names = ["single_image_random_dot_stereograms_ops"],
362)
363
364tf_kernel_library(
365    name = "single_image_random_dot_stereograms_kernels",
366    srcs = [
367        "kernels/single_image_random_dot_stereograms_ops.cc",
368    ],
369    deps = [
370        ":single_image_random_dot_stereograms_ops_op_lib",
371        "//tensorflow/core:framework",
372        "//tensorflow/core:lib",
373        "//third_party/eigen3",
374    ],
375)
376
377tf_gen_op_wrapper_py(
378    name = "single_image_random_dot_stereograms_ops",
379    deps = [":single_image_random_dot_stereograms_ops_op_lib"],
380)
381
382alias(
383    name = "image_ops_cc",
384    actual = ":image_ops_op_lib",
385)
386
387tf_custom_op_py_library(
388    name = "single_image_random_dot_stereograms_py",
389    srcs = glob(["python/ops/single*.py"]) + ["__init__.py"],
390    dso = [":python/ops/_single_image_random_dot_stereograms.so"],
391    kernels = [
392        ":single_image_random_dot_stereograms_kernels",
393    ],
394    srcs_version = "PY2AND3",
395    deps = [
396        ":image_py",
397        ":single_image_random_dot_stereograms_ops",
398        "//tensorflow/contrib/util:util_py",
399        "//tensorflow/python:framework_ops",
400        "//tensorflow/python:platform",
401        "//tensorflow/python:util",
402    ],
403)
404
405cuda_py_test(
406    name = "single_image_random_dot_stereograms_ops_test",
407    size = "medium",
408    srcs = ["python/kernel_tests/single_image_random_dot_stereograms_ops_test.py"],
409    additional_deps = [
410        ":distort_image_py",
411        ":image_py",
412        ":single_image_random_dot_stereograms_py",
413        "//third_party/py/numpy",
414        "//tensorflow/python:array_ops",
415        "//tensorflow/python:framework_for_generated_wrappers",
416        "//tensorflow/python:framework_test_lib",
417        "//tensorflow/python:math_ops",
418        "//tensorflow/python:platform_test",
419    ],
420)
421