• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Tests of TensorFlow NN kernels written using the Python API.
2
3load("//tensorflow:tensorflow.bzl", "cuda_py_test")
4
5# buildifier: disable=same-origin-load
6load("//tensorflow:tensorflow.bzl", "tf_py_test")
7
8package(
9    default_visibility = ["//tensorflow:internal"],
10    licenses = ["notice"],
11)
12
13CONV_TEST_BASENAMES = [
14    ":atrous_conv2d_test",
15    ":conv1d_test",
16    ":conv1d_transpose_test",
17    ":conv2d_backprop_filter_grad_test",
18    ":conv3d_transpose_test",
19    ":conv3d_backprop_filter_v2_grad_test",
20    ":conv_ops_3d_test",
21    ":conv_ops_test",
22    ":depthwise_conv_op_test",
23    ":conv2d_transpose_test",
24]
25
26test_suite(
27    name = "conv_tests",
28    tests = [basename for basename in CONV_TEST_BASENAMES] +
29            [basename + "_gpu" for basename in CONV_TEST_BASENAMES],
30)
31
32cuda_py_test(
33    name = "atrous_conv2d_test",
34    size = "medium",
35    srcs = ["atrous_conv2d_test.py"],
36    shard_count = 2,
37    tags = [
38        "no_gpu",  #  Flaky: b/80127739, b/127001953
39    ],
40    deps = [
41        "//tensorflow/python:array_ops",
42        "//tensorflow/python:client_testlib",
43        "//tensorflow/python:framework_for_generated_wrappers",
44        "//tensorflow/python:nn",
45        "//tensorflow/python:nn_grad",
46        "//tensorflow/python:nn_ops",
47        "//third_party/py/numpy",
48    ],
49)
50
51cuda_py_test(
52    name = "atrous_convolution_test",
53    size = "medium",
54    srcs = ["atrous_convolution_test.py"],
55    tags = [
56        "manual",
57        "no_cuda_asan",
58    ],
59    deps = [
60        "//tensorflow/python:array_ops",
61        "//tensorflow/python:client_testlib",
62        "//tensorflow/python:framework_for_generated_wrappers",
63        "//tensorflow/python:nn_grad",
64        "//tensorflow/python:nn_ops",
65        "//third_party/py/numpy",
66    ],
67)
68
69cuda_py_test(
70    name = "betainc_op_test",
71    size = "small",
72    srcs = ["betainc_op_test.py"],
73    xla_tags = [
74        "no_cuda_asan",  # times out
75    ],
76    deps = [
77        "//tensorflow/python:array_ops",
78        "//tensorflow/python:client_testlib",
79        "//tensorflow/python:framework_for_generated_wrappers",
80        "//tensorflow/python:math_ops",
81        "//tensorflow/python:platform",
82        "//third_party/py/numpy",
83    ],
84)
85
86py_library(
87    name = "bias_op_base",
88    srcs = ["bias_op_base.py"],
89    srcs_version = "PY3",
90    deps = [
91        "//tensorflow/python:array_ops",
92        "//tensorflow/python:client_testlib",
93        "//tensorflow/python:framework_for_generated_wrappers",
94        "//tensorflow/python:gradients",
95        "//tensorflow/python:nn_grad",
96        "//tensorflow/python:nn_ops",
97        "//third_party/py/numpy",
98    ],
99)
100
101cuda_py_test(
102    name = "bias_op_d9m_test",
103    size = "medium",
104    srcs = ["bias_op_d9m_test.py"],
105    shard_count = 2,
106    deps = [
107        ":bias_op_base",
108    ],
109)
110
111cuda_py_test(
112    name = "bias_op_test",
113    size = "medium",
114    srcs = ["bias_op_test.py"],
115    deps = [
116        ":bias_op_base",
117    ],
118)
119
120cuda_py_test(
121    name = "conv1d_test",
122    size = "small",
123    srcs = ["conv1d_test.py"],
124    deps = [
125        "//tensorflow/python:array_ops",
126        "//tensorflow/python:client_testlib",
127        "//tensorflow/python:framework_for_generated_wrappers",
128        "//tensorflow/python:nn_ops",
129    ],
130)
131
132cuda_py_test(
133    name = "conv1d_transpose_test",
134    size = "small",
135    srcs = ["conv1d_transpose_test.py"],
136    deps = [
137        "//tensorflow/python:client",
138        "//tensorflow/python:client_testlib",
139        "//tensorflow/python:framework_for_generated_wrappers",
140        "//tensorflow/python:nn_ops",
141        "//third_party/py/numpy",
142    ],
143)
144
145cuda_py_test(
146    name = "conv2d_backprop_filter_grad_test",
147    size = "medium",
148    srcs = ["conv2d_backprop_filter_grad_test.py"],
149    shard_count = 2,
150    tags = [
151        "optonly",  # flaky timeouts unless optimized
152    ],
153    deps = [
154        "//tensorflow/python:array_ops",
155        "//tensorflow/python:client_testlib",
156        "//tensorflow/python:framework_for_generated_wrappers",
157        "//tensorflow/python:nn_grad",
158        "//tensorflow/python:nn_ops",
159        "//third_party/py/numpy",
160    ],
161)
162
163cuda_py_test(
164    name = "conv2d_transpose_test",
165    size = "small",
166    srcs = ["conv2d_transpose_test.py"],
167
168    # TODO(b/144432983): S32 convolutions should not be auto-clustered, only
169    # crashes tests.
170    xla_enable_strict_auto_jit = False,
171    deps = [
172        "//tensorflow/python:client",
173        "//tensorflow/python:client_testlib",
174        "//tensorflow/python:framework_for_generated_wrappers",
175        "//tensorflow/python:nn_grad",
176        "//tensorflow/python:nn_ops",
177        "//third_party/py/numpy",
178    ],
179)
180
181cuda_py_test(
182    name = "conv3d_backprop_filter_v2_grad_test",
183    size = "small",
184    srcs = ["conv3d_backprop_filter_v2_grad_test.py"],
185    deps = [
186        "//tensorflow/python:array_ops",
187        "//tensorflow/python:client_testlib",
188        "//tensorflow/python:framework_for_generated_wrappers",
189        "//tensorflow/python:nn_grad",
190        "//tensorflow/python:nn_ops",
191        "//third_party/py/numpy",
192    ],
193)
194
195cuda_py_test(
196    name = "conv3d_transpose_test",
197    size = "medium",
198    srcs = ["conv3d_transpose_test.py"],
199    deps = [
200        "//tensorflow/python:client_testlib",
201        "//tensorflow/python:framework_for_generated_wrappers",
202        "//tensorflow/python:nn_grad",
203        "//tensorflow/python:nn_ops",
204        "//third_party/py/numpy",
205    ],
206)
207
208cuda_py_test(
209    name = "conv_ops_3d_test",
210    size = "medium",
211    srcs = ["conv_ops_3d_test.py"],
212    shard_count = 30,
213    tags = ["no_cuda11"],
214    deps = [
215        "//tensorflow/python:client_testlib",
216        "//tensorflow/python:framework_for_generated_wrappers",
217        "//tensorflow/python:nn_grad",
218        "//tensorflow/python:nn_ops",
219    ],
220)
221
222cuda_py_test(
223    name = "conv_ops_test",
224    size = "medium",
225    srcs = ["conv_ops_test.py"],
226    shard_count = 4,
227    tags = [
228        "optonly",  # times out
229    ],
230    deps = [
231        "//tensorflow/python:array_ops",
232        "//tensorflow/python:client",
233        "//tensorflow/python:client_testlib",
234        "//tensorflow/python:errors",
235        "//tensorflow/python:framework_for_generated_wrappers",
236        "//tensorflow/python:framework_test_lib",
237        "//tensorflow/python:nn",
238        "//tensorflow/python:nn_grad",
239        "//tensorflow/python:nn_ops",
240        "//tensorflow/python:platform",
241        "//tensorflow/python:random_ops",
242        "//tensorflow/python:variables",
243        "//third_party/py/numpy",
244    ],
245)
246
247tf_py_test(
248    name = "ctc_decoder_ops_test",
249    size = "small",
250    srcs = ["ctc_decoder_ops_test.py"],
251    deps = [
252        "//tensorflow/python:array_ops",
253        "//tensorflow/python:client_testlib",
254        "//tensorflow/python:ctc_ops",
255        "//tensorflow/python:framework_for_generated_wrappers",
256        "//third_party/py/numpy",
257    ],
258)
259
260cuda_py_test(
261    name = "ctc_loss_op_test",
262    size = "medium",
263    srcs = ["ctc_loss_op_test.py"],
264    xla_enable_strict_auto_jit = False,  # b/148153828
265    deps = [
266        "//tensorflow/python:client_testlib",
267        "//tensorflow/python:ctc_ops",
268        "//tensorflow/python:framework",
269        "//tensorflow/python:framework_for_generated_wrappers",
270        "//tensorflow/python:gradients",
271        "//third_party/py/numpy",
272    ],
273)
274
275py_library(
276    name = "cudnn_deterministic_base",
277    srcs = ["cudnn_deterministic_base.py"],
278    srcs_version = "PY3",
279    deps = [
280        "//tensorflow/python:client_testlib",
281        "//tensorflow/python:constant_op",
282        "//tensorflow/python:dtypes",
283        "//tensorflow/python:nn_ops",
284        "//tensorflow/python/eager:backprop",
285        "//third_party/py/numpy",
286    ],
287)
288
289cuda_py_test(
290    name = "cudnn_deterministic_ops_test",
291    size = "small",
292    srcs = ["cudnn_deterministic_ops_test.py"],
293    tags = [
294        "no_cuda_asan",  # TODO(b/171509035): re-enable.
295    ],
296    xla_enable_strict_auto_jit = True,
297    deps = [
298        ":cudnn_deterministic_base",
299    ],
300)
301
302cuda_py_test(
303    name = "cudnn_d9m_test",
304    size = "small",
305    srcs = ["cudnn_d9m_test.py"],
306    tags = [
307        "no_cuda_asan",  # TODO(b/171509035): re-enable.
308    ],
309    deps = [
310        ":cudnn_deterministic_base",
311    ],
312)
313
314py_library(
315    name = "depthwise_conv_op_base",
316    srcs = ["depthwise_conv_op_base.py"],
317    deps = [
318        "//tensorflow/python:array_ops",
319        "//tensorflow/python:client_testlib",
320        "//tensorflow/python:framework_for_generated_wrappers",
321        "//tensorflow/python:nn",
322        "//tensorflow/python:nn_grad",
323        "//tensorflow/python:nn_ops",
324        "//third_party/py/numpy",
325    ],
326)
327
328cuda_py_test(
329    name = "depthwise_conv_op_d9m_test",
330    size = "medium",  # http://b/30603882
331    timeout = "long",
332    srcs = ["depthwise_conv_op_d9m_test.py"],
333    shard_count = 8,
334    deps = [
335        ":depthwise_conv_op_base",
336        "//tensorflow/python:random_ops",
337        "//tensorflow/python/eager:backprop",
338    ],
339)
340
341cuda_py_test(
342    name = "depthwise_conv_op_test",
343    size = "medium",  # http://b/30603882
344    timeout = "long",
345    srcs = ["depthwise_conv_op_test.py"],
346    shard_count = 8,
347    deps = [
348        ":depthwise_conv_op_base",
349    ],
350)
351
352cuda_py_test(
353    name = "embedding_ops_test",
354    size = "medium",
355    srcs = ["embedding_ops_test.py"],
356    shard_count = 20,
357    tags = [
358        "no_cuda_asan",  # Size limit: b/192505612
359    ],
360    xla_tags = [
361        "no_cuda_asan",  # Size limit: b/192505612
362    ],
363    deps = [
364        "//tensorflow/python:array_ops",
365        "//tensorflow/python:client_testlib",
366        "//tensorflow/python:data_flow_ops",
367        "//tensorflow/python:embedding_ops",
368        "//tensorflow/python:framework",
369        "//tensorflow/python:framework_for_generated_wrappers",
370        "//tensorflow/python:init_ops",
371        "//tensorflow/python:linalg_ops",
372        "//tensorflow/python:math_ops",
373        "//tensorflow/python:partitioned_variables",
374        "//tensorflow/python:platform",
375        "//tensorflow/python:state_ops",
376        "//tensorflow/python:util",
377        "//tensorflow/python:variable_scope",
378        "//tensorflow/python:variables",
379        "//third_party/py/numpy",
380    ],
381)
382
383tf_py_test(
384    name = "fractional_avg_pool_op_test",
385    size = "small",
386    srcs = ["fractional_avg_pool_op_test.py"],
387    shard_count = 5,
388    deps = [
389        "//tensorflow/python:array_ops",
390        "//tensorflow/python:client_testlib",
391        "//tensorflow/python:framework_for_generated_wrappers",
392        "//tensorflow/python:nn_grad",
393        "//tensorflow/python:nn_ops",
394        "//tensorflow/python:nn_ops_gen",
395        "//third_party/py/numpy",
396    ],
397)
398
399tf_py_test(
400    name = "fractional_max_pool_op_test",
401    size = "small",
402    srcs = ["fractional_max_pool_op_test.py"],
403    shard_count = 5,
404    deps = [
405        "//tensorflow/python:array_ops",
406        "//tensorflow/python:client_testlib",
407        "//tensorflow/python:framework_for_generated_wrappers",
408        "//tensorflow/python:nn_grad",
409        "//tensorflow/python:nn_ops",
410        "//tensorflow/python:nn_ops_gen",
411        "//third_party/py/numpy",
412    ],
413)
414
415tf_py_test(
416    name = "losses_test",
417    size = "medium",
418    srcs = ["losses_test.py"],
419    deps = [
420        "//tensorflow/python:array_ops",
421        "//tensorflow/python:client_testlib",
422        "//tensorflow/python:errors",
423        "//tensorflow/python:framework",
424        "//tensorflow/python:framework_for_generated_wrappers",
425        "//tensorflow/python:init_ops",
426        "//tensorflow/python:math_ops",
427        "//tensorflow/python:training",
428        "//tensorflow/python:variable_scope",
429        "//tensorflow/python:variables",
430        "//tensorflow/python/ops/losses",
431        "//third_party/py/numpy",
432    ],
433)
434
435cuda_py_test(
436    name = "lrn_op_test",
437    size = "medium",
438    srcs = ["lrn_op_test.py"],
439    deps = [
440        "//tensorflow/python:array_ops",
441        "//tensorflow/python:client_testlib",
442        "//tensorflow/python:framework_for_generated_wrappers",
443        "//tensorflow/python:gradients",
444        "//tensorflow/python:nn",
445        "//tensorflow/python:nn_grad",
446        "//third_party/py/numpy",
447    ],
448)
449
450cuda_py_test(
451    name = "morphological_ops_test",
452    size = "small",
453    srcs = ["morphological_ops_test.py"],
454    xla_tags = [
455        "no_cuda_asan",  # times out
456    ],
457    deps = [
458        "//tensorflow/python:client_testlib",
459        "//tensorflow/python:framework_for_generated_wrappers",
460        "//tensorflow/python:nn_grad",
461        "//tensorflow/python:nn_ops",
462        "//third_party/py/numpy",
463    ],
464)
465
466cuda_py_test(
467    name = "nth_element_op_test",
468    size = "small",
469    srcs = ["nth_element_op_test.py"],
470    deps = [
471        "//tensorflow/python:array_ops",
472        "//tensorflow/python:client_testlib",
473        "//tensorflow/python:framework_for_generated_wrappers",
474        "//tensorflow/python:gradients",
475        "//tensorflow/python:nn_grad",
476        "//tensorflow/python:nn_ops",
477        "//third_party/py/numpy",
478    ],
479)
480
481cuda_py_test(
482    name = "pool_test",
483    size = "medium",
484    srcs = ["pool_test.py"],
485    xla_tags = [
486        "no_cuda_asan",  # times out
487    ],
488    deps = [
489        "//tensorflow/python:client_testlib",
490        "//tensorflow/python:framework_for_generated_wrappers",
491        "//tensorflow/python:nn_grad",
492        "//tensorflow/python:nn_ops",
493        "//third_party/py/numpy",
494    ],
495)
496
497cuda_py_test(
498    name = "pooling_ops_3d_test",
499    size = "medium",
500    srcs = ["pooling_ops_3d_test.py"],
501    deps = [
502        "//tensorflow/python:client_testlib",
503        "//tensorflow/python:dtypes",
504        "//tensorflow/python:framework_for_generated_wrappers",
505        "//tensorflow/python:nn_grad",
506        "//tensorflow/python:nn_ops",
507        "//third_party/py/numpy",
508    ],
509)
510
511cuda_py_test(
512    name = "pooling_ops_test",
513    size = "medium",
514    srcs = ["pooling_ops_test.py"],
515    shard_count = 10,
516    # Some operations in this test can only be checked on sm61+.
517    tags = ["prefer-sm70"],
518    deps = [
519        "//tensorflow/python:array_ops",
520        "//tensorflow/python:client_testlib",
521        "//tensorflow/python:errors",
522        "//tensorflow/python:framework_for_generated_wrappers",
523        "//tensorflow/python:framework_test_lib",
524        "//tensorflow/python:nn_grad",
525        "//tensorflow/python:nn_ops",
526        "//tensorflow/python:nn_ops_gen",
527        "//third_party/py/numpy",
528    ],
529)
530
531cuda_py_test(
532    name = "relu_op_test",
533    size = "small",
534    srcs = ["relu_op_test.py"],
535    xla_tags = [
536        "no_cuda_asan",  # times out
537    ],
538    deps = [
539        "//tensorflow/python:client_testlib",
540        "//tensorflow/python:framework_for_generated_wrappers",
541        "//tensorflow/python:nn_grad",
542        "//tensorflow/python:nn_ops",
543        "//tensorflow/python:random_ops",
544        "//tensorflow/python:tf2",
545        "//tensorflow/python:training",
546        "//tensorflow/python:variables",
547        "//tensorflow/python/eager:backprop",
548        "//third_party/py/numpy",
549    ],
550)
551
552cuda_py_test(
553    name = "rnn_cell_test",
554    size = "medium",
555    srcs = ["rnn_cell_test.py"],
556    shard_count = 15,
557    tags = ["no_windows"],  # b/139739217
558    deps = [
559        "//tensorflow/python:array_ops",
560        "//tensorflow/python:client_testlib",
561        "//tensorflow/python:control_flow_ops",
562        "//tensorflow/python:control_flow_v2_toggles",
563        "//tensorflow/python:framework_for_generated_wrappers",
564        "//tensorflow/python:framework_test_lib",
565        "//tensorflow/python:gradients",
566        "//tensorflow/python:init_ops",
567        "//tensorflow/python:math_ops",
568        "//tensorflow/python:platform",
569        "//tensorflow/python:rnn",
570        "//tensorflow/python:rnn_cell",
571        "//tensorflow/python:tensor_array_ops",
572        "//tensorflow/python:util",
573        "//tensorflow/python:variable_scope",
574        "//tensorflow/python:variables",
575        "//tensorflow/python/eager:context",
576        "//tensorflow/python/eager:def_function",
577        "//tensorflow/python/saved_model:load",
578        "//tensorflow/python/saved_model:save",
579        "//tensorflow/python/trackable:autotrackable",
580        "//third_party/py/numpy",
581        "@absl_py//absl/testing:parameterized",
582    ],
583)
584
585cuda_py_test(
586    name = "rnn_test",
587    size = "medium",
588    timeout = "long",
589    srcs = ["rnn_test.py"],
590    shard_count = 10,
591    deps = [
592        "//tensorflow/core:protos_all_py",
593        "//tensorflow/python:array_ops",
594        "//tensorflow/python:client",
595        "//tensorflow/python:client_testlib",
596        "//tensorflow/python:control_flow_ops",
597        "//tensorflow/python:data_flow_grad",
598        "//tensorflow/python:framework_for_generated_wrappers",
599        "//tensorflow/python:framework_test_lib",
600        "//tensorflow/python:gradients",
601        "//tensorflow/python:init_ops",
602        "//tensorflow/python:nn_grad",
603        "//tensorflow/python:rnn",
604        "//tensorflow/python:rnn_cell",
605        "//tensorflow/python:sparse_grad",
606        "//tensorflow/python:tensor_array_grad",
607        "//tensorflow/python:tensor_array_ops",
608        "//tensorflow/python:variables",
609        "//tensorflow/python/eager:context",
610        "//third_party/py/numpy",
611    ],
612)
613
614cuda_py_test(
615    name = "softmax_op_test",
616    size = "medium",
617    srcs = ["softmax_op_test.py"],
618    deps = [
619        "//tensorflow/python:array_ops",
620        "//tensorflow/python:client_testlib",
621        "//tensorflow/python:errors",
622        "//tensorflow/python:framework_for_generated_wrappers",
623        "//tensorflow/python:nn_ops",
624        "//third_party/py/numpy",
625    ],
626)
627
628cuda_py_test(
629    name = "softplus_op_test",
630    size = "small",
631    srcs = ["softplus_op_test.py"],
632    deps = [
633        "//tensorflow/python:client_testlib",
634        "//tensorflow/python:framework_for_generated_wrappers",
635        "//tensorflow/python:nn_grad",
636        "//tensorflow/python:nn_ops",
637        "//third_party/py/numpy",
638    ],
639)
640
641cuda_py_test(
642    name = "softsign_op_test",
643    size = "small",
644    srcs = ["softsign_op_test.py"],
645    deps = [
646        "//tensorflow/python:client_testlib",
647        "//tensorflow/python:framework_for_generated_wrappers",
648        "//tensorflow/python:nn_grad",
649        "//tensorflow/python:nn_ops",
650        "//third_party/py/numpy",
651    ],
652)
653
654cuda_py_test(
655    name = "xent_op_d9m_test",
656    size = "medium",
657    srcs = ["xent_op_d9m_test.py"],
658    tags = [
659        "no_windows",  # Flaky on Windows CPU: https://github.com/tensorflow/tensorflow/issues/55827
660        "noasan",  # TODO(b/231484532): Remove after flakiness resolved.
661        "nomac",  # TODO(b/235277289) Flaky on OSX
662        "notsan",  # TODO(b/200548634): Remove.
663    ],
664    xla_enable_strict_auto_jit = False,
665    deps = [
666        ":xent_op_test_base",
667        "//tensorflow/python:client_testlib",
668        "//tensorflow/python:constant_op",
669        "//tensorflow/python:dtypes",
670        "//tensorflow/python:framework_for_generated_wrappers",
671        "//tensorflow/python:nn_grad",
672        "//tensorflow/python:nn_ops",
673        "//tensorflow/python:nn_ops_gen",
674        "//tensorflow/python/eager:backprop",
675        "//third_party/py/numpy",
676    ],
677)
678
679cuda_py_test(
680    name = "xent_op_test",
681    size = "small",
682    srcs = ["xent_op_test.py"],
683    deps = [
684        ":xent_op_test_base",
685        "//tensorflow/python:client_testlib",
686        "//tensorflow/python:framework_for_generated_wrappers",
687        "//tensorflow/python:framework_ops",
688        "//tensorflow/python:nn_ops",
689        "//tensorflow/python:nn_ops_gen",
690        "//third_party/py/numpy",
691    ],
692)
693
694py_library(
695    name = "xent_op_test_base",
696    srcs = ["xent_op_test_base.py"],
697    srcs_version = "PY3",
698    deps = [
699        "//tensorflow/python:array_ops",
700        "//tensorflow/python:client_testlib",
701        "//tensorflow/python:constant_op",
702        "//tensorflow/python:dtypes",
703        "//tensorflow/python:framework_for_generated_wrappers",
704        "//tensorflow/python:framework_ops",
705        "//tensorflow/python:gradients",
706        "//tensorflow/python:math_ops",
707        "//tensorflow/python:nn_grad",
708        "//tensorflow/python:nn_ops",
709        "//tensorflow/python/eager:backprop",
710        "//third_party/py/numpy",
711    ],
712)
713