xref: /aosp_15_r20/external/tensorflow/tensorflow/python/debug/lib/BUILD (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1load("//tensorflow:tensorflow.bzl", "cuda_py_test")
2load("//tensorflow:tensorflow.bzl", "py_binary", "py_test")
3
4package(
5    default_visibility = ["//tensorflow:internal"],
6    licenses = ["notice"],
7)
8
9py_library(
10    name = "op_callbacks_common",
11    srcs = ["op_callbacks_common.py"],
12    srcs_version = "PY3",
13)
14
15py_library(
16    name = "check_numerics_callback",
17    srcs = ["check_numerics_callback.py"],
18    srcs_version = "PY3",
19    deps = [
20        ":op_callbacks_common",
21        ":source_utils",
22        "//tensorflow/python:array_ops",
23        "//tensorflow/python:debug_ops_gen",
24        "//tensorflow/python:op_callbacks",
25        "//third_party/py/numpy",
26    ],
27)
28
29py_library(
30    name = "dumping_callback",
31    srcs = ["dumping_callback.py"],
32    srcs_version = "PY3",
33    deps = [
34        ":debug_events_writer",
35        ":op_callbacks_common",
36        ":source_utils",
37        "//tensorflow/python:array_ops",
38        "//tensorflow/python:debug_ops_gen",
39        "//tensorflow/python:op_callbacks",
40        "//third_party/py/numpy",
41    ],
42)
43
44py_library(
45    name = "dumping_callback_test_lib",
46    srcs = ["dumping_callback_test_lib.py"],
47    srcs_version = "PY3",
48    deps = [
49        ":check_numerics_callback",
50        ":debug_events_reader",
51        ":dumping_callback",
52        "//third_party/py/numpy",
53    ],
54)
55
56py_library(
57    name = "common",
58    srcs = ["common.py"],
59    srcs_version = "PY3",
60)
61
62py_library(
63    name = "debug_events_reader",
64    srcs = ["debug_events_reader.py"],
65    srcs_version = "PY3",
66    deps = [
67        "//tensorflow/core:protos_all_py",
68        "//tensorflow/python:framework",
69        "//tensorflow/python:lib",
70    ],
71)
72
73py_library(
74    name = "debug_events_monitors",
75    srcs = ["debug_events_monitors.py"],
76    srcs_version = "PY3",
77    deps = [
78        "//tensorflow/core:protos_all_py",
79        "//tensorflow/python:framework",
80        "//tensorflow/python:lib",
81        "//third_party/py/numpy",
82    ],
83)
84
85py_library(
86    name = "debug_events_writer",
87    srcs = ["debug_events_writer.py"],
88    srcs_version = "PY3",
89    deps = [
90        "//tensorflow/core:protos_all_py",
91        "//tensorflow/python:framework",
92    ],
93)
94
95py_library(
96    name = "debug_graphs",
97    srcs = ["debug_graphs.py"],
98    srcs_version = "PY3",
99    deps = [
100        "//tensorflow/core:protos_all_py",
101        "//tensorflow/python:framework",
102        "//tensorflow/python:op_def_registry",
103        "//tensorflow/python:platform",
104        "//tensorflow/python:tensor_util",
105    ],
106)
107
108py_library(
109    name = "debug_data",
110    srcs = ["debug_data.py"],
111    srcs_version = "PY3",
112    visibility = [
113        "//tensorflow:internal",
114        "//third_party/py/tf_slim:__subpackages__",
115    ],
116    deps = [
117        ":debug_graphs",
118        "//tensorflow/core:protos_all_py",
119        "//tensorflow/python:framework",
120        "//tensorflow/python:op_def_registry",
121        "//tensorflow/python:platform",
122        "//tensorflow/python:tensor_util",
123        "//third_party/py/numpy",
124    ],
125)
126
127py_library(
128    name = "debug_gradients",
129    srcs = ["debug_gradients.py"],
130    srcs_version = "PY3",
131    deps = [
132        ":debug_data",
133        ":debug_graphs",
134        "//tensorflow/python:array_ops",
135        "//tensorflow/python:framework",
136        "//tensorflow/python:platform",
137    ],
138)
139
140py_library(
141    name = "debug_utils",
142    srcs = ["debug_utils.py"],
143    srcs_version = "PY3",
144)
145
146py_binary(
147    name = "grpc_tensorflow_server",
148    srcs = ["grpc_tensorflow_server.py"],
149    python_version = "PY3",
150    srcs_version = "PY3",
151    deps = [":grpc_tensorflow_server_lib"],
152)
153
154py_library(
155    name = "grpc_tensorflow_server_lib",
156    srcs = [
157        "grpc_tensorflow_server.py",
158    ],
159    srcs_version = "PY3",
160    deps = [
161        "//tensorflow/core:protos_all_py",
162        "//tensorflow/python:platform",
163        "//tensorflow/python:training",
164    ],
165)
166
167py_library(
168    name = "source_utils",
169    srcs = ["source_utils.py"],
170    srcs_version = "PY3",
171    deps = [
172        ":profiling",
173        "//third_party/py/numpy",
174    ],
175)
176
177py_library(
178    name = "source_remote",
179    srcs = ["source_remote.py"],
180    srcs_version = "PY3",
181    deps = [
182        ":common",
183        ":debug_service_pb2_grpc",
184        "//tensorflow/core/debug:debug_service_proto_py",
185        "//tensorflow/python/profiler:tfprof_logger",
186    ],
187)
188
189py_library(
190    name = "profiling",
191    srcs = ["profiling.py"],
192    srcs_version = "PY3",
193)
194
195py_test(
196    name = "common_test",
197    size = "small",
198    srcs = ["common_test.py"],
199    python_version = "PY3",
200    srcs_version = "PY3",
201    deps = [
202        ":common",
203        "//tensorflow/python:client",
204        "//tensorflow/python:client_testlib",
205        "//tensorflow/python:constant_op",
206        "//tensorflow/python:platform_test",
207    ],
208)
209
210py_test(
211    name = "debug_events_monitors_test",
212    size = "medium",
213    srcs = ["debug_events_monitors_test.py"],
214    python_version = "PY3",
215    srcs_version = "PY3",
216    tags = [
217        "no_windows",  # b/142475891
218    ],
219    deps = [
220        ":debug_events_monitors",
221        ":debug_events_reader",
222        ":debug_events_writer",
223        ":dumping_callback",
224        ":dumping_callback_test_lib",
225        "//tensorflow/core:protos_all_py",
226        "//tensorflow/python:client_testlib",
227        "//tensorflow/python:framework_test_lib",
228        "//third_party/py/numpy",
229    ],
230)
231
232py_test(
233    name = "debug_events_writer_test",
234    size = "medium",
235    srcs = ["debug_events_writer_test.py"],
236    python_version = "PY3",
237    srcs_version = "PY3",
238    tags = [
239        "no_windows",  # b/142475891
240    ],
241    deps = [
242        ":debug_events_reader",
243        ":debug_events_writer",
244        ":dumping_callback_test_lib",
245        "//tensorflow/core:protos_all_py",
246        "//tensorflow/python:client_testlib",
247        "//tensorflow/python:framework_test_lib",
248    ],
249)
250
251py_test(
252    name = "debug_graphs_test",
253    size = "small",
254    srcs = ["debug_graphs_test.py"],
255    python_version = "PY3",
256    srcs_version = "PY3",
257    deps = [
258        ":debug_graphs",
259        "//tensorflow/python:client_testlib",
260        "//tensorflow/python:framework_test_lib",
261    ],
262)
263
264py_test(
265    name = "debug_data_test",
266    size = "small",
267    srcs = ["debug_data_test.py"],
268    python_version = "PY3",
269    srcs_version = "PY3",
270    tags = ["no_windows"],  # TODO(b/184424727): Enable this test on Windows.
271    deps = [
272        ":debug_data",
273        "//tensorflow/core:protos_all_py",
274        "//tensorflow/python:client_testlib",
275        "//tensorflow/python:framework_test_lib",
276        "//tensorflow/python:platform",
277        "//tensorflow/python:platform_test",
278        "//third_party/py/numpy",
279    ],
280)
281
282cuda_py_test(
283    name = "check_numerics_callback_test",
284    size = "medium",
285    srcs = ["check_numerics_callback_test.py"],
286    python_version = "PY3",
287    tags = [
288        "no_mac",  # TODO(b/175322370): Detected Infinity or NaN in output 0 of graph op "RealDiv"
289        "no_windows",
290    ],
291    deps = [
292        ":check_numerics_callback",
293        "//tensorflow/python:framework_test_lib",
294        "//tensorflow/python:math_ops",
295        "//tensorflow/python:platform_test",
296        "//tensorflow/python:variables",
297        "//third_party/py/numpy",
298    ],
299)
300
301cuda_py_test(
302    name = "dumping_callback_test",
303    size = "medium",
304    srcs = ["dumping_callback_test.py"],
305    python_version = "PY3",
306    shard_count = 4,
307    tags = [
308        "no_windows",  # TODO(b/142475891): Enable this test on Windows.
309    ],
310    xla_enable_strict_auto_jit = False,  # Node names are different with autojit
311    deps = [
312        ":debug_events_reader",
313        ":debug_events_writer",
314        ":dumping_callback",
315        ":dumping_callback_test_lib",
316        "//tensorflow/python:framework_test_lib",
317        "//tensorflow/python:math_ops",
318        "//tensorflow/python:platform_test",
319        "//tensorflow/python:variables",
320        "//third_party/py/numpy",
321    ],
322)
323
324cuda_py_test(
325    name = "debug_v2_ops_test",
326    size = "medium",
327    srcs = ["debug_v2_ops_test.py"],
328    python_version = "PY3",
329    tags = ["no_windows_gpu"],
330    deps = [
331        ":debug_events_reader",
332        ":debug_events_writer",
333        ":dumping_callback_test_lib",
334        "//tensorflow/python:debug_ops_gen",
335        "//tensorflow/python:framework_test_lib",
336        "//tensorflow/python:gradients",
337        "//tensorflow/python:math_ops",
338        "//tensorflow/python:platform_test",
339        "//tensorflow/python:training",
340        "//tensorflow/python:variables",
341        "//tensorflow/python/data/ops:dataset_ops",
342        "//third_party/py/numpy",
343    ],
344)
345
346cuda_py_test(
347    name = "debug_gradients_test",
348    size = "small",
349    srcs = ["debug_gradients_test.py"],
350    python_version = "PY3",
351    xla_enable_strict_auto_jit = False,  # Node names are different with autojit
352    deps = [
353        ":debug_data",
354        ":debug_gradients",
355        ":debug_utils",
356        "//tensorflow/python:client",
357        "//tensorflow/python:framework_test_lib",
358        "//tensorflow/python:gradients",
359        "//tensorflow/python:math_ops",
360        "//tensorflow/python:platform_test",
361        "//tensorflow/python:training",
362        "//tensorflow/python:variables",
363    ],
364)
365
366py_test(
367    name = "debug_utils_test",
368    size = "small",
369    srcs = ["debug_utils_test.py"],
370    python_version = "PY3",
371    srcs_version = "PY3",
372    deps = [
373        ":debug_utils",
374        "//tensorflow/core:protos_all_py",
375        "//tensorflow/python:client",
376        "//tensorflow/python:framework_for_generated_wrappers",
377        "//tensorflow/python:framework_test_lib",
378        "//tensorflow/python:math_ops",
379        "//tensorflow/python:platform_test",
380        "//tensorflow/python:resource_variable_ops",
381        "//tensorflow/python:variables",
382        "//third_party/py/numpy",
383    ],
384)
385
386py_test(
387    name = "source_utils_test",
388    size = "small",
389    srcs = ["source_utils_test.py"],
390    python_version = "PY3",
391    srcs_version = "PY3",
392    tags = [
393        "no_windows",
394    ],
395    deps = [
396        ":debug_data",
397        ":debug_utils",
398        ":source_utils",
399        "//tensorflow/core:protos_all_py",
400        "//tensorflow/python:client",
401        "//tensorflow/python:cond_v2",
402        "//tensorflow/python:constant_op",
403        "//tensorflow/python:control_flow_ops",
404        "//tensorflow/python:framework_ops",
405        "//tensorflow/python:framework_test_lib",
406        "//tensorflow/python:math_ops",
407        "//tensorflow/python:platform_test",
408        "//tensorflow/python:resource_variable_ops",
409        "//tensorflow/python:util",
410        "//tensorflow/python:variables",
411        "//tensorflow/python:while_v2",
412        "//third_party/py/numpy",
413    ],
414)
415
416py_test(
417    name = "source_remote_test",
418    size = "small",
419    srcs = ["source_remote_test.py"],
420    python_version = "PY3",
421    srcs_version = "PY3",
422    tags = [
423        "no_windows",
424        "oss_serial",
425    ],
426    deps = [
427        ":grpc_debug_test_server",
428        ":source_remote",
429        ":source_utils",
430        "//tensorflow/core:protos_all_py",
431        "//tensorflow/python:client",
432        "//tensorflow/python:client_testlib",
433        "//tensorflow/python:framework_ops",
434        "//tensorflow/python:framework_test_lib",
435        "//tensorflow/python:math_ops",
436        "//tensorflow/python:platform_test",
437        "//tensorflow/python:resource_variable_ops",
438        "//tensorflow/python:util",
439        "//tensorflow/python:variables",
440    ],
441)
442
443py_test(
444    name = "profiling_test",
445    size = "small",
446    srcs = ["profiling_test.py"],
447    python_version = "PY3",
448    srcs_version = "PY3",
449    deps = [
450        ":profiling",
451        "//tensorflow/core:protos_all_py",
452        "//tensorflow/python:framework_test_lib",
453        "//tensorflow/python:platform_test",
454    ],
455)
456
457py_library(
458    name = "session_debug_testlib",
459    srcs = ["session_debug_testlib.py"],
460    srcs_version = "PY3",
461    deps = [
462        ":debug_data",
463        ":debug_graphs",
464        ":debug_utils",
465        "//tensorflow/core:protos_all_py",
466        "//tensorflow/python:array_ops",
467        "//tensorflow/python:client",
468        "//tensorflow/python:client_testlib",
469        "//tensorflow/python:control_flow_ops",
470        "//tensorflow/python:data_flow_ops",
471        "//tensorflow/python:errors",
472        "//tensorflow/python:framework_for_generated_wrappers",
473        "//tensorflow/python:framework_test_lib",
474        "//tensorflow/python:math_ops",
475        "//tensorflow/python:parsing_ops",
476        "//tensorflow/python:platform_test",
477        "//tensorflow/python:rnn",
478        "//tensorflow/python:rnn_cell",
479        "//tensorflow/python:state_ops",
480        "//tensorflow/python:tensor_array_grad",
481        "//tensorflow/python:training",
482        "//tensorflow/python:variables",
483        "//third_party/py/numpy",
484    ],
485)
486
487py_library(
488    name = "debug_service_pb2_grpc",
489    srcs = ["debug_service_pb2_grpc.py"],
490    srcs_version = "PY3",
491    deps = [
492        "//tensorflow/core/debug:debug_service_proto_py",
493    ],
494)
495
496py_library(
497    name = "grpc_debug_server",
498    srcs = ["grpc_debug_server.py"],
499    srcs_version = "PY3",
500    visibility = ["//visibility:public"],
501    deps = [
502        ":debug_graphs",
503        ":debug_service_pb2_grpc",
504        "//tensorflow/core/debug:debug_service_proto_py",
505    ],
506)
507
508py_library(
509    name = "grpc_debug_test_server",
510    srcs = ["grpc_debug_test_server.py"],
511    srcs_version = "PY3",
512    deps = [
513        ":debug_data",
514        ":debug_utils",
515        ":grpc_debug_server",
516        "//tensorflow/core:protos_all_py",
517        "//tensorflow/python:client",
518        "//tensorflow/python:constant_op",
519        "//tensorflow/python:errors",
520        "//tensorflow/python:variables",
521    ],
522)
523
524cuda_py_test(
525    name = "debug_grappler_test",
526    size = "small",
527    srcs = ["debug_grappler_test.py"],
528    python_version = "PY3",
529    xla_enable_strict_auto_jit = False,  # Tests TF:Classic implementation.
530    deps = [
531        ":debug_data",
532        ":debug_utils",
533        "//tensorflow/python:client",
534        "//tensorflow/python:framework_for_generated_wrappers",
535        "//tensorflow/python:math_ops",
536        "//tensorflow/python:platform_test",
537        "//tensorflow/python:variables",
538    ],
539)
540
541cuda_py_test(
542    name = "session_debug_file_test",
543    size = "small",
544    srcs = ["session_debug_file_test.py"],
545    python_version = "PY3",
546    tags = ["notsan"],
547    xla_enable_strict_auto_jit = False,  # Node names are different with autojit
548    deps = [
549        ":debug_data",
550        ":debug_utils",
551        ":session_debug_testlib",
552        "//tensorflow/python:client",
553        "//tensorflow/python:framework_for_generated_wrappers",
554        "//tensorflow/python:math_ops",
555        "//tensorflow/python:platform_test",
556        "//tensorflow/python:variables",
557    ],
558)
559
560cuda_py_test(
561    name = "debug_graph_reconstruction_test",
562    size = "small",
563    srcs = ["debug_graph_reconstruction_test.py"],
564    python_version = "PY3",
565    xla_enable_strict_auto_jit = False,  # Node names are different with autojit
566    deps = [
567        ":debug_data",
568        ":debug_utils",
569        "//tensorflow/python:client",
570        "//tensorflow/python:client_testlib",
571        "//tensorflow/python:control_flow_ops",
572        "//tensorflow/python:framework_test_lib",
573        "//tensorflow/python:math_ops",
574        "//tensorflow/python:training",
575        "//tensorflow/python:variables",
576    ],
577)
578
579cuda_py_test(
580    name = "session_debug_multi_gpu_test",
581    size = "small",
582    srcs = ["session_debug_multi_gpu_test.py"],
583    python_version = "PY3",
584    tags = [
585        "no_windows",  # TODO(b/184424727): Re-enable this.
586        "no_windows_gpu",
587    ],
588    xla_enable_strict_auto_jit = False,  # Node names are different with autojit
589    deps = [
590        ":debug_data",
591        ":debug_utils",
592        "//tensorflow/python:client",
593        "//tensorflow/python:framework_for_generated_wrappers",
594        "//tensorflow/python:framework_test_lib",
595        "//tensorflow/python:math_ops",
596        "//tensorflow/python:platform_test",
597        "//tensorflow/python:variables",
598    ],
599)
600