• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")
2load("@bazel_skylib//rules:build_test.bzl", "build_test")
3load(
4    "//tensorflow:tensorflow.bzl",
5    "if_android",
6    "if_cuda_or_rocm",
7    "if_mobile",
8    "if_not_windows",
9    "if_oss",
10    "tf_cc_binary",
11    "tf_cc_shared_object",
12    "tf_cc_test",
13    "tf_cc_tests",
14    "tf_copts",
15    "tf_cuda_library",
16    "tf_opts_nortti_if_lite_protos",
17)
18load(
19    "//tensorflow/core/kernels/mlir_generated:build_defs.bzl",
20    "if_mlir_generated_cpu_kernels_enabled",
21    "if_mlir_generated_experimental_kernels_enabled",
22    "if_mlir_generated_gpu_kernels_enabled",
23)
24load(
25    "//tensorflow/core/platform:build_config.bzl",
26    "tf_fingerprint_deps",
27    "tf_kernel_tests_linkstatic",
28)
29
30# buildifier: disable=same-origin-load
31load("//tensorflow:tensorflow.bzl", "cc_header_only_library")
32
33# buildifier: disable=same-origin-load
34load("//tensorflow:tensorflow.bzl", "get_compatible_with_portable")
35
36# buildifier: disable=same-origin-load
37load("//tensorflow:tensorflow.bzl", "tf_kernel_library")
38
39# buildifier: disable=same-origin-load
40load("//tensorflow:tensorflow.bzl", "if_nccl")
41
42# buildifier: disable=same-origin-load
43load("//tensorflow:tensorflow.bzl", "tf_disable_ptxas_warning_flags")
44
45# buildifier: disable=same-origin-load
46load("//tensorflow:tensorflow.bzl", "tf_cuda_cc_test")
47
48# buildifier: disable=same-origin-load
49load("//tensorflow:tensorflow.bzl", "tf_cuda_only_cc_test")
50
51# buildifier: disable=same-origin-load
52load("//tensorflow:tensorflow.bzl", "tf_cuda_cc_tests")
53
54# buildifier: disable=same-origin-load
55load("//tensorflow:tensorflow.bzl", "filegroup")
56load(
57    "//tensorflow/core/platform:build_config_root.bzl",
58    "tf_cuda_tests_tags",
59)
60load(
61    "//third_party/mkl:build_defs.bzl",
62    "mkl_deps",
63)
64load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda")
65load(
66    "@local_config_rocm//rocm:build_defs.bzl",
67    "if_rocm",
68)
69
70# Description:
71# Op kernel implementations for TensorFlow.
72#
73# Note: Any test that uses GPU support and which we would like to
74# benchmark should be linked statically so that it can be executed
75# from a py_binary or cuda_py_test test logger.  For such a test,
76# append "_gpu" to the test name to invoke the GPU benchmarks.  Example:
77#
78#   # for CPU tests
79#   $ bazel test --config opt //third_party/tensorflow/core/kernels:my_op_test
80#   # for GPU benchmarks
81#   $ bazel run --config opt --config=cuda //third_party/tensorflow/core/kernels:my_op_test_gpu -- --benchmarks=..
82#
83package(
84    default_visibility = ["//visibility:public"],
85    features = ["-layering_check"],
86    licenses = ["notice"],
87)
88
89package_group(
90    name = "friends",
91    packages = [
92        "//tensorflow/...",
93        "//tensorflow_text/...",
94    ],
95)
96
97package_group(
98    name = "optimizer_helper_friends",
99    packages = [
100        "//learning/brain/research/lather/...",
101        "//learning/clair/alise/...",
102    ],
103)
104
105config_setting(
106    # Add "--define tensorflow_xsmm=1" to your build command to use libxsmm for
107    # sparse matrix multiplications. You will also need appropriate -mavx*
108    # options, as required by specific op you use.
109    name = "xsmm",
110    define_values = {
111        "tensorflow_xsmm": "1",
112    },
113)
114
115config_setting(
116    # Add "--define tensorflow_xsmm_convolutions=1" to your build command to
117    # use libxsmm for forward convolutions. You will also need appropriate
118    # -mavx* # options, as required by specific op you use.
119    name = "xsmm_convolutions",
120    define_values = {
121        "tensorflow_xsmm_convolutions": "1",
122    },
123)
124
125config_setting(
126    # Add "--define tensorflow_xsmm_convolutions=1 --define
127    # tensorflow_xsmm_backward_convolutions=1" to your build command to use libxsmm for
128    # backward convolutions (and possibly more in the future). You will also
129    # need appropriate -mavx* options, as required by specific op you use.
130    name = "xsmm_backward_convolutions",
131    define_values = {
132        "tensorflow_xsmm_backward_convolutions": "1",
133    },
134)
135
136config_setting(
137    # Add "--define tensorflow_mkldnn_contraction_kernel=0" to your build command to disable mkldnn
138    # sgemm in Eigen tensor contractions (matrix multiplications and convolutions). The mkldnn
139    # kernels are generated at runtime and use avx/avx2/fma/avx512 based on cpu status registers
140    # (https://en.wikipedia.org/wiki/CPUID). Default Eigen contraction kernel is
141    # Eigen::internal::gebp_kernel (general block-panel kernel).
142    name = "no_mkldnn_contraction_kernel",
143    define_values = {
144        "tensorflow_mkldnn_contraction_kernel": "0",
145    },
146)
147
148# Public support libraries ----------------------------------------------------
149
150cc_library(
151    name = "assign_op",
152    hdrs = ["assign_op.h"],
153    deps = [
154        "//tensorflow/core:framework",
155        "//third_party/eigen3",
156    ],
157)
158
159tf_kernel_library(
160    name = "strided_slice_op",
161    srcs = [
162        "strided_slice_op.cc",
163        "strided_slice_op_inst_0.cc",
164        "strided_slice_op_inst_1.cc",
165        "strided_slice_op_inst_2.cc",
166        "strided_slice_op_inst_3.cc",
167        "strided_slice_op_inst_4.cc",
168        "strided_slice_op_inst_5.cc",
169        "strided_slice_op_inst_6.cc",
170        "strided_slice_op_inst_7.cc",
171        "strided_slice_op_inst_8.cc",
172    ],
173    hdrs = [
174        "slice_op.h",
175        "strided_slice_op.h",
176        "strided_slice_op_impl.h",
177    ],
178    gpu_srcs = [
179        "slice_op.h",
180        "strided_slice_op.h",
181        "strided_slice_op_impl.h",
182        "strided_slice_op_gpu_impl.h",
183        "strided_slice_op_gpu_int.cu.cc",
184        "strided_slice_op_gpu_complex.cu.cc",
185        "strided_slice_op_gpu_bool.cu.cc",
186        "strided_slice_op_gpu_number_types.cu.cc",
187    ],
188    deps = [
189        ":dense_update_functor",
190        ":inplace_ops",
191        ":ops_util",
192        ":training_op_helpers",
193        ":variable_ops",
194        "//tensorflow/core:framework",
195        "//tensorflow/core:lib",
196        "//tensorflow/core:lib_internal",
197        "//tensorflow/core/framework:bounds_check",
198        "//third_party/eigen3",
199    ],
200)
201
202tf_kernel_library(
203    name = "clustering_ops",
204    prefix = "clustering_ops",
205    deps = [
206        "//tensorflow/core:framework",
207        "//tensorflow/core:framework_headers_lib",
208        "//tensorflow/core:lib",
209    ],
210)
211
212tf_cc_test(
213    name = "clustering_ops_test",
214    srcs = ["clustering_ops_test.cc"],
215    deps = [
216        ":clustering_ops",
217        "//tensorflow/core:clustering_ops_op_lib",
218        "//tensorflow/core:core_cpu",
219        "//tensorflow/core:framework",
220        "//tensorflow/core:lib",
221        "//tensorflow/core:protos_all_cc",
222        "//tensorflow/core:test",
223        "//tensorflow/core:test_main",
224        "//tensorflow/core:testlib",
225    ],
226)
227
228tf_kernel_library(
229    name = "collective_ops",
230    srcs = if_nccl([
231        "collective_nccl.h",
232        "collective_nccl.cc",
233        "collective_nccl_broadcaster.h",
234        "collective_nccl_broadcaster.cc",
235        "collective_nccl_gatherer.h",
236        "collective_nccl_gatherer.cc",
237        "collective_nccl_reducer.h",
238        "collective_nccl_reducer.cc",
239    ]),
240    prefix = "collective_ops",
241    deps = [
242        "//tensorflow/core:framework",
243        "//tensorflow/core:lib",
244        "//tensorflow/core:protos_all_cc",
245        "//tensorflow/core:core_cpu",
246        "//tensorflow/core/profiler/lib:traceme",
247    ] + if_nccl([
248        "//tensorflow/core/nccl:collective_communicator",
249    ]),
250)
251
252tf_cuda_cc_test(
253    name = "collective_nccl_test",
254    size = "small",
255    srcs = ["collective_nccl_test.cc"],
256    tags = tf_cuda_tests_tags() + [
257        "guitar",
258        "multi_gpu",
259        "no_oss",
260        "notap",
261    ],
262    deps = [
263        "//tensorflow/core:all_kernels",
264        "//tensorflow/core:core_cpu",
265        "//tensorflow/core:framework",
266        "//tensorflow/core:lib",
267        "//tensorflow/core:protos_all_cc",
268        "//tensorflow/core:test",
269        "//tensorflow/core:test_main",
270        "//tensorflow/core:testlib",
271        "//tensorflow/core/nccl:collective_communicator",
272    ],
273)
274
275tf_kernel_library(
276    name = "concat_lib",
277    srcs = [
278        "concat_lib_cpu.cc",
279        "concat_lib_gpu.cc",
280    ],
281    hdrs = [
282        "concat_lib.h",
283        "concat_lib_cpu.h",
284    ],
285    gpu_copts = if_not_windows([
286        "-Wno-pass-failed",  # clang misses #pragma loop optimizations
287    ]),
288    gpu_srcs = [
289        "concat_lib_gpu_impl.cu.cc",
290        "concat_lib.h",
291        "concat_lib_gpu.h",
292        "gpu_device_array.h",
293        "gpu_device_array_gpu.h",
294    ],
295    deps = [
296        "//tensorflow/core:framework",
297        "//tensorflow/core:framework_internal",
298        "//tensorflow/core/framework:bounds_check",
299        "//third_party/eigen3",
300    ],
301    alwayslink = 0,
302)
303
304cc_library(
305    name = "concat_lib_hdrs",
306    hdrs = [
307        "concat_lib.h",
308        "concat_lib_cpu.h",
309    ],
310    deps = ["//third_party/eigen3"],
311)
312
313tf_kernel_library(
314    name = "conv_2d",
315    hdrs = ["conv_2d.h"],
316    gpu_copts = if_not_windows([
317        "-Wno-pass-failed",  # clang misses #pragma loop optimizations
318    ]),
319    gpu_srcs = [
320        "conv_2d.h",
321        "conv_2d_gpu.h",
322        "conv_2d_gpu_double.cu.cc",
323        "conv_2d_gpu_float.cu.cc",
324        "conv_2d_gpu_half.cu.cc",
325        "conv_2d_gpu_int.cu.cc",
326        "conv_2d_gpu_int_spatial_convolution.cu.cc",
327        "conv_2d_gpu_int_spatial_convolution_backward.cu.cc",
328        "conv_2d_gpu_uint16.cu.cc",
329        "conv_2d_gpu_uint32.cu.cc",
330        "conv_2d_gpu_uint64.cu.cc",
331        "conv_2d_gpu_uint8.cu.cc",
332    ],
333    deps = [
334        ":eigen_helpers",
335        ":fill_functor",
336        ":ops_util",
337        "//third_party/eigen3",
338        "//tensorflow/core:core_cpu",
339        "//tensorflow/core:framework",
340        "//tensorflow/core:lib",
341        "//tensorflow/core:lib_internal",
342    ] + if_cuda_or_rocm([":gpu_utils"]),
343    alwayslink = 1,
344)
345
346cc_library(
347    name = "conv_2d_hdrs",
348    hdrs = ["conv_2d.h"],
349    deps = [
350        ":eigen_helpers",
351        "//tensorflow/core/framework:bounds_check",
352        "//third_party/eigen3",
353    ],
354)
355
356cc_library(
357    name = "conv_3d",
358    hdrs = ["conv_3d.h"],
359    deps = [
360        ":eigen_helpers",
361        "//tensorflow/core:framework",
362    ],
363)
364
365tf_kernel_library(
366    name = "fill_functor",
367    prefix = "fill_functor",
368    deps = [
369        "//tensorflow/core:framework",
370        "//third_party/eigen3",
371    ],
372)
373
374cc_library(
375    name = "initializable_lookup_table",
376    srcs = ["initializable_lookup_table.cc"],
377    hdrs = ["initializable_lookup_table.h"],
378    deps = [
379        "//tensorflow/core:core_cpu_base",
380        "//tensorflow/core:framework",
381        "//tensorflow/core:lib",
382    ],
383)
384
385cc_library(
386    name = "lookup_util",
387    srcs = ["lookup_util.cc"],
388    hdrs = ["lookup_util.h"],
389    deps = [
390        ":initializable_lookup_table",
391        "//tensorflow/core:core_cpu_base",
392        "//tensorflow/core:framework",
393        "//tensorflow/core:lib",
394        "//tensorflow/core:lib_internal",
395        "//tensorflow/core/framework:op_requires",
396    ],
397)
398
399tf_kernel_library(
400    name = "nccl_kernels",
401    srcs = if_cuda_or_rocm([
402        "nccl_ops.cc",
403    ]),
404    deps = if_cuda([
405        "@local_config_nccl//:nccl",
406    ]) + if_rocm([
407        "@local_config_rocm//rocm:rccl",
408    ]) + if_cuda_or_rocm([
409        "//tensorflow/core/nccl:nccl_lib",
410        "//tensorflow/core:framework",
411        "//tensorflow/core:gpu_headers_lib",
412    ]),
413)
414
415cc_library(
416    name = "sparse_utils",
417    srcs = [
418        "sparse_utils.cc",
419    ],
420    hdrs = ["sparse_utils.h"],
421    deps = [
422        "//tensorflow/core:framework",
423        "//tensorflow/core:framework_lite",
424        "//tensorflow/core:lib_internal",
425    ],
426)
427
428tf_cc_test(
429    name = "sparse_utils_test",
430    srcs = ["sparse_utils_test.cc"],
431    deps = [
432        ":sparse_utils",
433        "//tensorflow/core:framework",
434        "//tensorflow/core:framework_lite",
435        "//tensorflow/core:protos_all_cc",
436        "//tensorflow/core:test",
437        "//tensorflow/core:test_main",
438        "@com_google_absl//absl/base:core_headers",
439    ],
440)
441
442cc_library(
443    name = "tensor_flag_utils",
444    srcs = [
445        "tensor_flag_utils.cc",
446    ],
447    hdrs = ["tensor_flag_utils.h"],
448    deps = [
449        "//tensorflow/core:framework",
450        "//tensorflow/core:framework_lite",
451        "@com_google_absl//absl/strings",
452    ],
453)
454
455tf_cc_test(
456    name = "tensor_flag_utils_test",
457    srcs = ["tensor_flag_utils_test.cc"],
458    deps = [
459        ":tensor_flag_utils",
460        "//tensorflow/core:framework",
461        "//tensorflow/core:framework_lite",
462        "//tensorflow/core:test",
463        "//tensorflow/core:test_main",
464        "@com_google_absl//absl/base:core_headers",
465    ],
466)
467
468tf_cuda_library(
469    name = "ops_testutil",
470    testonly = 1,
471    srcs = ["ops_testutil.cc"],
472    hdrs = ["ops_testutil.h"],
473    cuda_deps = [
474        "//tensorflow/core:gpu_lib",
475        "//tensorflow/core:gpu_runtime",
476    ],
477    deps = [
478        "//tensorflow/core:core_cpu",
479        "//tensorflow/core:core_cpu_internal",
480        "//tensorflow/core:framework",
481        "//tensorflow/core:lib",
482        "//tensorflow/core:lib_internal",
483        "//tensorflow/core:protos_all_cc",
484        "//tensorflow/core:test",
485        "//tensorflow/core/framework:tensor_testutil",
486    ],
487)
488
489cc_library(
490    name = "ops_util",
491    hdrs = ["ops_util.h"],
492    copts = if_not_windows(["-Wno-sign-compare"]),
493    deps = [
494        "//tensorflow/core:framework",
495    ],
496)
497
498cc_library(
499    name = "ops_util_hdrs",
500    hdrs = ["ops_util.h"],
501    deps = ["//third_party/eigen3"],
502)
503
504cc_library(
505    name = "gpu_prim_hdrs",
506    hdrs = ["gpu_prim.h"],
507    deps = if_cuda([
508        "@local_config_cuda//cuda:cub_headers",
509    ]) + if_rocm([
510        "@local_config_rocm//rocm:rocprim",
511    ]),
512)
513
514cc_library(
515    name = "gpu_prim_helpers",
516    hdrs = ["gpu_prim_helpers.h"],
517    deps = if_cuda_or_rocm([
518        ":gpu_prim_hdrs",
519    ]),
520)
521
522tf_cuda_only_cc_test(
523    name = "gpu_prim_helpers_test",
524    srcs = ["gpu_prim_helpers_test.cu.cc"],
525    tags = ["no_cuda_asan"],  # TODO(b/183963619)
526    deps = [
527        ":gpu_prim_helpers",
528        ":ops_testutil",
529        ":ops_util",
530        "//tensorflow/core:framework",
531        "//tensorflow/core:test",
532        "//tensorflow/core:test_main",
533        "//tensorflow/core:testlib",
534    ],
535)
536
537cc_library(
538    name = "conv_ops_gpu_hdrs",
539    hdrs = ["conv_ops_gpu.h"],
540)
541
542# We keep this target only because some contrib/ targets depend on it. The
543# reason why the contrib/ targets can't depend on gpu_utils is that, some
544# of the targets are tf_custom_op_library. tf_custom_op_library forbids the
545# dependency to tensorflow/core:lib, which gpu_utils certainly depends on.
546cc_library(
547    name = "gpu_util_hdrs",
548    hdrs = ["gpu_utils.h"],
549)
550
551tf_cuda_library(
552    name = "gpu_utils",
553    srcs = if_cuda_or_rocm(["gpu_utils.cc"]),
554    hdrs = ["gpu_utils.h"],
555    deps = [
556        ":gpu_util_hdrs",
557        "//tensorflow/core:lib",
558        "//tensorflow/core/platform:stream_executor",
559        "//tensorflow/core/protobuf:autotuning_proto_cc",
560        "//tensorflow/core/protobuf:conv_autotuning_proto_cc",
561        "//tensorflow/core/util:env_var",
562        "//tensorflow/core/util/proto:proto_utils",
563        "//tensorflow/stream_executor/gpu:asm_compiler",
564        "//tensorflow/stream_executor/gpu:redzone_allocator",
565        "@com_google_absl//absl/algorithm:container",
566        "@com_google_absl//absl/base",
567        "@com_google_absl//absl/types:span",
568    ] + if_cuda([
569        "@local_config_cuda//cuda:cudnn_header",
570    ]),
571)
572
573tf_cc_test(
574    name = "ops_util_test",
575    size = "small",
576    srcs = ["ops_util_test.cc"],
577    deps = [
578        ":ops_util",
579        "//tensorflow/core:framework",
580        "//tensorflow/core:test",
581        "//tensorflow/core:test_main",
582        "//third_party/eigen3",
583    ],
584)
585
586tf_kernel_library(
587    name = "reshape_util",
588    srcs = ["reshape_util.cc"],
589    hdrs = ["reshape_util.h"],
590    gpu_srcs = [
591        "reshape_util_gpu.cu.cc",
592        "reshape_util.h",
593    ],
594    deps = [
595        "//tensorflow/core:framework",
596        "//tensorflow/core:lib",
597        "//tensorflow/core:protos_all_cc",
598    ],
599)
600
601tf_cc_test(
602    name = "variable_ops_test",
603    size = "small",
604    srcs = ["variable_ops_test.cc"],
605    deps = [
606        "//tensorflow/core:all_kernels",
607        "//tensorflow/core:core_cpu",
608        "//tensorflow/core:framework",
609        "//tensorflow/core:lib",
610        "//tensorflow/core:test",
611        "//tensorflow/core:test_main",
612        "//tensorflow/core/common_runtime:direct_session_internal",
613    ],
614)
615
616tf_kernel_library(
617    name = "stage_op",
618    srcs = ["stage_op.cc"],
619    deps = [
620        "//tensorflow/core:framework",
621        "//tensorflow/core:lib",
622    ],
623)
624
625tf_kernel_library(
626    name = "map_stage_op",
627    srcs = ["map_stage_op.cc"],
628    deps = [
629        "//tensorflow/core:framework",
630        "//tensorflow/core:lib",
631    ],
632)
633
634cc_library(
635    name = "queue_base",
636    srcs = ["queue_base.cc"],
637    hdrs = ["queue_base.h"],
638    deps = [
639        "//tensorflow/core:framework",
640        "//tensorflow/core:lib",
641        "//tensorflow/core:protos_all_cc",
642    ],
643)
644
645cc_library(
646    name = "queue_op",
647    srcs = ["queue_op.cc"],
648    hdrs = ["queue_op.h"],
649    deps = [
650        ":queue_base",
651        "//tensorflow/core:framework",
652        "//tensorflow/core:lib",
653    ],
654)
655
656cc_library(
657    name = "priority_queue",
658    srcs = ["priority_queue.cc"],
659    hdrs = ["priority_queue.h"],
660    deps = [
661        ":queue_base",
662        ":typed_queue",
663        "//tensorflow/core:framework",
664        "//tensorflow/core:lib",
665        "//tensorflow/core:protos_all_cc",
666    ],
667)
668
669cc_library(
670    name = "batch_kernels",
671    srcs = ["batch_kernels.cc"],
672    deps = [
673        ":ops_util_hdrs",
674        "//tensorflow/core:core_cpu_internal",
675        "//tensorflow/core:framework",
676        "//tensorflow/core:lib",
677        "//tensorflow/core:lib_internal",
678        "//tensorflow/core/kernels/batching_util:adaptive_shared_batch_scheduler",
679        "//tensorflow/core/kernels/batching_util:batch_resource_base",
680        "//tensorflow/core/kernels/batching_util:concat_split_util",
681        "//tensorflow/core/kernels/batching_util:periodic_function_dynamic",
682        "//tensorflow/core/platform:numbers",
683        "@com_google_absl//absl/strings",
684    ],
685    alwayslink = 1,
686)
687
688tf_kernel_library(
689    name = "record_input_op",
690    srcs = [
691        "record_input_op.cc",
692        "record_yielder.cc",
693        "record_yielder.h",
694    ],
695    deps = [
696        "//tensorflow/core:framework",
697        "//tensorflow/core:lib",
698    ],
699)
700
701cc_library(
702    name = "save_restore_tensor",
703    srcs = ["save_restore_tensor.cc"],
704    hdrs = ["save_restore_tensor.h"],
705    copts = if_not_windows(["-Wno-sign-compare"]),
706    deps = [
707        "//tensorflow/core:framework",
708        "//tensorflow/core:lib",
709        "//tensorflow/core/framework:bounds_check",
710        "//tensorflow/core/util/tensor_bundle",
711    ],
712)
713
714tf_kernel_library(
715    name = "split_lib",
716    srcs = ["split_lib_cpu.cc"],
717    hdrs = ["split_lib.h"],
718    gpu_srcs = [
719        "split_lib_gpu.cu.cc",
720        "split_lib.h",
721        "split_lib_gpu.h",
722    ],
723    deps = [
724        ":gpu_device_array",
725        "//tensorflow/core:framework",
726        "//third_party/eigen3",
727    ],
728    alwayslink = 0,
729)
730
731cc_library(
732    name = "split_lib_hdrs",
733    hdrs = ["split_lib.h"],
734    deps = [
735        "//tensorflow/core:framework_lite",
736        "//third_party/eigen3",
737    ],
738)
739
740cc_library(
741    name = "typed_queue",
742    hdrs = ["typed_queue.h"],
743    deps = [
744        ":queue_base",
745        "//tensorflow/core:framework",
746    ],
747)
748
749cc_library(
750    name = "training_op_helpers",
751    srcs = ["training_op_helpers.cc"],
752    hdrs = ["training_op_helpers.h"],
753    visibility = [
754        ":friends",
755        ":optimizer_helper_friends",
756    ],
757    deps = [
758        ":dense_update_functor",
759        ":variable_ops",
760        "//tensorflow/core:framework",
761        "//tensorflow/core:lib",
762    ],
763)
764
765# Private support libraries ---------------------------------------------------
766
767cc_library(
768    name = "gpu_device_array",
769    hdrs = [
770        "gpu_device_array.h",
771        "gpu_device_array_gpu.h",
772    ],
773    visibility = ["//tensorflow:__subpackages__"],
774    deps = [
775        "//tensorflow/core:framework",
776        "//tensorflow/core:gpu_headers_lib",
777        "//tensorflow/core:lib",
778    ],
779)
780
781# Depending on a build configuration this target provides custom kernel for Eigen
782# tensor contractions (small matrix multiplication kernel used to multiple together
783# blocks of the original tensors).
784#
785# 1) Default:
786#    Use Mkldnn single threaded sgemm. The mkldnn kernels are generated at runtime and
787#    use avx/avx2/fma/avx512 based on cpu status registers (https://en.wikipedia.org/wiki/CPUID).
788#
789# 2) Eigen: --define tensorflow_mkldnn_contraction_kernel=0 (disable mkldnn)
790#    Use Eigen contraction kernel: Eigen::internal::gebp_kernel.
791#
792# If you use `tensor.contract(other_tensor)` in your code, you must include additional header
793# to get the benefit of custom contraction kernel:
794#
795#   #if defined(TENSORFLOW_USE_CUSTOM_CONTRACTION_KERNEL)
796#   #include "third_party/tensorflow/core/kernels/eigen_contraction_kernel.h"
797#   #endif
798#
799# We define a two-level target because if we just add
800#   ":no_mkldnn_contraction_kernel": []
801# in the same select list with //third_party/tensorflow:{android,arm,ios,ppc},
802# there can be more than one match, e.g., when building for android and MKL-DNN
803# contraction kernel is disabled. Bazel doesn't allow multiple matches.
804# See more details in
805#   https://github.com/tensorflow/tensorflow/issues/24414
806cc_library(
807    name = "eigen_contraction_kernel",
808    hdrs = ["eigen_contraction_kernel.h"],
809    deps = select({
810        ":no_mkldnn_contraction_kernel": [":eigen_contraction_kernel_no_mkl"],
811        "//conditions:default": [":eigen_contraction_kernel_with_mkl"],
812    }) + ["@com_google_absl//absl/base"],
813)
814
815cc_library(
816    name = "eigen_contraction_kernel_with_mkl",
817    srcs = ["eigen_contraction_kernel.cc"],
818    hdrs = ["eigen_contraction_kernel.h"],
819    defines = select({
820        "//tensorflow:android_x86": [],
821        "//tensorflow:arm_any": [],
822        "//tensorflow:ios": [],
823        "//tensorflow:linux_ppc64le": [],
824        "//tensorflow:linux_s390x": [],
825        "//tensorflow:macos_arm64": [],
826        "//conditions:default": [
827            "TENSORFLOW_USE_CUSTOM_CONTRACTION_KERNEL",
828            "TENSORFLOW_USE_MKLDNN_CONTRACTION_KERNEL",
829        ],
830    }),
831    deps = [
832        "@com_google_absl//absl/base",
833        "//third_party/eigen3",
834        "//tensorflow/core/platform:dynamic_annotations",
835    ] + select({
836        "//tensorflow:android_x86": [],
837        "//tensorflow:arm_any": [],
838        "//tensorflow:ios": [],
839        "//tensorflow:linux_ppc64le": [],
840        "//tensorflow:linux_s390x": [],
841        "//tensorflow:macos_arm64": [],
842        "//conditions:default": ["@mkl_dnn_v1//:mkl_dnn"],
843    }),
844)
845
846cc_library(
847    name = "eigen_contraction_kernel_no_mkl",
848    srcs = ["eigen_contraction_kernel.cc"],
849    hdrs = ["eigen_contraction_kernel.h"],
850    deps = [
851        "//tensorflow/core/platform:dynamic_annotations",
852        "//third_party/eigen3",
853        "@com_google_absl//absl/base",
854    ],
855)
856
857filegroup(
858    name = "xla_cpu_runtime_hdrs",
859    srcs = [
860        "eigen_contraction_kernel.h",
861        "eigen_convolution_helpers.h",
862        "eigen_spatial_convolutions.h",
863        "eigen_spatial_convolutions-inl.h",
864    ],
865)
866
867filegroup(
868    name = "xla_cpu_runtime_srcs",
869    srcs = [
870        "eigen_contraction_kernel.cc",
871    ],
872)
873
874cc_library(
875    name = "redux_functor",
876    hdrs = ["redux_functor.h"],
877    deps = [
878        "//tensorflow/core:framework",
879        "//third_party/eigen3",
880    ],
881)
882
883cc_library(
884    name = "fused_eigen_output_kernels",
885    srcs = ["fused_eigen_output_kernels.cc"],
886    hdrs = ["fused_eigen_output_kernels.h"],
887    deps = [
888        "//tensorflow/core:framework",
889        "//third_party/eigen3",
890        "@com_google_absl//absl/strings",
891    ],
892)
893
894cc_library(
895    name = "eigen_helpers",
896    hdrs = [
897        "eigen_activations.h",
898        "eigen_attention.h",
899        "eigen_backward_cuboid_convolutions.h",
900        "eigen_backward_spatial_convolutions.h",
901        "eigen_cuboid_convolution.h",
902        "eigen_pooling.h",
903        "eigen_spatial_convolutions.h",
904    ],
905    deps = [
906        ":eigen_contraction_kernel",
907        ":eigen_convolution_helpers",
908        ":eigen_spatial_convolutions-inl",
909        "//third_party/eigen3",
910    ],
911)
912
913cc_library(
914    name = "eigen_helpers_no_mkl",
915    hdrs = [
916        "eigen_activations.h",
917        "eigen_attention.h",
918        "eigen_backward_cuboid_convolutions.h",
919        "eigen_backward_spatial_convolutions.h",
920        "eigen_cuboid_convolution.h",
921        "eigen_pooling.h",
922        "eigen_spatial_convolutions.h",
923    ],
924    deps = [
925        ":eigen_convolution_helpers",
926        ":eigen_spatial_convolutions-inl",
927        "//third_party/eigen3",
928    ],
929)
930
931cc_library(
932    name = "eigen_spatial_convolutions-inl",
933    hdrs = [
934        "eigen_spatial_convolutions-inl.h",
935    ],
936    compatible_with = get_compatible_with_portable(),
937    deps = [
938        ":eigen_convolution_helpers",
939    ],
940)
941
942cc_library(
943    name = "eigen_convolution_helpers",
944    hdrs = [
945        "eigen_convolution_helpers.h",
946    ],
947    compatible_with = get_compatible_with_portable(),
948    defines = [
949        "EIGEN_ALTIVEC_USE_CUSTOM_PACK=0",
950    ],
951)
952
953# OpKernel libraries ----------------------------------------------------------
954
955ARRAY_DEPS = [
956    ":concat_lib",
957    ":fill_functor",
958    ":gather_functor",
959    ":ops_util",
960    ":transpose_functor",
961    "//tensorflow/core:array_grad",
962    "//tensorflow/core:core_cpu",
963    "//tensorflow/core:framework",
964    "//tensorflow/core:lib",
965    "//tensorflow/core:lib_internal",
966    "//tensorflow/core:protos_all_cc",
967    "//tensorflow/core/framework:bounds_check",
968    "//third_party/eigen3",
969]
970
971tf_kernel_library(
972    name = "immutable_constant_op",
973    prefix = "immutable_constant_op",
974    deps = ARRAY_DEPS,
975)
976
977tf_kernel_library(
978    name = "set_kernels",
979    prefix = "set_kernels",
980    deps = [
981        "//tensorflow/core:framework_headers_lib",
982        "//tensorflow/core:lib",
983        "//third_party/eigen3",
984    ],
985)
986
987tf_kernel_library(
988    name = "debug_ops",
989    prefix = "debug_ops",
990    deps = ARRAY_DEPS + [
991        "//tensorflow/core:gpu_runtime",
992        "//tensorflow/core/debug:debug_io_utils",
993    ],
994)
995
996cc_library(
997    name = "array",
998    deps = [
999        ":batch_space_ops",
1000        ":bcast_ops",
1001        ":broadcast_to_op",
1002        ":concat_op",
1003        ":constant_op",
1004        ":depth_space_ops",
1005        ":diag_op",
1006        ":edit_distance_op",
1007        ":fingerprint_op",
1008        ":gather_nd_op",
1009        ":gather_op",
1010        ":guarantee_const_op",
1011        ":host_constant_op",
1012        ":identity_n_op",
1013        ":identity_op",
1014        ":immutable_constant_op",
1015        ":inplace_ops",
1016        ":listdiff_op",
1017        ":one_hot_op",
1018        ":pack_op",
1019        ":pad_op",
1020        ":quantize_and_dequantize_op",
1021        ":reshape_op",
1022        ":reverse_op",
1023        ":reverse_sequence_op",
1024        ":searchsorted_op",
1025        ":shape_ops",
1026        ":slice_op",
1027        ":snapshot_op",
1028        ":split_op",
1029        ":split_v_op",
1030        ":strided_slice_op",
1031        ":tile_ops",
1032        ":transpose_op",
1033        ":unique_op",
1034        ":unpack_op",
1035        ":unravel_index_op",
1036        ":where_op",
1037    ],
1038)
1039
1040tf_kernel_library(
1041    name = "bcast_ops",
1042    prefix = "bcast_ops",
1043    deps = ARRAY_DEPS,
1044)
1045
1046tf_kernel_library(
1047    name = "bitcast_op",
1048    deprecation = "use //third_party/tensorflow/c/kernels:bitcast_op instead",
1049    deps = ["//tensorflow/c/kernels:bitcast_op"],
1050)
1051
1052tf_kernel_library(
1053    name = "broadcast_to_op",
1054    prefix = "broadcast_to_op",
1055    deps = ARRAY_DEPS,
1056)
1057
1058tf_kernel_library(
1059    name = "concat_op",
1060    prefix = "concat_op",
1061    deps = ARRAY_DEPS,
1062)
1063
1064tf_kernel_library(
1065    name = "guarantee_const_op",
1066    prefix = "guarantee_const_op",
1067    deps = ARRAY_DEPS,
1068)
1069
1070tf_kernel_library(
1071    name = "constant_op",
1072    copts = if_mlir_generated_experimental_kernels_enabled([
1073        "-DMLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED",
1074    ]) + if_mlir_generated_gpu_kernels_enabled(
1075        ["-DMLIR_GENERATED_GPU_KERNELS_ENABLED"],
1076    ),
1077    # *.cu.cc sources are compiled with gpu_copts instead of copts.
1078    gpu_copts = if_mlir_generated_experimental_kernels_enabled([
1079        "-DMLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED",
1080    ]) + if_mlir_generated_gpu_kernels_enabled(
1081        ["-DMLIR_GENERATED_GPU_KERNELS_ENABLED"],
1082    ),
1083    prefix = "constant_op",
1084    deps = ARRAY_DEPS + [
1085        "//tensorflow/core/kernels/mlir_generated:constant_op",
1086    ],
1087)
1088
1089tf_kernel_library(
1090    name = "host_constant_op",
1091    prefix = "host_constant_op",
1092    deps = ARRAY_DEPS,
1093)
1094
1095tf_kernel_library(
1096    name = "diag_op",
1097    prefix = "diag_op",
1098    deps = ARRAY_DEPS,
1099)
1100
1101tf_kernel_library(
1102    name = "edit_distance_op",
1103    prefix = "edit_distance_op",
1104    deps = ARRAY_DEPS,
1105)
1106
1107tf_kernel_library(
1108    name = "fingerprint_op",
1109    prefix = "fingerprint_op",
1110    deps = ARRAY_DEPS,
1111)
1112
1113tf_cc_test(
1114    name = "fingerprint_op_test",
1115    size = "small",
1116    srcs = ["fingerprint_op_test.cc"],
1117    deps = [
1118        ":fingerprint_op",
1119        ":ops_testutil",
1120        "//tensorflow/core:framework",
1121        "//tensorflow/core:lib",
1122        "//tensorflow/core:protos_all_cc",
1123        "//tensorflow/core:test",
1124        "//tensorflow/core:test_main",
1125        "//tensorflow/core:testlib",
1126    ],
1127)
1128
1129tf_kernel_library(
1130    name = "gather_nd_op",
1131    prefix = "gather_nd_op",
1132    deps = ARRAY_DEPS,
1133)
1134
1135tf_kernel_library(
1136    name = "gather_op",
1137    prefix = "gather_op",
1138    deps = ARRAY_DEPS,
1139)
1140
1141tf_kernel_library(
1142    name = "identity_op",
1143    prefix = "identity_op",
1144    deps = ARRAY_DEPS,
1145)
1146
1147tf_kernel_library(
1148    name = "identity_n_op",
1149    prefix = "identity_n_op",
1150    deps = ARRAY_DEPS + [
1151        "//tensorflow/core:core_cpu_internal",
1152    ],
1153)
1154
1155tf_kernel_library(
1156    name = "listdiff_op",
1157    prefix = "listdiff_op",
1158    deps = ARRAY_DEPS,
1159)
1160
1161tf_kernel_library(
1162    name = "one_hot_op",
1163    prefix = "one_hot_op",
1164    deps = ARRAY_DEPS + ["//tensorflow/core/util:overflow"],
1165)
1166
1167tf_kernel_library(
1168    name = "pack_op",
1169    prefix = "pack_op",
1170    deps = ARRAY_DEPS,
1171)
1172
1173tf_kernel_library(
1174    name = "pad_op",
1175    prefix = "pad_op",
1176    deps = ARRAY_DEPS,
1177)
1178
1179tf_kernel_library(
1180    name = "quantize_and_dequantize_op",
1181    gpu_copts = tf_disable_ptxas_warning_flags(),
1182    prefix = "quantize_and_dequantize_op",
1183    deps = ARRAY_DEPS + [":cwise_op"],
1184)
1185
1186tf_kernel_library(
1187    name = "reshape_op",
1188    prefix = "reshape_op",
1189    deps = ARRAY_DEPS,
1190)
1191
1192tf_kernel_library(
1193    name = "reverse_op",
1194    prefix = "reverse_op",
1195    deps = ARRAY_DEPS,
1196)
1197
1198tf_kernel_library(
1199    name = "reverse_sequence_op",
1200    prefix = "reverse_sequence_op",
1201    deps = ARRAY_DEPS,
1202)
1203
1204tf_kernel_library(
1205    name = "shape_ops",
1206    prefix = "shape_ops",
1207    deps = ARRAY_DEPS + ["//tensorflow/core/common_runtime:dma_helper"],
1208)
1209
1210tf_kernel_library(
1211    name = "slice_op",
1212    prefix = "slice_op",
1213    deps = ARRAY_DEPS + [":strided_slice_op"],
1214)
1215
1216tf_kernel_library(
1217    name = "snapshot_op",
1218    prefix = "snapshot_op",
1219    deps = ARRAY_DEPS,
1220)
1221
1222tf_kernel_library(
1223    name = "split_op",
1224    gpu_srcs = ["gpu_device_array.h"],
1225    prefix = "split_op",
1226    deps = ARRAY_DEPS + [":split_lib"],
1227)
1228
1229tf_kernel_library(
1230    name = "split_v_op",
1231    gpu_srcs = ["gpu_device_array.h"],
1232    prefix = "split_v_op",
1233    deps = ARRAY_DEPS + [":split_lib"],
1234)
1235
1236tf_kernel_library(
1237    name = "searchsorted_op",
1238    prefix = "searchsorted_op",
1239    deps = ARRAY_DEPS,
1240)
1241
1242tf_kernel_library(
1243    name = "inplace_ops",
1244    prefix = "inplace_ops",
1245    deps = ARRAY_DEPS,
1246)
1247
1248tf_kernel_library(
1249    name = "tile_ops",
1250    srcs = [
1251        "tile_functor_cpu.h",
1252        "tile_functor_cpu_bfloat16.cc",
1253        "tile_functor_cpu_bool.cc",
1254        "tile_functor_cpu_complex128.cc",
1255        "tile_functor_cpu_complex64.cc",
1256        "tile_functor_cpu_double.cc",
1257        "tile_functor_cpu_float.cc",
1258        "tile_functor_cpu_half.cc",
1259        "tile_functor_cpu_int16.cc",
1260        "tile_functor_cpu_int32.cc",
1261        "tile_functor_cpu_int64.cc",
1262        "tile_functor_cpu_int8.cc",
1263        "tile_functor_cpu_tstring.cc",
1264        "tile_functor_cpu_uint32.cc",
1265        "tile_functor_cpu_uint64.cc",
1266        "tile_functor_cpu_uint8.cc",
1267        "tile_functor_cpu_variant.cc",
1268    ],
1269    hdrs = ["tile_functor.h"],
1270    gpu_copts = tf_disable_ptxas_warning_flags(),
1271    gpu_srcs = [
1272        "tile_functor.h",
1273        "tile_functor_gpu.h",
1274        "tile_functor_gpu_bool.cu.cc",
1275        "tile_functor_gpu_complex64.cu.cc",
1276        "tile_functor_gpu_complex128.cu.cc",
1277        "tile_functor_gpu_double.cu.cc",
1278        "tile_functor_gpu_float.cu.cc",
1279        "tile_functor_gpu_half.cu.cc",
1280        "tile_functor_gpu_int16.cu.cc",
1281        "tile_functor_gpu_int32.cu.cc",
1282        "tile_functor_gpu_int64.cu.cc",
1283    ],
1284    prefix = "tile_ops",
1285    deps = ARRAY_DEPS,
1286)
1287
1288tf_kernel_library(
1289    name = "transpose_op",
1290    srcs = [
1291        "transpose_op.cc",
1292    ],
1293    hdrs = ["transpose_op.h"],
1294    deps = ARRAY_DEPS,
1295)
1296
1297tf_kernel_library(
1298    name = "unique_op",
1299    prefix = "unique_op",
1300    deps = ARRAY_DEPS + [
1301        "@com_google_absl//absl/container:flat_hash_map",
1302    ] + if_cuda_or_rocm([
1303        ":gpu_prim_hdrs",
1304        ":gpu_prim_helpers",
1305    ]) + if_cuda([
1306        "//tensorflow/core/util:cuda_solvers",
1307    ]) + if_rocm([
1308        "//tensorflow/core/util:rocm_solvers",
1309    ]),
1310)
1311
1312tf_kernel_library(
1313    name = "unpack_op",
1314    prefix = "unpack_op",
1315    deps = ARRAY_DEPS + [":split_lib"],
1316)
1317
1318tf_kernel_library(
1319    name = "unravel_index_op",
1320    prefix = "unravel_index_op",
1321    deps = ARRAY_DEPS,
1322)
1323
1324tf_kernel_library(
1325    name = "where_op",
1326    srcs = ["where_op.cc"],
1327    hdrs = ["where_op.h"],
1328    gpu_srcs = [
1329        "where_op.h",
1330        "where_op_gpu.cu.h",
1331        "where_op_gpu_impl_1.cu.cc",
1332        "where_op_gpu_impl_2.cu.cc",
1333        "where_op_gpu_impl_3.cu.cc",
1334        "where_op_gpu_impl_4.cu.cc",
1335        "where_op_gpu_impl_5.cu.cc",
1336        "where_op_gpu_impl_6.cu.cc",
1337        "where_op_gpu_impl_7.cu.cc",
1338        "where_op_gpu_impl_8.cu.cc",
1339    ],
1340    deps = if_cuda_or_rocm([
1341               "//tensorflow/core/util:cuda_solvers",
1342           ]) + [":gpu_prim_hdrs"] +
1343           ARRAY_DEPS,
1344)
1345
1346cc_library(
1347    name = "composite_tensor_variant",
1348    srcs = ["composite_tensor_variant.cc"],
1349    hdrs = ["composite_tensor_variant.h"],
1350    deps = [
1351        "//tensorflow/core:framework",
1352        "//tensorflow/core:lib",
1353        "//tensorflow/core:protos_all_cc",
1354        "@com_google_absl//absl/types:span",
1355    ],
1356)
1357
1358tf_cc_test(
1359    name = "composite_tensor_variant_test",
1360    size = "small",
1361    srcs = ["composite_tensor_variant_test.cc"],
1362    deps = [
1363        ":composite_tensor_variant",
1364        "//tensorflow/core:framework",
1365        "//tensorflow/core:protos_all_cc",
1366        "//tensorflow/core:test",
1367        "//tensorflow/core:test_main",
1368        "//tensorflow/core:testlib",
1369    ],
1370)
1371
1372tf_kernel_library(
1373    name = "composite_tensor_ops",
1374    srcs = ["composite_tensor_ops.cc"],
1375    deps = [
1376        ":composite_tensor_variant",
1377        "//tensorflow/core:framework",
1378        "//tensorflow/core:lib",
1379        "//tensorflow/core:protos_all_cc",
1380    ],
1381)
1382
1383cc_library(
1384    name = "ragged_ops",
1385    deps = [
1386        ":ragged_cross_op",
1387        ":ragged_gather_op",
1388        ":ragged_range_op",
1389        ":ragged_tensor_from_variant_op",
1390        ":ragged_tensor_to_sparse_kernel",
1391        ":ragged_tensor_to_tensor_op",
1392        ":ragged_tensor_to_variant_op",
1393    ],
1394)
1395
1396tf_kernel_library(
1397    name = "ragged_gather_op",
1398    srcs = ["ragged_gather_op.cc"],
1399    deps = [
1400        "//tensorflow/core:framework",
1401    ],
1402)
1403
1404tf_cc_test(
1405    name = "ragged_gather_op_test",
1406    size = "small",
1407    srcs = ["ragged_gather_op_test.cc"],
1408    deps = [
1409        ":ops_testutil",
1410        ":ragged_gather_op",
1411        "//tensorflow/core:framework",
1412        "//tensorflow/core:test",
1413        "//tensorflow/core:test_main",
1414        "//tensorflow/core:testlib",
1415    ],
1416)
1417
1418tf_kernel_library(
1419    name = "ragged_range_op",
1420    srcs = ["ragged_range_op.cc"],
1421    deps = [
1422        "//tensorflow/core:framework",
1423    ],
1424)
1425
1426tf_cc_test(
1427    name = "ragged_range_op_test",
1428    srcs = ["ragged_range_op_test.cc"],
1429    deps = [
1430        ":ops_testutil",
1431        ":ragged_range_op",
1432        "//tensorflow/core:framework",
1433        "//tensorflow/core:test",
1434        "//tensorflow/core:test_main",
1435        "//tensorflow/core:testlib",
1436    ],
1437)
1438
1439tf_kernel_library(
1440    name = "ragged_tensor_to_sparse_kernel",
1441    srcs = ["ragged_tensor_to_sparse_kernel.cc"],
1442    deps = [
1443        "//tensorflow/core:framework",
1444    ],
1445)
1446
1447tf_cc_test(
1448    name = "ragged_tensor_to_tensor_op_test",
1449    size = "small",
1450    srcs = ["ragged_tensor_to_tensor_op_test.cc"],
1451    deps = [
1452        ":ops_testutil",
1453        ":ragged_tensor_to_tensor_op",
1454        "//tensorflow/core:framework",
1455        "//tensorflow/core:lib",
1456        "//tensorflow/core:test",
1457        "//tensorflow/core:test_main",
1458        "//tensorflow/core:testlib",
1459    ],
1460)
1461
1462tf_kernel_library(
1463    name = "ragged_tensor_to_tensor_op",
1464    srcs = ["ragged_tensor_to_tensor_op.cc"],
1465    deps = [
1466        ":broadcast_to_op",
1467        ":list_kernels",
1468        "//tensorflow/core:framework",
1469        "//tensorflow/core:framework_lite",
1470        "//tensorflow/core:lib",
1471        "//tensorflow/core:protos_all_cc",
1472        "//tensorflow/core/util:ragged_to_dense_util",
1473    ],
1474)
1475
1476tf_cc_test(
1477    name = "ragged_tensor_to_sparse_kernel_test",
1478    size = "small",
1479    srcs = ["ragged_tensor_to_sparse_kernel_test.cc"],
1480    deps = [
1481        ":ops_testutil",
1482        ":ragged_tensor_to_sparse_kernel",
1483        "//tensorflow/core:framework",
1484        "//tensorflow/core:lib",
1485        "//tensorflow/core:test",
1486        "//tensorflow/core:test_main",
1487        "//tensorflow/core:testlib",
1488    ],
1489)
1490
1491cc_library(
1492    name = "ragged_tensor_variant",
1493    srcs = ["ragged_tensor_variant.cc"],
1494    hdrs = ["ragged_tensor_variant.h"],
1495    deps = [
1496        ":cwise_op",
1497        "//tensorflow/core:framework",
1498    ],
1499)
1500
1501tf_kernel_library(
1502    name = "ragged_tensor_to_variant_op",
1503    srcs = ["ragged_tensor_to_variant_op.cc"],
1504    deps = [
1505        ":concat_lib",
1506        ":ragged_tensor_variant",
1507        "//tensorflow/core:framework",
1508        "//tensorflow/core:lib",
1509    ],
1510)
1511
1512tf_kernel_library(
1513    name = "ragged_tensor_from_variant_op",
1514    srcs = ["ragged_tensor_from_variant_op.cc"],
1515    deps = [
1516        ":ragged_tensor_variant",
1517        "//tensorflow/core:framework",
1518        "//tensorflow/core:lib",
1519    ],
1520)
1521
1522tf_cc_test(
1523    name = "ragged_tensor_to_variant_op_test",
1524    size = "small",
1525    srcs = ["ragged_tensor_to_variant_op_test.cc"],
1526    deps = [
1527        ":ops_testutil",
1528        ":ragged_tensor_to_variant_op",
1529        ":ragged_tensor_variant",
1530        "//tensorflow/core:framework",
1531        "//tensorflow/core:lib",
1532        "//tensorflow/core:test",
1533        "//tensorflow/core:test_main",
1534        "//tensorflow/core:testlib",
1535        "@com_google_absl//absl/strings",
1536    ],
1537)
1538
1539tf_cc_test(
1540    name = "ragged_tensor_from_variant_op_test",
1541    size = "small",
1542    srcs = ["ragged_tensor_from_variant_op_test.cc"],
1543    deps = [
1544        ":ops_testutil",
1545        ":ragged_tensor_from_variant_op",
1546        ":ragged_tensor_variant",
1547        "//tensorflow/core:framework",
1548        "//tensorflow/core:lib",
1549        "//tensorflow/core:test",
1550        "//tensorflow/core:test_main",
1551        "//tensorflow/core:testlib",
1552        "@com_google_absl//absl/strings",
1553    ],
1554)
1555
1556tf_kernel_library(
1557    name = "ragged_cross_op",
1558    srcs = ["ragged_cross_op.cc"],
1559    deps = [
1560        "//tensorflow/core:framework",
1561        "//tensorflow/core:lib",
1562    ],
1563)
1564
1565tf_kernel_library(
1566    name = "rnn_ops",
1567    deps = [
1568        "//tensorflow/core/kernels/rnn:gru_ops",
1569        "//tensorflow/core/kernels/rnn:lstm_ops",
1570    ],
1571)
1572
1573tf_kernel_library(
1574    name = "cudnn_rnn_kernels",
1575    srcs = ["cudnn_rnn_ops.cc"],
1576    visibility = ["//visibility:public"],
1577    deps = [
1578        ":gpu_utils",
1579        "//tensorflow/core:framework",
1580        "//tensorflow/core:lib",
1581        "//tensorflow/core:lib_internal",
1582        "//tensorflow/core/framework:bounds_check",
1583        "//tensorflow/core/platform:stream_executor",
1584        "//tensorflow/core/profiler/lib:scoped_annotation",
1585        "//third_party/eigen3",
1586    ],
1587)
1588
1589tf_cc_test(
1590    name = "batch_norm_op_test",
1591    size = "small",
1592    srcs = ["batch_norm_op_test.cc"],
1593    tags = [
1594        "no_oss",  # b/189866692
1595    ],
1596    deps = [
1597        ":batch_norm_op",
1598        ":ops_testutil",
1599        ":ops_util",
1600        "//tensorflow/core:core_cpu",
1601        "//tensorflow/core:framework",
1602        "//tensorflow/core:lib",
1603        "//tensorflow/core:protos_all_cc",
1604        "//tensorflow/core:test",
1605        "//tensorflow/core:test_main",
1606        "//tensorflow/core:testlib",
1607    ],
1608)
1609
1610tf_cc_test(
1611    name = "ops_testutil_test",
1612    size = "small",
1613    srcs = ["ops_testutil_test.cc"],
1614    deps = [
1615        ":identity_op",
1616        ":ops_testutil",
1617        ":ops_util",
1618        ":variable_ops",
1619        "//tensorflow/core:core_cpu",
1620        "//tensorflow/core:framework",
1621        "//tensorflow/core:lib",
1622        "//tensorflow/core:protos_all_cc",
1623        "//tensorflow/core:test",
1624        "//tensorflow/core:test_main",
1625        "//tensorflow/core:testlib",
1626    ],
1627)
1628
1629tf_cc_test(
1630    name = "concat_op_test",
1631    size = "small",
1632    srcs = ["concat_op_test.cc"],
1633    deps = [
1634        ":concat_op",
1635        ":ops_testutil",
1636        ":ops_util",
1637        "//tensorflow/core:core_cpu",
1638        "//tensorflow/core:framework",
1639        "//tensorflow/core:lib",
1640        "//tensorflow/core:protos_all_cc",
1641        "//tensorflow/core:test",
1642        "//tensorflow/core:test_main",
1643        "//tensorflow/core:testlib",
1644    ],
1645)
1646
1647tf_cuda_cc_test(
1648    name = "bincount_op_test",
1649    size = "small",
1650    srcs = ["bincount_op_test.cc"],
1651    deps = [
1652        ":bincount_op",
1653        ":ops_testutil",
1654        ":ops_util",
1655        "//tensorflow/core:core_cpu",
1656        "//tensorflow/core:framework",
1657        "//tensorflow/core:lib",
1658        "//tensorflow/core:protos_all_cc",
1659        "//tensorflow/core:test",
1660        "//tensorflow/core:test_main",
1661        "//tensorflow/core:testlib",
1662    ],
1663)
1664
1665tf_cuda_cc_test(
1666    name = "broadcast_to_op_test",
1667    size = "small",
1668    srcs = ["broadcast_to_op_test.cc"],
1669    deps = [
1670        ":broadcast_to_op",
1671        ":ops_testutil",
1672        ":ops_util",
1673        "//tensorflow/core:core_cpu",
1674        "//tensorflow/core:framework",
1675        "//tensorflow/core:lib",
1676        "//tensorflow/core:protos_all_cc",
1677        "//tensorflow/core:test",
1678        "//tensorflow/core:test_main",
1679        "//tensorflow/core:testlib",
1680    ],
1681)
1682
1683tf_cuda_cc_test(
1684    name = "constant_op_test",
1685    size = "small",
1686    srcs = ["constant_op_test.cc"],
1687    tags = ["no_cuda_on_cpu_tap"],
1688    deps = [
1689        ":constant_op",
1690        ":ops_testutil",
1691        ":ops_util",
1692        "//tensorflow/core:core_cpu",
1693        "//tensorflow/core:framework",
1694        "//tensorflow/core:lib",
1695        "//tensorflow/core:protos_all_cc",
1696        "//tensorflow/core:test",
1697        "//tensorflow/core:test_main",
1698        "//tensorflow/core:testlib",
1699    ],
1700)
1701
1702tf_cc_test(
1703    name = "deep_conv2d_test",
1704    size = "small",
1705    srcs = ["deep_conv2d_test.cc"],
1706    deps = [
1707        ":conv_ops",
1708        "//tensorflow/core:test",
1709        "//tensorflow/core:test_main",
1710    ],
1711)
1712
1713tf_cc_test(
1714    name = "xsmm_conv2d_test",
1715    size = "small",
1716    srcs = select({
1717        ":xsmm_convolutions": ["xsmm_conv2d_test.cc"],
1718        "//conditions:default": [],
1719    }),
1720    deps = [
1721        ":conv_ops",
1722        ":ops_testutil",
1723        ":ops_util",
1724        "//tensorflow/core:core_cpu",
1725        "//tensorflow/core:framework",
1726        "//tensorflow/core:lib",
1727        "//tensorflow/core:protos_all_cc",
1728        "//tensorflow/core:test",
1729        "//tensorflow/core:test_main",
1730        "//tensorflow/core:testlib",
1731    ] + select({
1732        ":xsmm_convolutions": [
1733            "@libxsmm_archive//:xsmm_avx",
1734        ],
1735        "//conditions:default": [],
1736    }),
1737)
1738
1739tf_cuda_cc_test(
1740    name = "conv_ops_test",
1741    size = "medium",
1742    srcs = ["conv_ops_test.cc"],
1743    tags = [
1744        "no_cuda_asan",  # TODO(b/171342275): re-enable.
1745    ],
1746    deps = [
1747        ":conv_ops",
1748        ":ops_testutil",
1749        ":ops_util",
1750        "//tensorflow/cc:cc_ops",
1751        "//tensorflow/cc:cc_ops_internal",
1752        "//tensorflow/core:core_cpu",
1753        "//tensorflow/core:framework",
1754        "//tensorflow/core:framework_internal",
1755        "//tensorflow/core:lib",
1756        "//tensorflow/core:protos_all_cc",
1757        "//tensorflow/core:tensorflow",
1758        "//tensorflow/core:test",
1759        "//tensorflow/core:test_main",
1760        "//tensorflow/core:testlib",
1761        "//tensorflow/core/kernels/image",
1762        "//tensorflow/core/platform:tensor_float_32_utils",
1763        "@com_google_absl//absl/algorithm:container",
1764    ],
1765)
1766
1767tf_cuda_cc_test(
1768    name = "conv_ops_benchmark_test",
1769    size = "medium",
1770    srcs = ["conv_ops_benchmark_test.cc"],
1771    tags = [
1772        "nomac",  # b/132448918
1773        "nomsan",  # b/141643254
1774    ],
1775    deps = [
1776        ":bias_op",
1777        ":conv_ops",
1778        ":fused_batch_norm_op",
1779        ":ops_testutil",
1780        ":ops_util",
1781        ":relu_op",
1782        "//tensorflow/cc:cc_ops",
1783        "//tensorflow/core:core_cpu",
1784        "//tensorflow/core:framework",
1785        "//tensorflow/core:framework_internal",
1786        "//tensorflow/core:lib",
1787        "//tensorflow/core:protos_all_cc",
1788        "//tensorflow/core:test",
1789        "//tensorflow/core:test_main",
1790        "//tensorflow/core:testlib",
1791        "//tensorflow/stream_executor/cuda:cudnn_plugin",
1792    ],
1793)
1794
1795tf_cuda_cc_test(
1796    name = "conv_grad_filter_ops_benchmark_test",
1797    size = "medium",
1798    srcs = ["conv_grad_filter_ops_benchmark_test.cc"],
1799    tags = ["nomsan"],  # b/141643254
1800    deps = [
1801        ":conv_ops",
1802        ":host_constant_op",
1803        ":ops_testutil",
1804        ":ops_util",
1805        "//tensorflow/cc:cc_ops",
1806        "//tensorflow/core:core_cpu",
1807        "//tensorflow/core:framework",
1808        "//tensorflow/core:framework_internal",
1809        "//tensorflow/core:lib",
1810        "//tensorflow/core:protos_all_cc",
1811        "//tensorflow/core:test",
1812        "//tensorflow/core:test_main",
1813        "//tensorflow/core:testlib",
1814        "//tensorflow/stream_executor/cuda:cudnn_plugin",
1815    ],
1816)
1817
1818tf_cuda_cc_test(
1819    name = "conv_grad_input_ops_benchmark_test",
1820    size = "medium",
1821    srcs = ["conv_grad_input_ops_benchmark_test.cc"],
1822    tags = ["nomsan"],  # b/141643254
1823    deps = [
1824        ":conv_ops",
1825        ":host_constant_op",
1826        ":ops_testutil",
1827        ":ops_util",
1828        "//tensorflow/cc:cc_ops",
1829        "//tensorflow/core:core_cpu",
1830        "//tensorflow/core:framework",
1831        "//tensorflow/core:framework_internal",
1832        "//tensorflow/core:lib",
1833        "//tensorflow/core:protos_all_cc",
1834        "//tensorflow/core:test",
1835        "//tensorflow/core:test_main",
1836        "//tensorflow/core:testlib",
1837        "//tensorflow/stream_executor/cuda:cudnn_plugin",
1838    ],
1839)
1840
1841tf_cuda_cc_test(
1842    name = "depthwise_conv_ops_test",
1843    size = "small",
1844    srcs = ["depthwise_conv_ops_test.cc"],
1845    tags = tf_cuda_tests_tags() + [
1846        "no_gpu",  # TODO(b/194100358): re-enable after flakiness resolved.
1847        "no_cuda_asan",  # TODO(b/171342266): re-enable.
1848    ],
1849    deps = [
1850        ":conv_ops",
1851        ":ops_testutil",
1852        ":ops_util",
1853        "//tensorflow/cc:cc_ops",
1854        "//tensorflow/core:core_cpu",
1855        "//tensorflow/core:framework",
1856        "//tensorflow/core:framework_internal",
1857        "//tensorflow/core:lib",
1858        "//tensorflow/core:protos_all_cc",
1859        "//tensorflow/core:tensorflow",
1860        "//tensorflow/core:test",
1861        "//tensorflow/core:test_main",
1862        "//tensorflow/core:testlib",
1863        "//tensorflow/core/kernels/image",
1864    ],
1865)
1866
1867tf_cc_test(
1868    name = "example_parsing_ops_test",
1869    size = "medium",
1870    srcs = ["example_parsing_ops_test.cc"],
1871    shard_count = 4,
1872    tags = ["optonly"],
1873    deps = [
1874        ":example_parsing_ops",
1875        ":ops_testutil",
1876        ":ops_util",
1877        "//tensorflow/core:core_cpu",
1878        "//tensorflow/core:framework",
1879        "//tensorflow/core:lib",
1880        "//tensorflow/core:protos_all_cc",
1881        "//tensorflow/core:test",
1882        "//tensorflow/core:test_main",
1883        "//tensorflow/core:testlib",
1884        "@com_google_absl//absl/base",
1885    ],
1886)
1887
1888tf_cc_test(
1889    name = "fake_quant_ops_test",
1890    size = "small",
1891    srcs = ["fake_quant_ops_test.cc"],
1892    deps = [
1893        ":fake_quant_ops",
1894        ":ops_testutil",
1895        ":ops_util",
1896        "//tensorflow/core:core_cpu",
1897        "//tensorflow/core:framework",
1898        "//tensorflow/core:lib",
1899        "//tensorflow/core:protos_all_cc",
1900        "//tensorflow/core:test",
1901        "//tensorflow/core:test_main",
1902        "//tensorflow/core:testlib",
1903    ],
1904)
1905
1906tf_cuda_cc_test(
1907    name = "fused_batch_norm_op_test",
1908    size = "small",
1909    srcs = ["fused_batch_norm_op_test.cc"],
1910    tags = [
1911        "nomsan",  # TODO(b/181135145), use-of-uninitialized-value in initializedLoggingWithEnvVariables
1912    ],
1913    deps = [
1914        ":fused_batch_norm_op",
1915        ":ops_testutil",
1916        ":ops_util",
1917        "//tensorflow/core:core_cpu",
1918        "//tensorflow/core:framework",
1919        "//tensorflow/core:lib",
1920        "//tensorflow/core:protos_all_cc",
1921        "//tensorflow/core:test",
1922        "//tensorflow/core:test_main",
1923        "//tensorflow/core:testlib",
1924        "//tensorflow/stream_executor/cuda:cudnn_plugin",
1925    ],
1926)
1927
1928tf_cuda_cc_test(
1929    name = "fused_batch_norm_ex_op_test",
1930    size = "small",
1931    srcs = ["fused_batch_norm_ex_op_test.cc"],
1932    tags = [
1933        "no_cuda_on_cpu_tap",
1934        "nomsan",  # b/141643254
1935    ],
1936    deps = [
1937        ":cwise_op",
1938        ":fused_batch_norm_op",
1939        ":ops_testutil",
1940        ":ops_util",
1941        ":relu_op",
1942        "//tensorflow/cc:cc_ops",
1943        "//tensorflow/cc:cc_ops_internal",
1944        "//tensorflow/core:core_cpu",
1945        "//tensorflow/core:direct_session",
1946        "//tensorflow/core:framework",
1947        "//tensorflow/core:framework_internal",
1948        "//tensorflow/core:lib",
1949        "//tensorflow/core:protos_all_cc",
1950        "//tensorflow/core:test",
1951        "//tensorflow/core:test_main",
1952        "//tensorflow/core:testlib",
1953        "//tensorflow/stream_executor/cuda:cudnn_plugin",
1954        "@com_google_absl//absl/algorithm:container",
1955        "@com_google_absl//absl/strings",
1956    ],
1957)
1958
1959tf_cc_test(
1960    name = "in_topk_op_test",
1961    size = "small",
1962    srcs = ["in_topk_op_test.cc"],
1963    tags = ["nomsan"],  # b/141643254
1964    deps = [
1965        ":in_topk_op",
1966        ":ops_testutil",
1967        ":ops_util",
1968        "//tensorflow/core:core_cpu",
1969        "//tensorflow/core:framework",
1970        "//tensorflow/core:lib",
1971        "//tensorflow/core:protos_all_cc",
1972        "//tensorflow/core:test",
1973        "//tensorflow/core:test_main",
1974        "//tensorflow/core:testlib",
1975        "//tensorflow/stream_executor/cuda:cudnn_plugin",
1976    ],
1977)
1978
1979tf_kernel_library(
1980    name = "gather_functor",
1981    prefix = "gather_functor",
1982    visibility = [":friends"],
1983    deps = [
1984        "//tensorflow/core:framework",
1985        "//tensorflow/core/framework:bounds_check",
1986        "//third_party/eigen3",
1987    ],
1988)
1989
1990# Unlike gather_functor library, this does not include the CUDA code and deps.
1991cc_library(
1992    name = "gather_functor_hdr",
1993    hdrs = [
1994        "gather_functor.h",
1995        "gather_functor_batched.h",
1996    ],
1997)
1998
1999tf_kernel_library(
2000    name = "dense_update_functor",
2001    srcs = ["dense_update_functor.cc"],
2002    hdrs = ["dense_update_functor.h"],
2003    gpu_srcs = [
2004        "dense_update_functor.h",
2005        "dense_update_functor_gpu.cu.cc",
2006    ],
2007    deps = [
2008        "//tensorflow/core:framework",
2009        "//tensorflow/core:lib",
2010        "//third_party/eigen3",
2011    ],
2012    alwayslink = 0,
2013)
2014
2015tf_cuda_cc_test(
2016    name = "gather_op_test",
2017    size = "small",
2018    srcs = ["gather_op_test.cc"],
2019    deps = [
2020        ":gather_op",
2021        ":host_constant_op",
2022        ":ops_testutil",
2023        ":ops_util",
2024        "//tensorflow/core:core_cpu",
2025        "//tensorflow/core:framework",
2026        "//tensorflow/core:lib",
2027        "//tensorflow/core:protos_all_cc",
2028        "//tensorflow/core:test",
2029        "//tensorflow/core:test_main",
2030        "//tensorflow/core:testlib",
2031    ],
2032)
2033
2034tf_cuda_cc_test(
2035    name = "gather_nd_op_test",
2036    size = "small",
2037    srcs = ["gather_nd_op_test.cc"],
2038    deps = [
2039        ":gather_nd_op",
2040        ":host_constant_op",
2041        ":ops_testutil",
2042        ":ops_util",
2043        "//tensorflow/core:core_cpu",
2044        "//tensorflow/core:framework",
2045        "//tensorflow/core:lib",
2046        "//tensorflow/core:protos_all_cc",
2047        "//tensorflow/core:test",
2048        "//tensorflow/core:test_main",
2049        "//tensorflow/core:testlib",
2050    ],
2051)
2052
2053tf_cc_test(
2054    name = "guarantee_const_op_test",
2055    size = "small",
2056    srcs = ["guarantee_const_op_test.cc"],
2057    deps = [
2058        ":guarantee_const_op",
2059        ":ops_testutil",
2060        ":ops_util",
2061        ":variable_ops",
2062        "//tensorflow/core:core_cpu",
2063        "//tensorflow/core:framework",
2064        "//tensorflow/core:lib",
2065        "//tensorflow/core:protos_all_cc",
2066        "//tensorflow/core:test",
2067        "//tensorflow/core:test_main",
2068        "//tensorflow/core:testlib",
2069    ],
2070)
2071
2072tf_cc_test(
2073    name = "identity_op_test",
2074    size = "small",
2075    srcs = ["identity_op_test.cc"],
2076    deps = [
2077        ":identity_op",
2078        ":ops_testutil",
2079        ":ops_util",
2080        "//tensorflow/core:core_cpu",
2081        "//tensorflow/core:framework",
2082        "//tensorflow/core:lib",
2083        "//tensorflow/core:protos_all_cc",
2084        "//tensorflow/core:test",
2085        "//tensorflow/core:test_main",
2086        "//tensorflow/core:testlib",
2087    ],
2088)
2089
2090tf_cc_test(
2091    name = "identity_n_op_test",
2092    size = "small",
2093    srcs = ["identity_n_op_test.cc"],
2094    deps = [
2095        ":identity_n_op",
2096        ":ops_testutil",
2097        ":ops_util",
2098        "//tensorflow/core:core_cpu",
2099        "//tensorflow/core:framework",
2100        "//tensorflow/core:lib",
2101        "//tensorflow/core:protos_all_cc",
2102        "//tensorflow/core:test",
2103        "//tensorflow/core:test_main",
2104        "//tensorflow/core:testlib",
2105    ],
2106)
2107
2108tf_cc_test(
2109    name = "debug_ops_test",
2110    size = "small",
2111    srcs = ["debug_ops_test.cc"],
2112    deps = [
2113        ":debug_ops",
2114        ":ops_testutil",
2115        ":ops_util",
2116        "//tensorflow/core:core_cpu",
2117        "//tensorflow/core:debug_ops_op_lib",
2118        "//tensorflow/core:framework",
2119        "//tensorflow/core:lib",
2120        "//tensorflow/core:protos_all_cc",
2121        "//tensorflow/core:test",
2122        "//tensorflow/core:test_main",
2123        "//tensorflow/core:testlib",
2124        "//tensorflow/core/debug:debug_io_utils",
2125        "//tensorflow/core/debug:debug_node_key",
2126    ],
2127)
2128
2129tf_cuda_cc_test(
2130    name = "quantize_and_dequantize_op_test",
2131    size = "small",
2132    srcs = ["quantize_and_dequantize_op_test.cc"],
2133    tags = [
2134        "no_windows",  # test uses rand_r which does not exist on Windows
2135    ],
2136    deps = [
2137        ":ops_testutil",
2138        ":ops_util",
2139        ":quantize_and_dequantize_op",
2140        "//tensorflow/cc:cc_ops",
2141        "//tensorflow/core:core_cpu",
2142        "//tensorflow/core:framework",
2143        "//tensorflow/core:lib",
2144        "//tensorflow/core:protos_all_cc",
2145        "//tensorflow/core:test",
2146        "//tensorflow/core:test_main",
2147        "//tensorflow/core:testlib",
2148    ],
2149)
2150
2151tf_cc_test(
2152    name = "dequantize_op_test",
2153    size = "small",
2154    srcs = ["dequantize_op_test.cc"],
2155    deps = [
2156        ":ops_testutil",
2157        ":ops_util",
2158        ":quantized_ops",
2159        "//tensorflow/cc:cc_ops",
2160        "//tensorflow/core:core_cpu",
2161        "//tensorflow/core:framework",
2162        "//tensorflow/core:lib",
2163        "//tensorflow/core:protos_all_cc",
2164        "//tensorflow/core:test",
2165        "//tensorflow/core:test_main",
2166        "//tensorflow/core:testlib",
2167    ],
2168)
2169
2170tf_cc_test(
2171    name = "one_hot_op_test",
2172    size = "small",
2173    srcs = ["one_hot_op_test.cc"],
2174    tags = ["nomsan"],  # b/141643254
2175    deps = [
2176        ":one_hot_op",
2177        ":ops_testutil",
2178        ":ops_util",
2179        "//tensorflow/core:core_cpu",
2180        "//tensorflow/core:framework",
2181        "//tensorflow/core:lib",
2182        "//tensorflow/core:protos_all_cc",
2183        "//tensorflow/core:test",
2184        "//tensorflow/core:test_main",
2185        "//tensorflow/core:testlib",
2186        "//tensorflow/stream_executor/cuda:cudnn_plugin",
2187    ],
2188)
2189
2190tf_cc_test(
2191    name = "reverse_op_test",
2192    size = "small",
2193    srcs = ["reverse_op_test.cc"],
2194    deps = [
2195        ":ops_testutil",
2196        ":ops_util",
2197        ":reverse_op",
2198        "//tensorflow/core:core_cpu",
2199        "//tensorflow/core:core_cpu_internal",
2200        "//tensorflow/core:framework",
2201        "//tensorflow/core:lib",
2202        "//tensorflow/core:protos_all_cc",
2203        "//tensorflow/core:test",
2204        "//tensorflow/core:test_main",
2205        "//tensorflow/core:testlib",
2206    ],
2207)
2208
2209tf_kernel_library(
2210    name = "scatter_functor",
2211    prefix = "scatter_functor",
2212    visibility = [":friends"],
2213    deps = [
2214        ":dense_update_functor",
2215        "//tensorflow/core:framework",
2216        "//tensorflow/core:lib",
2217        "//tensorflow/core/framework:bounds_check",
2218        "//third_party/eigen3",
2219    ],
2220)
2221
2222tf_cc_test(
2223    name = "shape_ops_test",
2224    size = "small",
2225    srcs = ["shape_ops_test.cc"],
2226    deps = [
2227        ":ops_testutil",
2228        ":ops_util",
2229        ":shape_ops",
2230        "//tensorflow/core:core_cpu",
2231        "//tensorflow/core:framework",
2232        "//tensorflow/core:lib",
2233        "//tensorflow/core:protos_all_cc",
2234        "//tensorflow/core:test",
2235        "//tensorflow/core:test_main",
2236        "//tensorflow/core:testlib",
2237    ],
2238)
2239
2240tf_cc_test(
2241    name = "slice_op_test",
2242    size = "small",
2243    srcs = ["slice_op_test.cc"],
2244    linkopts = select({
2245        "//tensorflow:macos": ["-headerpad_max_install_names"],
2246        "//conditions:default": [],
2247    }),
2248    deps = [
2249        ":ops_testutil",
2250        ":ops_util",
2251        ":slice_op",
2252        "//tensorflow/core:core_cpu",
2253        "//tensorflow/core:framework",
2254        "//tensorflow/core:lib",
2255        "//tensorflow/core:protos_all_cc",
2256        "//tensorflow/core:test",
2257        "//tensorflow/core:test_main",
2258        "//tensorflow/core:testlib",
2259    ],
2260)
2261
2262tf_cc_test(
2263    name = "strided_slice_op_test",
2264    size = "small",
2265    srcs = ["strided_slice_op_test.cc"],
2266    deps = [
2267        ":ops_testutil",
2268        ":ops_util",
2269        ":slice_op",
2270        ":strided_slice_op",
2271        "//tensorflow/core:core_cpu",
2272        "//tensorflow/core:framework",
2273        "//tensorflow/core:lib",
2274        "//tensorflow/core:protos_all_cc",
2275        "//tensorflow/core:test",
2276        "//tensorflow/core:test_main",
2277        "//tensorflow/core:testlib",
2278    ],
2279)
2280
2281tf_cc_test(
2282    name = "unique_op_test",
2283    size = "small",
2284    srcs = ["unique_op_test.cc"],
2285    deps = [
2286        ":ops_testutil",
2287        ":ops_util",
2288        ":unique_op",
2289        "//tensorflow/core:core_cpu",
2290        "//tensorflow/core:framework",
2291        "//tensorflow/core:lib",
2292        "//tensorflow/core:protos_all_cc",
2293        "//tensorflow/core:test",
2294        "//tensorflow/core:test_main",
2295        "//tensorflow/core:testlib",
2296    ],
2297)
2298
2299tf_kernel_library(
2300    name = "transpose_functor",
2301    srcs = ["transpose_functor_cpu.cc"],
2302    hdrs = ["transpose_functor.h"],
2303    gpu_srcs = [
2304        "transpose_functor_gpu.cu.cc",
2305        "transpose_functor.h",
2306    ],
2307    visibility = [":friends"],
2308    deps = [
2309        ":conv_2d",
2310        ":ops_util",
2311        "//tensorflow/core:framework",
2312        "//tensorflow/core:lib",
2313        "//tensorflow/core:protos_all_cc",
2314        "//third_party/eigen3",
2315    ],
2316    alwayslink = 1,
2317)
2318
2319tf_cc_test(
2320    name = "transpose_util_test",
2321    size = "small",
2322    srcs = ["transpose_util_test.cc"],
2323    deps = [
2324        ":transpose_functor",
2325        "//tensorflow/core:framework",
2326        "//tensorflow/core:test",
2327        "//tensorflow/core:test_main",
2328        "//tensorflow/core/framework:tensor_testutil",
2329    ],
2330)
2331
2332tf_kernel_library(
2333    name = "candidate_sampler_ops",
2334    prefix = "candidate_sampler_ops",
2335    deps = [
2336        ":range_sampler",
2337        "//tensorflow/core:framework",
2338        "//tensorflow/core:lib",
2339    ],
2340)
2341
2342cc_library(
2343    name = "range_sampler",
2344    srcs = ["range_sampler.cc"],
2345    hdrs = ["range_sampler.h"],
2346    visibility = ["//visibility:private"],
2347    deps = [
2348        "//tensorflow/core:lib",
2349        "//tensorflow/core:lib_internal",
2350    ],
2351)
2352
2353tf_cc_test(
2354    name = "range_sampler_test",
2355    size = "small",
2356    srcs = ["range_sampler_test.cc"],
2357    deps = [
2358        ":range_sampler",
2359        "//tensorflow/core:framework",
2360        "//tensorflow/core:lib",
2361        "//tensorflow/core:test",
2362        "//tensorflow/core:test_main",
2363    ],
2364)
2365
2366tf_kernel_library(
2367    name = "control_flow_ops",
2368    prefix = "control_flow_ops",
2369    deps = [
2370        "//tensorflow/core:framework",
2371        "//tensorflow/core:lib",
2372    ],
2373)
2374
2375tf_kernel_library(
2376    name = "ctc_ops",
2377    prefix = "ctc",
2378    deps = [
2379        "//tensorflow/core/framework:bounds_check",
2380        ":ops_util",
2381        "//tensorflow/core:framework",
2382        "//tensorflow/core:lib",
2383        "//tensorflow/core/util/ctc:ctc_beam_search_lib",
2384        "//tensorflow/core/util/ctc:ctc_loss_calculator_lib",
2385    ] + if_cuda_or_rocm([
2386        ":gpu_utils",
2387        ":conv_ops_gpu_hdrs",
2388    ]) + if_cuda([
2389        "@local_config_cuda//cuda:cudnn_header",
2390    ]),
2391)
2392
2393tf_cc_test(
2394    name = "control_flow_ops_test",
2395    size = "small",
2396    srcs = ["control_flow_ops_test.cc"],
2397    deps = [
2398        ":control_flow_ops",
2399        ":ops_testutil",
2400        ":ops_util",
2401        "//tensorflow/core:framework",
2402        "//tensorflow/core:protos_all_cc",
2403        "//tensorflow/core:test",
2404        "//tensorflow/core:test_main",
2405        "//tensorflow/core:testlib",
2406    ],
2407)
2408
2409cc_library(
2410    name = "data_flow",
2411    deps = [
2412        ":barrier_ops",
2413        ":conditional_accumulator_base_op",
2414        ":conditional_accumulator_op",
2415        ":dynamic_partition_op",
2416        ":dynamic_stitch_op",
2417        ":fifo_queue_op",
2418        ":lookup_table_init_op",
2419        ":lookup_table_op",
2420        ":map_stage_op",
2421        ":padding_fifo_queue_op",
2422        ":priority_queue_op",
2423        ":queue_ops",
2424        ":random_shuffle_queue_op",
2425        ":record_input_op",
2426        ":session_ops",
2427        ":sparse_conditional_accumulator_op",
2428        ":stack_ops",
2429        ":stage_op",
2430        ":tensor_array_ops",
2431    ],
2432)
2433
2434cc_library(
2435    name = "lookup",
2436    deps = [
2437        ":lookup_table_init_op",
2438        ":lookup_table_op",
2439    ],
2440)
2441
2442cc_header_only_library(
2443    name = "lookup_headers_lib",
2444    deps = [":lookup"],
2445)
2446
2447DATA_FLOW_DEPS = [
2448    ":concat_lib",
2449    ":conditional_accumulator",
2450    ":conditional_accumulator_base",
2451    ":fifo_queue",
2452    ":initializable_lookup_table",
2453    ":lookup_util",
2454    ":padding_fifo_queue",
2455    ":priority_queue",
2456    ":queue_base",
2457    ":queue_op",
2458    ":sparse_conditional_accumulator",
2459    ":split_lib",
2460    ":tensor_array",
2461    ":typed_conditional_accumulator_base",
2462    ":typed_queue",
2463    "//third_party/eigen3",
2464    "//tensorflow/core:core_cpu",
2465    "//tensorflow/core:framework",
2466    "//tensorflow/core:lib",
2467    "//tensorflow/core:lib_internal",
2468    "//tensorflow/core/framework:bounds_check",
2469]
2470
2471tf_kernel_library(
2472    name = "conditional_accumulator_base_op",
2473    prefix = "conditional_accumulator_base_op",
2474    deps = DATA_FLOW_DEPS,
2475)
2476
2477tf_kernel_library(
2478    name = "conditional_accumulator_op",
2479    prefix = "conditional_accumulator_op",
2480    deps = DATA_FLOW_DEPS,
2481)
2482
2483tf_kernel_library(
2484    name = "barrier_ops",
2485    prefix = "barrier_ops",
2486    deps = DATA_FLOW_DEPS,
2487)
2488
2489tf_kernel_library(
2490    name = "fifo_queue_op",
2491    prefix = "fifo_queue_op",
2492    deps = DATA_FLOW_DEPS,
2493)
2494
2495tf_kernel_library(
2496    name = "padding_fifo_queue_op",
2497    prefix = "padding_fifo_queue_op",
2498    deps = DATA_FLOW_DEPS,
2499)
2500
2501tf_kernel_library(
2502    name = "priority_queue_op",
2503    prefix = "priority_queue_op",
2504    deps = DATA_FLOW_DEPS,
2505)
2506
2507tf_kernel_library(
2508    name = "queue_ops",
2509    prefix = "queue_ops",
2510    deps = DATA_FLOW_DEPS,
2511)
2512
2513tf_kernel_library(
2514    name = "random_shuffle_queue_op",
2515    prefix = "random_shuffle_queue_op",
2516    deps = DATA_FLOW_DEPS + [
2517        "//tensorflow/core:protos_all_cc",
2518    ],
2519)
2520
2521tf_kernel_library(
2522    name = "scoped_allocator_ops",
2523    prefix = "scoped_allocator_ops",
2524    deps = [
2525        "//tensorflow/core:core_cpu",
2526        "//tensorflow/core:core_cpu_internal",
2527        "//tensorflow/core:framework",
2528        "//tensorflow/core:lib",
2529        "//tensorflow/core:lib_internal",
2530    ],
2531)
2532
2533tf_cuda_cc_test(
2534    name = "scoped_allocator_ops_test",
2535    srcs = ["scoped_allocator_ops_test.cc"],
2536    linkstatic = tf_kernel_tests_linkstatic(),  #Required for benchmarking
2537    deps = [
2538        ":cwise_op",
2539        ":dense_update_ops",
2540        ":ops_testutil",
2541        ":ops_util",
2542        ":scoped_allocator_ops",
2543        ":variable_ops",
2544        "//tensorflow/core:core_cpu",
2545        "//tensorflow/core:core_cpu_internal",
2546        "//tensorflow/core:framework",
2547        "//tensorflow/core:lib",
2548        "//tensorflow/core:protos_all_cc",
2549        "//tensorflow/core:test",
2550        "//tensorflow/core:test_main",
2551        "//tensorflow/core:testlib",
2552    ],
2553)
2554
2555tf_kernel_library(
2556    name = "session_ops",
2557    prefix = "session_ops",
2558    deps = DATA_FLOW_DEPS,
2559)
2560
2561tf_kernel_library(
2562    name = "sparse_conditional_accumulator_op",
2563    prefix = "sparse_conditional_accumulator_op",
2564    deps = DATA_FLOW_DEPS,
2565)
2566
2567cc_library(
2568    name = "stack",
2569    srcs = ["stack.cc"],
2570    hdrs = ["stack.h"],
2571    deps = [
2572        "//tensorflow/core:core_cpu",
2573        "//tensorflow/core:framework",
2574        "//tensorflow/core:lib",
2575        "//tensorflow/core:lib_internal",
2576    ],
2577)
2578
2579tf_kernel_library(
2580    name = "stack_ops",
2581    prefix = "stack_ops",
2582    deps = DATA_FLOW_DEPS + [":stack"],
2583)
2584
2585tf_kernel_library(
2586    name = "tensor_array_ops",
2587    prefix = "tensor_array_ops",
2588    deps = DATA_FLOW_DEPS,
2589)
2590
2591DYNAMIC_DEPS = [
2592    "//tensorflow/core/framework:bounds_check",
2593    "//tensorflow/core:core_cpu",
2594    "//tensorflow/core:framework",
2595    "//tensorflow/core:lib",
2596    "//tensorflow/core:lib_internal",
2597]
2598
2599tf_kernel_library(
2600    name = "dynamic_partition_op",
2601    prefix = "dynamic_partition_op",
2602    deps = DYNAMIC_DEPS + [
2603        ":fill_functor",
2604        ":gather_functor",
2605        ":gpu_prim_hdrs",
2606        "//tensorflow/core:framework_internal",
2607    ],
2608)
2609
2610tf_kernel_library(
2611    name = "dynamic_stitch_op",
2612    gpu_srcs = [
2613        "gpu_device_array.h",
2614        "gpu_device_array_gpu.h",
2615    ],
2616    prefix = "dynamic_stitch_op",
2617    deps = DYNAMIC_DEPS,
2618)
2619
2620cc_library(
2621    name = "tensor_cord",
2622    srcs = ["tensor_cord.cc"],
2623    hdrs = ["tensor_cord.h"],
2624    deps = [
2625        "//tensorflow/core:framework",
2626        "@com_google_absl//absl/strings",
2627        "@com_google_absl//absl/types:span",
2628    ],
2629)
2630
2631tf_cc_test(
2632    name = "tensor_cord_test",
2633    srcs = ["tensor_cord_test.cc"],
2634    deps = [
2635        ":tensor_cord",
2636        "//tensorflow/core:framework",
2637        "//tensorflow/core:framework_internal",
2638        "//tensorflow/core:test",
2639        "//tensorflow/core:test_main",
2640        "//tensorflow/core/platform:cord",
2641    ],
2642)
2643
2644LOOKUP_DEPS = [
2645    ":initializable_lookup_table",
2646    ":lookup_util",
2647    "@com_google_absl//absl/container:flat_hash_map",
2648    "//tensorflow/core:core_cpu",
2649    "//tensorflow/core:framework",
2650    "//tensorflow/core:lib",
2651    "//tensorflow/core:lib_internal",
2652    "//tensorflow/core/framework:bounds_check",
2653]
2654
2655tf_kernel_library(
2656    name = "lookup_table_init_op",
2657    prefix = "lookup_table_init_op",
2658    deps = LOOKUP_DEPS,
2659)
2660
2661tf_kernel_library(
2662    name = "lookup_table_op",
2663    prefix = "lookup_table_op",
2664    deps = LOOKUP_DEPS,
2665)
2666
2667cc_library(
2668    name = "checkpoint_ops",
2669    deps = [
2670        ":generate_vocab_remapping_op",
2671        ":load_and_remap_matrix_op",
2672    ],
2673)
2674
2675tf_kernel_library(
2676    name = "generate_vocab_remapping_op",
2677    srcs = ["generate_vocab_remapping_op.cc"],
2678    deps = [
2679        ":lookup_table_init_op",
2680        ":lookup_table_op",
2681        "//tensorflow/core:framework",
2682        "//tensorflow/core:lib",
2683        "//third_party/eigen3",
2684    ],
2685)
2686
2687tf_kernel_library(
2688    name = "load_and_remap_matrix_op",
2689    srcs = ["load_and_remap_matrix_op.cc"],
2690    deps = [
2691        "//tensorflow/core:framework",
2692        "//tensorflow/core:lib",
2693        "//tensorflow/core:lib_internal",
2694        "//tensorflow/core/util/tensor_bundle",
2695        "//third_party/eigen3",
2696    ],
2697)
2698
2699tf_cuda_cc_tests(
2700    name = "dynamic_op_test",
2701    size = "small",
2702    srcs = [
2703        "dynamic_partition_op_test.cc",
2704        "dynamic_stitch_op_test.cc",
2705    ],
2706    deps = [
2707        ":data_flow",
2708        ":ops_testutil",
2709        ":ops_util",
2710        "//tensorflow/core:core_cpu",
2711        "//tensorflow/core:framework",
2712        "//tensorflow/core:lib",
2713        "//tensorflow/core:protos_all_cc",
2714        "//tensorflow/core:test",
2715        "//tensorflow/core:test_main",
2716        "//tensorflow/core:testlib",
2717    ],
2718)
2719
2720cc_library(
2721    name = "fifo_queue",
2722    srcs = ["fifo_queue.cc"],
2723    hdrs = ["fifo_queue.h"],
2724    visibility = [":friends"],
2725    deps = [
2726        ":queue_base",
2727        ":queue_op",
2728        ":typed_queue",
2729        "//tensorflow/core:framework",
2730        "//tensorflow/core:lib",
2731        "//tensorflow/core:protos_all_cc",
2732    ],
2733)
2734
2735cc_library(
2736    name = "padding_fifo_queue",
2737    srcs = ["padding_fifo_queue.cc"],
2738    hdrs = ["padding_fifo_queue.h"],
2739    visibility = ["//visibility:private"],
2740    deps = [
2741        ":fifo_queue",
2742        ":queue_base",
2743        ":typed_queue",
2744        "//tensorflow/core:framework",
2745        "//tensorflow/core:lib",
2746        "//tensorflow/core:protos_all_cc",
2747    ],
2748)
2749
2750cc_library(
2751    name = "conditional_accumulator_base",
2752    srcs = ["conditional_accumulator_base.cc"],
2753    hdrs = [
2754        "conditional_accumulator_base.h",
2755    ],
2756    deps = [
2757        "//tensorflow/core:framework",
2758        "//tensorflow/core:lib",
2759        "//third_party/eigen3",
2760    ],
2761)
2762
2763cc_library(
2764    name = "typed_conditional_accumulator_base",
2765    hdrs = ["typed_conditional_accumulator_base.h"],
2766    deps = [
2767        ":conditional_accumulator_base",
2768    ],
2769)
2770
2771cc_library(
2772    name = "conditional_accumulator",
2773    hdrs = [
2774        "conditional_accumulator.h",
2775        "conditional_accumulator_base_op.h",
2776    ],
2777    deps = [
2778        ":conditional_accumulator_base",
2779        ":fill_functor",
2780        ":typed_conditional_accumulator_base",
2781    ],
2782)
2783
2784cc_library(
2785    name = "sparse_conditional_accumulator",
2786    hdrs = ["sparse_conditional_accumulator.h"],
2787    deps = [
2788        ":typed_conditional_accumulator_base",
2789    ],
2790)
2791
2792tf_kernel_library(
2793    name = "tensor_array",
2794    srcs = ["tensor_array.cc"],
2795    hdrs = ["tensor_array.h"],
2796    visibility = ["//visibility:private"],
2797    deps = [
2798        ":aggregate_ops",
2799        "//tensorflow/core:framework",
2800        "//tensorflow/core:lib",
2801        "//third_party/eigen3",
2802    ],
2803)
2804
2805tf_kernel_library(
2806    name = "resource_variable_ops",
2807    srcs = ["resource_variable_ops.cc"],
2808    hdrs = ["resource_variable_ops.h"],
2809    deps = [
2810        ":dense_update_functor",
2811        ":gather_functor",
2812        ":gather_nd_op",
2813        ":scatter_functor",
2814        ":training_op_helpers",
2815        ":variable_ops",
2816        "//tensorflow/core:core_cpu_lib",
2817        "//tensorflow/core:framework",
2818        "//tensorflow/core:lib",
2819        "//tensorflow/core:lib_internal",
2820        "//tensorflow/core/framework:bounds_check",
2821        "@com_google_absl//absl/strings",
2822    ],
2823)
2824
2825cc_library(
2826    name = "tensor_list",
2827    srcs = ["tensor_list.cc"],
2828    hdrs = ["tensor_list.h"],
2829    deps = [
2830        "//tensorflow/core:framework",
2831        "//tensorflow/core:lib",
2832        "//tensorflow/core:protos_all_cc",
2833        "//tensorflow/core/framework:tensor_shape_proto_cc",
2834        "//tensorflow/core/lib/core:refcount",
2835    ],
2836)
2837
2838tf_kernel_library(
2839    name = "list_kernels",
2840    srcs = ["list_kernels.cc"],
2841    hdrs = ["list_kernels.h"],
2842    gpu_srcs = [
2843        "list_kernels.cu.cc",
2844        "list_kernels.h",
2845    ],
2846    deps = [
2847        ":concat_lib",
2848        ":fill_functor",
2849        ":tensor_list",
2850        "//tensorflow/core:framework",
2851        "//tensorflow/core:lib",
2852        "//third_party/eigen3",
2853    ],
2854)
2855
2856cc_library(
2857    name = "tensor_map",
2858    srcs = ["tensor_map.cc"],
2859    hdrs = ["tensor_map.h"],
2860    deps = [
2861        "//tensorflow/core:framework",
2862        "//tensorflow/core:framework_internal",
2863        "//tensorflow/core:lib",
2864        "//tensorflow/core:protos_all_cc",
2865        "//tensorflow/core/framework:tensor_shape_proto_cc",
2866        "//tensorflow/core/lib/core:refcount",
2867    ],
2868)
2869
2870tf_kernel_library(
2871    name = "map_kernels",
2872    srcs = ["map_kernels.cc"],
2873    hdrs = ["map_kernels.h"],
2874    deps = [
2875        ":concat_lib",
2876        ":fill_functor",
2877        ":tensor_map",
2878        "//tensorflow/core:framework",
2879        "//tensorflow/core:framework_internal",
2880        "//tensorflow/core:lib",
2881        "//third_party/eigen3",
2882    ],
2883)
2884
2885tf_cc_tests(
2886    name = "tensor_map_test",
2887    size = "small",
2888    srcs = [
2889        "tensor_map_test.cc",
2890    ],
2891    tags = ["nomsan"],  # b/163222155
2892    deps = [
2893        ":tensor_map",
2894        "//tensorflow/core:framework",
2895        "//tensorflow/core:test",
2896        "//tensorflow/core:test_main",
2897        "//tensorflow/core/framework:tensor_testutil",
2898        "@com_google_absl//absl/container:flat_hash_map",
2899        "@com_google_absl//absl/strings",
2900    ],
2901)
2902
2903tf_kernel_library(
2904    name = "fact_op",
2905    prefix = "fact_op",
2906    deps = [
2907        "//tensorflow/core:framework",
2908        "//tensorflow/core:lib",
2909    ],
2910)
2911
2912tf_kernel_library(
2913    name = "function_ops",
2914    prefix = "function_ops",
2915    deps = [
2916        "//tensorflow/core:core_cpu",
2917        "//tensorflow/core:core_cpu_internal",
2918        "//tensorflow/core:framework",
2919        "//tensorflow/core:lib",
2920        "//tensorflow/core:lib_internal",
2921        "//tensorflow/core/profiler/lib:traceme",
2922    ],
2923)
2924
2925tf_kernel_library(
2926    name = "functional_ops",
2927    prefix = "functional_ops",
2928    deps = [
2929        "//tensorflow/core:core_cpu",
2930        "//tensorflow/core:core_cpu_internal",
2931        "//tensorflow/core:framework",
2932        "//tensorflow/core:lib",
2933        "//tensorflow/core:lib_internal",
2934        "//tensorflow/core/profiler/lib:traceme",
2935        "//third_party/eigen3",
2936    ],
2937)
2938
2939tf_kernel_library(
2940    name = "partitioned_function_ops",
2941    prefix = "partitioned_function_ops",
2942    deps = [
2943        "//tensorflow/core:core_cpu_internal",
2944        "//tensorflow/core:framework",
2945        "//tensorflow/core:lib",
2946        "//tensorflow/core:lib_internal",
2947        "//tensorflow/core:protos_all_cc",
2948        "//tensorflow/core/grappler:grappler_item",
2949        "//tensorflow/core/grappler/clusters:virtual_cluster",
2950        "//tensorflow/core/grappler/optimizers:meta_optimizer",
2951        "//tensorflow/core/grappler/utils:functions",
2952        "//tensorflow/core/profiler/lib:traceme",
2953        "//tensorflow/stream_executor:stream",
2954        "@com_google_absl//absl/strings",
2955    ],
2956)
2957
2958tf_cc_tests(
2959    name = "eigen_test",
2960    size = "small",
2961    srcs = [
2962        "eigen_activations_test.cc",
2963        "eigen_attention_test.cc",
2964        "eigen_backward_cuboid_convolutions_test.cc",
2965        "eigen_backward_spatial_convolutions_test.cc",
2966        "eigen_pooling_test.cc",
2967        "eigen_spatial_convolutions_test.cc",
2968    ],
2969    deps = [
2970        ":eigen_helpers",
2971        "//tensorflow/core:test",
2972        "//tensorflow/core:test_main",
2973        "@com_google_absl//absl/strings",
2974    ],
2975)
2976
2977# Conditional test target generation is not supported by the "tf_cc_tests" macro
2978# (can't add 'select' to the srcs field, type 'select' is not iterable).
2979tf_cc_test(
2980    name = "eigen_mkldnn_contraction_kernel_test",
2981    size = "small",
2982    srcs = select({
2983        "//tensorflow:android_x86": [],
2984        "//tensorflow:arm_any": [],
2985        "//tensorflow:ios": [],
2986        "//tensorflow:linux_ppc64le": [],
2987        "//tensorflow:linux_s390x": [],
2988        ":no_mkldnn_contraction_kernel": [],
2989        "//conditions:default": ["eigen_mkldnn_contraction_kernel_test.cc"],
2990    }),
2991    tags = ["mkldnn_contraction_kernel"],
2992    deps = [
2993        ":eigen_contraction_kernel",
2994        "//tensorflow/core:test",
2995        "//tensorflow/core:test_main",
2996        "//third_party/eigen3",
2997    ],
2998)
2999
3000cc_library(
3001    name = "eigen_benchmark",
3002    testonly = 1,
3003    hdrs = [
3004        "eigen_benchmark.h",
3005        ":eigen_helpers",
3006    ],
3007    deps = [
3008        "//tensorflow/core:framework",
3009        "//third_party/eigen3",
3010    ],
3011)
3012
3013tf_cc_test(
3014    name = "eigen_benchmark_cpu_test",
3015    srcs = ["eigen_benchmark_cpu_test.cc"],
3016    deps = [
3017        ":eigen_benchmark",
3018        ":eigen_helpers",
3019        "//tensorflow/core:test",
3020        "//tensorflow/core:test_main",
3021        "//third_party/eigen3",
3022    ],
3023)
3024
3025tf_cc_tests(
3026    name = "basic_ops_benchmark_test",
3027    size = "small",
3028    srcs = [
3029        "basic_ops_benchmark_test.cc",
3030    ],
3031    deps = [
3032        ":math",
3033        ":ops_util",
3034        ":state",
3035        "//tensorflow/core:core_cpu",
3036        "//tensorflow/core:framework",
3037        "//tensorflow/core:test",
3038        "//tensorflow/core:test_main",
3039        "//tensorflow/core:testlib",
3040    ],
3041)
3042
3043cc_library(
3044    name = "io",
3045    deps = [
3046        ":fixed_length_record_reader_op",
3047        ":identity_reader_op",
3048        ":matching_files_op",
3049        ":reader_ops",
3050        ":restore_op",
3051        ":save_op",
3052        ":save_restore_v2_ops",
3053        ":text_line_reader_op",
3054        ":tf_record_reader_op",
3055        ":whole_file_read_ops",
3056    ] + select({
3057        "//tensorflow:fuchsia": [],
3058        "//conditions:default": [":lmdb_reader_op"],
3059    }),
3060)
3061
3062IO_DEPS = [
3063    ":ops_util",
3064    "//tensorflow/core:framework",
3065    "//tensorflow/core:lib",
3066    "//tensorflow/core:lib_internal",
3067    "//tensorflow/core:protos_all_cc",
3068    "//tensorflow/core:reader_base",
3069    "//tensorflow/core/util/tensor_bundle",
3070]
3071
3072tf_kernel_library(
3073    name = "fixed_length_record_reader_op",
3074    prefix = "fixed_length_record_reader_op",
3075    deps = IO_DEPS,
3076)
3077
3078tf_kernel_library(
3079    name = "identity_reader_op",
3080    prefix = "identity_reader_op",
3081    deps = IO_DEPS + ["@com_google_absl//absl/strings"],
3082)
3083
3084tf_kernel_library(
3085    name = "lmdb_reader_op",
3086    prefix = "lmdb_reader_op",
3087    deps = IO_DEPS + [
3088        "@lmdb",
3089    ],
3090)
3091
3092tf_kernel_library(
3093    name = "matching_files_op",
3094    prefix = "matching_files_op",
3095    deps = IO_DEPS,
3096)
3097
3098tf_kernel_library(
3099    name = "reader_ops",
3100    prefix = "reader_ops",
3101    deps = IO_DEPS,
3102)
3103
3104SAVE_RESTORE_DEPS = [
3105    ":save_restore_tensor",
3106    "//tensorflow/core:framework",
3107    "//tensorflow/core:lib",
3108    "//tensorflow/core:lib_internal",
3109    "//tensorflow/core:protos_all_cc",
3110    "//tensorflow/core/framework:bounds_check",
3111    "//tensorflow/core/util/tensor_bundle",
3112]
3113
3114tf_kernel_library(
3115    name = "restore_op",
3116    prefix = "restore_op",
3117    deps = SAVE_RESTORE_DEPS,
3118)
3119
3120tf_kernel_library(
3121    name = "save_op",
3122    prefix = "save_op",
3123    deps = SAVE_RESTORE_DEPS,
3124)
3125
3126tf_kernel_library(
3127    name = "save_restore_v2_ops",
3128    prefix = "save_restore_v2_ops",
3129    deps = SAVE_RESTORE_DEPS,
3130)
3131
3132tf_kernel_library(
3133    name = "text_line_reader_op",
3134    prefix = "text_line_reader_op",
3135    deps = IO_DEPS,
3136)
3137
3138tf_kernel_library(
3139    name = "tf_record_reader_op",
3140    prefix = "tf_record_reader_op",
3141    deps = IO_DEPS,
3142)
3143
3144tf_kernel_library(
3145    name = "whole_file_read_ops",
3146    prefix = "whole_file_read_ops",
3147    deps = IO_DEPS + ["@com_google_absl//absl/strings"],
3148)
3149
3150tf_cc_tests(
3151    name = "bonus2_tests",
3152    size = "small",
3153    srcs = [
3154        "merge_v2_checkpoints_op_test.cc",
3155        "restore_op_test.cc",
3156        "restore_v2_op_test.cc",
3157        "save_op_test.cc",
3158        "save_v2_op_test.cc",
3159    ],
3160    deps = [
3161        ":io",
3162        ":ops_testutil",
3163        ":ops_util",
3164        "//tensorflow/cc:cc_ops",
3165        "//tensorflow/core:core_cpu",
3166        "//tensorflow/core:core_cpu_internal",
3167        "//tensorflow/core:framework",
3168        "//tensorflow/core:lib",
3169        "//tensorflow/core:protos_all_cc",
3170        "//tensorflow/core:test",
3171        "//tensorflow/core:test_main",
3172        "//tensorflow/core:testlib",
3173        "//tensorflow/core/util/tensor_bundle",
3174    ],
3175)
3176
3177cc_library(
3178    name = "logging",
3179    deps = [
3180        ":logging_ops",
3181        ":summary_audio_op",
3182        ":summary_image_op",
3183        ":summary_tensor_op",
3184    ],
3185)
3186
3187LOGGING_DEPS = [
3188    "@com_google_absl//absl/strings",
3189    "//tensorflow/core:framework",
3190    "//tensorflow/core:lib",
3191    "//tensorflow/core:lib_internal",
3192    "//tensorflow/core:protos_all_cc",
3193    # TODO(b/162630222): remove this dependency.
3194    "//tensorflow/c/kernels:histogram_summary_op",
3195    "//tensorflow/c/kernels:merge_summary_op",
3196    "//tensorflow/c/kernels:summary_op",
3197]
3198
3199tf_kernel_library(
3200    name = "logging_ops",
3201    prefix = "logging_ops",
3202    deps = LOGGING_DEPS,
3203)
3204
3205tf_kernel_library(
3206    name = "summary_audio_op",
3207    prefix = "summary_audio_op",
3208    deps = LOGGING_DEPS,
3209)
3210
3211tf_kernel_library(
3212    name = "summary_image_op",
3213    prefix = "summary_image_op",
3214    deps = LOGGING_DEPS + ["//tensorflow/core/lib/png:png_io"],
3215)
3216
3217# TODO(b/162630222): remove this target
3218cc_library(
3219    name = "summary_op",
3220    deps = [
3221        "//tensorflow/c/kernels:histogram_summary_op",
3222        "//tensorflow/c/kernels:merge_summary_op",
3223        "//tensorflow/c/kernels:summary_op",
3224    ],
3225)
3226
3227tf_kernel_library(
3228    name = "summary_tensor_op",
3229    prefix = "summary_tensor_op",
3230    deps = LOGGING_DEPS,
3231)
3232
3233tf_cc_tests(
3234    name = "bonus3_tests",
3235    size = "small",
3236    srcs = [
3237        "logging_ops_test.cc",
3238        "summary_audio_op_test.cc",
3239        "summary_image_op_test.cc",
3240        "summary_op_test.cc",
3241        "summary_tensor_op_test.cc",
3242    ],
3243    deps = [
3244        ":logging",
3245        ":ops_testutil",
3246        ":ops_util",
3247        "//tensorflow/core:framework",
3248        "//tensorflow/core:lib",
3249        "//tensorflow/core:protos_all_cc",
3250        "//tensorflow/core:test",
3251        "//tensorflow/core:test_main",
3252        "//tensorflow/core:testlib",
3253        "@com_google_absl//absl/strings",
3254    ],
3255)
3256
3257cc_library(
3258    name = "manip",
3259    deps = [
3260        ":roll_op",
3261    ],
3262)
3263
3264tf_kernel_library(
3265    name = "roll_op",
3266    srcs = ["roll_op.cc"],
3267    hdrs = ["roll_op.h"],
3268    gpu_srcs = [
3269        "roll_op_gpu.cu.cc",
3270        "roll_op.h",
3271    ],
3272    deps = [
3273        "//tensorflow/core:framework",
3274        "//tensorflow/core:lib",
3275        "//tensorflow/core/framework:bounds_check",
3276        "//third_party/eigen3",
3277    ],
3278)
3279
3280tf_cc_test(
3281    name = "roll_op_test",
3282    size = "small",
3283    srcs = ["roll_op_test.cc"],
3284    deps = [
3285        ":ops_testutil",
3286        ":ops_util",
3287        ":roll_op",
3288        "//tensorflow/core:core_cpu",
3289        "//tensorflow/core:core_cpu_internal",
3290        "//tensorflow/core:framework",
3291        "//tensorflow/core:lib",
3292        "//tensorflow/core:protos_all_cc",
3293        "//tensorflow/core:test",
3294        "//tensorflow/core:test_main",
3295        "//tensorflow/core:testlib",
3296    ],
3297)
3298
3299tf_cc_test(
3300    name = "resource_ops_test",
3301    size = "small",
3302    srcs = ["resource_ops_test.cc"],
3303    deps = [
3304        ":dense_update_functor",
3305        ":ops_testutil",
3306        "//tensorflow/core:test",
3307        "//tensorflow/core:test_main",
3308        "//tensorflow/core:testlib",
3309    ],
3310)
3311
3312MATH_DEPS = [
3313    ":fill_functor",
3314    "//tensorflow/core:core_cpu",
3315    "//tensorflow/core:framework",
3316    "//tensorflow/core:lib",
3317    "//tensorflow/core:lib_internal",
3318    "//tensorflow/core:math_grad",
3319    "//tensorflow/core/framework:bounds_check",
3320    "//tensorflow/core/framework:op_requires",
3321    "//third_party/eigen3",
3322]
3323
3324tf_kernel_library(
3325    name = "sparse_matmul_op",
3326    defines = select({
3327        ":xsmm": ["TENSORFLOW_USE_LIBXSMM"],
3328        "//conditions:default": [],
3329    }),
3330    prefix = "sparse_matmul_op",
3331    deps = MATH_DEPS + [":eigen_contraction_kernel"] + select({
3332        ":xsmm": [
3333            "@libxsmm_archive//:xsmm_avx",
3334        ],
3335        "//conditions:default": [],
3336    }),
3337)
3338
3339cc_library(
3340    name = "math",
3341    deps = [
3342        ":aggregate_ops",
3343        ":argmax_op",
3344        ":betainc_op",
3345        ":bincount_op",
3346        ":bucketize_op",
3347        ":cast_op",
3348        ":check_numerics_op",
3349        ":cross_op",
3350        ":cwise_op",
3351        ":fft_ops",
3352        ":histogram_op",
3353        ":matmul_op",
3354        ":nextafter_op",
3355        ":population_count_op",
3356        ":reduction_ops",
3357        ":scan_ops",
3358        ":segment_reduction_ops",
3359        ":sequence_ops",
3360        ":sparse_matmul_op",
3361        "//tensorflow/core/kernels/special_math:special_math_op",
3362    ],
3363)
3364
3365tf_kernel_library(
3366    name = "aggregate_ops",
3367    prefix = "aggregate_ops",
3368    deps = MATH_DEPS,
3369)
3370
3371tf_kernel_library(
3372    name = "argmax_op",
3373    prefix = "argmax_op",
3374    deps = MATH_DEPS,
3375)
3376
3377tf_kernel_library(
3378    name = "batch_matmul_op",
3379    deps = [":matmul_op"],
3380)
3381
3382tf_kernel_library(
3383    name = "matmul_op",
3384    # <prefix>*impl.h are excluded by default from the CPU build, add explicitly.
3385    hdrs = ["matmul_op_impl.h"],
3386    defines = select({
3387        ":xsmm": ["TENSORFLOW_USE_LIBXSMM"],
3388        "//conditions:default": [],
3389    }),
3390    prefix = "matmul_op",
3391    deps = MATH_DEPS + [
3392        ":eigen_contraction_kernel",
3393        ":fused_eigen_output_kernels",
3394    ] + select({
3395        ":xsmm": ["@libxsmm_archive//:xsmm_avx"],
3396        "//conditions:default": [],
3397    }) + mkl_deps() + if_cuda([
3398        "//tensorflow/core/platform/default/build_config:cublas_plugin",
3399    ]) + if_cuda_or_rocm([":gpu_utils"]),
3400)
3401
3402tf_kernel_library(
3403    name = "betainc_op",
3404    prefix = "betainc_op",
3405    deps = MATH_DEPS,
3406)
3407
3408tf_kernel_library(
3409    name = "bucketize_op",
3410    gpu_srcs = ["gpu_device_array.h"],
3411    prefix = "bucketize_op",
3412    deps = ARRAY_DEPS,
3413)
3414
3415tf_kernel_library(
3416    name = "cast_op",
3417    copts = if_mlir_generated_gpu_kernels_enabled(
3418        ["-DMLIR_GENERATED_GPU_KERNELS_ENABLED"],
3419    ),
3420    # *.cu.cc sources are compiled with gpu_copts instead of copts.
3421    gpu_copts = if_mlir_generated_gpu_kernels_enabled(
3422        ["-DMLIR_GENERATED_GPU_KERNELS_ENABLED"],
3423    ),
3424    prefix = "cast_op",
3425    deps = MATH_DEPS + [
3426        "//tensorflow/core/kernels/mlir_generated:cast_op",
3427    ],
3428)
3429
3430tf_kernel_library(
3431    name = "check_numerics_op",
3432    prefix = "check_numerics_op",
3433    deps = MATH_DEPS + ["//tensorflow/core:framework_internal"],
3434)
3435
3436tf_kernel_library(
3437    name = "cross_op",
3438    prefix = "cross_op",
3439    deps = MATH_DEPS,
3440)
3441
3442tf_kernel_library(
3443    name = "cwise_op",
3444    copts = if_mlir_generated_cpu_kernels_enabled(
3445        ["-DMLIR_GENERATED_CPU_KERNELS_ENABLED"],
3446    ) + if_mlir_generated_experimental_kernels_enabled([
3447        "-DMLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED",
3448    ]) + if_mlir_generated_gpu_kernels_enabled(
3449        ["-DMLIR_GENERATED_GPU_KERNELS_ENABLED"],
3450    ),
3451    # *.cu.cc sources are compiled with gpu_copts instead of copts.
3452    gpu_copts = if_mlir_generated_cpu_kernels_enabled(
3453        ["-DMLIR_GENERATED_CPU_KERNELS_ENABLED"],
3454    ) + if_mlir_generated_experimental_kernels_enabled([
3455        "-DMLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED",
3456    ]) + if_mlir_generated_gpu_kernels_enabled(
3457        ["-DMLIR_GENERATED_GPU_KERNELS_ENABLED"],
3458    ),
3459    prefix = "cwise_op",
3460    deps = MATH_DEPS + [
3461        "//tensorflow/core/kernels/mlir_generated:cwise_op",
3462    ],
3463)
3464
3465tf_kernel_library(
3466    name = "nextafter_op",
3467    prefix = "nextafter_op",
3468    deps = MATH_DEPS + [":cwise_op"],
3469)
3470
3471tf_kernel_library(
3472    name = "population_count_op",
3473    prefix = "population_count_op",
3474    deps = MATH_DEPS,
3475)
3476
3477tf_kernel_library(
3478    name = "fft_ops",
3479    prefix = "fft_ops",
3480    deps = MATH_DEPS + [
3481    ] + if_cuda([
3482        "//tensorflow/core/platform/default/build_config:cufft_plugin",
3483    ]),
3484)
3485
3486tf_kernel_library(
3487    name = "reduction_ops",
3488    gpu_srcs = ["reduction_gpu_kernels.cu.h"],
3489    prefix = "reduction_ops",
3490    deps = MATH_DEPS + [
3491        ":gpu_prim_hdrs",
3492        ":transpose_functor",
3493    ],
3494)
3495
3496tf_kernel_library(
3497    name = "segment_reduction_ops",
3498    prefix = "segment_reduction_ops",
3499    deps = MATH_DEPS + [
3500        "//tensorflow/core/util:determinism_for_kernels",
3501    ] + if_cuda_or_rocm([
3502        ":gpu_prim_helpers",
3503        "//tensorflow/core/util:cuda_solvers",
3504    ]),
3505)
3506
3507tf_kernel_library(
3508    name = "scan_ops",
3509    srcs = ["scan_ops.cc"],
3510    hdrs = ["scan_ops.h"],
3511    gpu_srcs = [
3512        "scan_ops.h",
3513        "scan_ops_gpu.h",
3514        "scan_ops_gpu_double.cu.cc",
3515        "scan_ops_gpu_float.cu.cc",
3516        "scan_ops_gpu_half.cu.cc",
3517        "scan_ops_gpu_int.cu.cc",
3518    ],
3519    deps = MATH_DEPS + [":gpu_prim_hdrs"],
3520)
3521
3522tf_kernel_library(
3523    name = "sequence_ops",
3524    prefix = "sequence_ops",
3525    deps = MATH_DEPS,
3526)
3527
3528tf_kernel_library(
3529    name = "unary_ops_composition",
3530    prefix = "unary_ops_composition",
3531    deps = MATH_DEPS + [
3532        ":cwise_op",
3533        ":relu_op",
3534    ],
3535)
3536
3537tf_cc_test(
3538    name = "sequence_ops_test",
3539    size = "small",
3540    srcs = ["sequence_ops_test.cc"],
3541    deps = [
3542        ":ops_testutil",
3543        ":ops_util",
3544        ":sequence_ops",
3545        "//tensorflow/core:core_cpu",
3546        "//tensorflow/core:framework",
3547        "//tensorflow/core:lib",
3548        "//tensorflow/core:protos_all_cc",
3549        "//tensorflow/core:test",
3550        "//tensorflow/core:test_main",
3551        "//tensorflow/core:testlib",
3552    ],
3553)
3554
3555tf_cuda_cc_test(
3556    name = "cast_op_test",
3557    size = "small",
3558    srcs = ["cast_op_test.cc"],
3559    deps = [
3560        ":cast_op",
3561        ":ops_testutil",
3562        ":ops_util",
3563        "//tensorflow/core:core_cpu",
3564        "//tensorflow/core:framework",
3565        "//tensorflow/core:lib",
3566        "//tensorflow/core:protos_all_cc",
3567        "//tensorflow/core:test",
3568        "//tensorflow/core:test_main",
3569        "//tensorflow/core:testlib",
3570    ],
3571)
3572
3573tf_cc_test(
3574    name = "cross_op_test",
3575    size = "small",
3576    srcs = ["cross_op_test.cc"],
3577    deps = [
3578        ":cross_op",
3579        ":ops_testutil",
3580        ":ops_util",
3581        "//tensorflow/core:core_cpu",
3582        "//tensorflow/core:framework",
3583        "//tensorflow/core:lib",
3584        "//tensorflow/core:protos_all_cc",
3585        "//tensorflow/core:test",
3586        "//tensorflow/core:test_main",
3587        "//tensorflow/core:testlib",
3588    ],
3589)
3590
3591tf_cc_tests(
3592    name = "sparse_tests",
3593    size = "small",
3594    srcs = [
3595        "sparse_add_op_test.cc",
3596        "sparse_dense_binary_op_shared_test.cc",
3597        "sparse_reduce_sum_op_test.cc",
3598    ],
3599    deps = [
3600        ":ops_testutil",
3601        ":ops_util",
3602        ":sparse_add_op",
3603        ":sparse_dense_binary_op_shared",
3604        ":sparse_reduce_op",
3605        "//tensorflow/core:core_cpu",
3606        "//tensorflow/core:framework",
3607        "//tensorflow/core:lib",
3608        "//tensorflow/core:protos_all_cc",
3609        "//tensorflow/core:test",
3610        "//tensorflow/core:test_main",
3611        "//tensorflow/core:testlib",
3612    ],
3613)
3614
3615tf_cuda_cc_test(
3616    name = "cwise_ops_test",
3617    size = "small",
3618    srcs = ["cwise_ops_test.cc"],
3619    deps = [
3620        ":cwise_op",
3621        ":nn",
3622        ":ops_testutil",
3623        ":ops_util",
3624        "//tensorflow/core:core_cpu",
3625        "//tensorflow/core:framework",
3626        "//tensorflow/core:lib",
3627        "//tensorflow/core:protos_all_cc",
3628        "//tensorflow/core:test",
3629        "//tensorflow/core:test_main",
3630        "//tensorflow/core:testlib",
3631        "//tensorflow/core/framework:bounds_check",
3632    ],
3633)
3634
3635tf_cuda_cc_test(
3636    name = "unary_ops_composition_test",
3637    size = "small",
3638    srcs = ["unary_ops_composition_test.cc"],
3639    deps = [
3640        ":ops_testutil",
3641        ":ops_util",
3642        ":unary_ops_composition",
3643        "//tensorflow/cc:cc_ops",
3644        "//tensorflow/cc:client_session",
3645        "//tensorflow/core:core_cpu",
3646        "//tensorflow/core:framework",
3647        "//tensorflow/core:framework_internal",
3648        "//tensorflow/core:lib",
3649        "//tensorflow/core:protos_all_cc",
3650        "//tensorflow/core:tensorflow",
3651        "//tensorflow/core:test",
3652        "//tensorflow/core:test_main",
3653        "//tensorflow/core:testlib",
3654    ],
3655)
3656
3657tf_cuda_cc_test(
3658    name = "matmul_op_test",
3659    size = "small",
3660    srcs = ["matmul_op_test.cc"],
3661    deps = [
3662        ":matmul_op",
3663        ":ops_testutil",
3664        ":ops_util",
3665        ":quantized_ops",
3666        "//tensorflow/cc:cc_ops",
3667        "//tensorflow/cc:cc_ops_internal",
3668        "//tensorflow/cc:client_session",
3669        "//tensorflow/core:core_cpu",
3670        "//tensorflow/core:framework",
3671        "//tensorflow/core:framework_internal",
3672        "//tensorflow/core:lib",
3673        "//tensorflow/core:protos_all_cc",
3674        "//tensorflow/core:tensorflow",
3675        "//tensorflow/core:test",
3676        "//tensorflow/core:test_main",
3677        "//tensorflow/core:testlib",
3678        "@com_google_absl//absl/algorithm:container",
3679    ],
3680)
3681
3682tf_cuda_cc_test(
3683    name = "scan_ops_test",
3684    size = "small",
3685    srcs = ["scan_ops_test.cc"],
3686    linkopts = select({
3687        "//tensorflow:macos": ["-headerpad_max_install_names"],
3688        "//conditions:default": [],
3689    }),
3690    deps = [
3691        ":host_constant_op",
3692        ":ops_testutil",
3693        ":ops_util",
3694        ":scan_ops",
3695        "//tensorflow/core:core_cpu",
3696        "//tensorflow/core:framework",
3697        "//tensorflow/core:lib",
3698        "//tensorflow/core:protos_all_cc",
3699        "//tensorflow/core:test",
3700        "//tensorflow/core:test_main",
3701        "//tensorflow/core:testlib",
3702    ],
3703)
3704
3705tf_cuda_cc_test(
3706    name = "reduction_ops_test",
3707    size = "small",
3708    srcs = ["reduction_ops_test.cc"],
3709    linkopts = select({
3710        "//tensorflow:macos": ["-headerpad_max_install_names"],
3711        "//conditions:default": [],
3712    }),
3713    deps = [
3714        ":host_constant_op",
3715        ":ops_testutil",
3716        ":ops_util",
3717        ":reduction_ops",
3718        "//tensorflow/core:core_cpu",
3719        "//tensorflow/core:framework",
3720        "//tensorflow/core:lib",
3721        "//tensorflow/core:protos_all_cc",
3722        "//tensorflow/core:test",
3723        "//tensorflow/core:test_main",
3724        "//tensorflow/core:testlib",
3725    ],
3726)
3727
3728tf_cc_test(
3729    name = "segment_reduction_ops_test",
3730    size = "small",
3731    srcs = ["segment_reduction_ops_test.cc"],
3732    deps = [
3733        ":ops_testutil",
3734        ":ops_util",
3735        ":segment_reduction_ops",
3736        "//tensorflow/core:core_cpu",
3737        "//tensorflow/core:core_cpu_internal",
3738        "//tensorflow/core:framework",
3739        "//tensorflow/core:lib",
3740        "//tensorflow/core:protos_all_cc",
3741        "//tensorflow/core:test",
3742        "//tensorflow/core:test_main",
3743        "//tensorflow/core:testlib",
3744    ],
3745)
3746
3747tf_cc_test(
3748    name = "immutable_constant_op_test",
3749    srcs = ["immutable_constant_op_test.cc"],
3750    deps = [
3751        ":array",
3752        ":immutable_constant_op",
3753        ":matmul_op",
3754        ":ops_testutil",
3755        ":ops_util",
3756        ":random_shuffle_op",
3757        "//tensorflow/cc:cc_ops",
3758        "//tensorflow/core:core_cpu",
3759        "//tensorflow/core:direct_session",
3760        "//tensorflow/core:framework",
3761        "//tensorflow/core:lib",
3762        "//tensorflow/core:ops",
3763        "//tensorflow/core:test",
3764        "//tensorflow/core:test_main",
3765        "//tensorflow/core:testlib",
3766    ],
3767)
3768
3769tf_cuda_cc_test(
3770    name = "sparse_matmul_op_test",
3771    size = "small",
3772    srcs = ["sparse_matmul_op_test.cc"],
3773    deps = [
3774        ":ops_testutil",
3775        ":ops_util",
3776        ":sparse_matmul_op",
3777        "//tensorflow/core:core_cpu",
3778        "//tensorflow/core:framework",
3779        "//tensorflow/core:lib",
3780        "//tensorflow/core:protos_all_cc",
3781        "//tensorflow/core:test",
3782        "//tensorflow/core:test_main",
3783        "//tensorflow/core:testlib",
3784    ],
3785)
3786
3787tf_cuda_cc_test(
3788    name = "split_op_test",
3789    size = "small",
3790    srcs = ["split_op_test.cc"],
3791    deps = [
3792        ":ops_testutil",
3793        ":ops_util",
3794        ":split_op",
3795        "//tensorflow/core:core_cpu",
3796        "//tensorflow/core:framework",
3797        "//tensorflow/core:lib",
3798        "//tensorflow/core:protos_all_cc",
3799        "//tensorflow/core:test",
3800        "//tensorflow/core:test_main",
3801        "//tensorflow/core:testlib",
3802    ],
3803)
3804
3805tf_cuda_cc_test(
3806    name = "split_v_op_test",
3807    size = "small",
3808    srcs = ["split_v_op_test.cc"],
3809    tags = [
3810        "no_windows",  # split_v_op uses lrand48 which does not exist on Windows
3811    ],
3812    deps = [
3813        ":ops_testutil",
3814        ":ops_util",
3815        ":split_v_op",
3816        "//tensorflow/core:core_cpu",
3817        "//tensorflow/core:framework",
3818        "//tensorflow/core:lib",
3819        "//tensorflow/core:protos_all_cc",
3820        "//tensorflow/core:test",
3821        "//tensorflow/core:test_main",
3822        "//tensorflow/core:testlib",
3823    ],
3824)
3825
3826tf_cuda_cc_test(
3827    name = "diag_op_test",
3828    size = "small",
3829    srcs = ["diag_op_test.cc"],
3830    deps = [
3831        ":diag_op",
3832        ":host_constant_op",
3833        ":ops_testutil",
3834        ":ops_util",
3835        "//tensorflow/core:core_cpu",
3836        "//tensorflow/core:framework",
3837        "//tensorflow/core:lib",
3838        "//tensorflow/core:protos_all_cc",
3839        "//tensorflow/core:test",
3840        "//tensorflow/core:test_main",
3841        "//tensorflow/core:testlib",
3842    ],
3843)
3844
3845# conv_grad_ops currently has to be built with conv_ops*.
3846# TODO(josh11b, zhengxq): put these a separate libraries in ":nn" below once
3847# conv_ops_gpu.h has be separated into its own library.
3848tf_kernel_library(
3849    name = "conv_ops",
3850    srcs = [
3851        "conv_grad_filter_ops.cc",
3852        "conv_grad_input_ops_double.cc",
3853        "conv_grad_input_ops_float.cc",
3854        "conv_grad_input_ops_half.cc",
3855        "conv_grad_input_ops_int32.cc",
3856        "conv_grad_input_ops.cc",
3857        "conv_grad_ops_3d.cc",
3858        "deep_conv2d.cc",
3859    ] + select({
3860        ":xsmm_convolutions": ["xsmm_conv2d.cc"],
3861        "//conditions:default": [],
3862    }),
3863    hdrs = [
3864        "fill_functor.h",
3865        "conv_grad_ops.h",
3866        "conv_grad_input_ops.h",
3867        "deep_conv2d.h",
3868        "gemm_functors.h",
3869        "winograd_transform.h",
3870        "conv_ops_fused_impl.h",
3871    ] + select({
3872        ":xsmm_convolutions": ["xsmm_conv2d.h"],
3873        "//conditions:default": [],
3874    }),
3875    defines = select({
3876        ":xsmm_convolutions": ["TENSORFLOW_USE_LIBXSMM_CONVOLUTIONS"],
3877        "//conditions:default": [],
3878    }) + select({
3879        ":xsmm_backward_convolutions": ["TENSORFLOW_USE_LIBXSMM_BACKWARD_CONVOLUTIONS"],
3880        "//conditions:default": [],
3881    }),
3882    prefix = "conv_ops",
3883    deps = [
3884        ":conv_grad_shape_utils",
3885        ":conv_2d",
3886        ":conv_3d",
3887        ":eigen_contraction_kernel",
3888        ":fill_functor",
3889        ":fused_eigen_output_kernels",
3890        ":ops_util",
3891        "@com_google_absl//absl/base:dynamic_annotations",
3892        "@com_google_absl//absl/strings",
3893        "@com_google_absl//absl/synchronization",
3894        "//third_party/eigen3",
3895        "//tensorflow/core:core_cpu",
3896        "//tensorflow/core:framework",
3897        "//tensorflow/core/framework:bounds_check",
3898        "//tensorflow/core:lib",
3899        "//tensorflow/core:lib_internal",
3900        "//tensorflow/core/profiler/lib:scoped_annotation",
3901        "//tensorflow/core/protobuf:autotuning_proto_cc",
3902        "//tensorflow/core/util:image_resizer_state",
3903        "//tensorflow/core/util/proto:proto_utils",
3904    ] + select({
3905        ":xsmm_convolutions": [
3906            "@libxsmm_archive//:xsmm_avx",
3907        ],
3908        "//conditions:default": [],
3909    }) + if_cuda([
3910        "//tensorflow/stream_executor/gpu:gpu_asm_opts",
3911        "//tensorflow/core/platform/default/build_config:cublas_plugin",
3912        "//tensorflow/core/platform/default/build_config:cudnn_plugin",
3913        "//tensorflow/stream_executor:tf_allocator_adapter",
3914        "//tensorflow/stream_executor:stream_executor_headers",
3915        "//tensorflow/core/platform:stream_executor",
3916    ]) + if_cuda_or_rocm([
3917        ":gpu_utils",
3918        "//tensorflow/stream_executor/gpu:redzone_allocator",
3919        "//tensorflow/core/util/autotune_maps:conv_parameters",
3920        "//tensorflow/core/util/autotune_maps:conv_autotune_maps",
3921    ]),
3922)
3923
3924cc_library(
3925    name = "conv_grad_shape_utils",
3926    srcs = [
3927        "conv_grad_shape_utils.cc",
3928    ],
3929    hdrs = [
3930        "conv_grad_shape_utils.h",
3931    ],
3932    deps = [
3933        ":ops_util",
3934        "//tensorflow/core:framework",
3935        "//tensorflow/core/lib/core:errors",
3936        "//tensorflow/core/lib/core:stringpiece",
3937        "//tensorflow/core/platform:logging",
3938        "//tensorflow/core/platform:macros",
3939    ],
3940)
3941
3942tf_kernel_library(
3943    name = "depthwise_conv_op",
3944    srcs = ["depthwise_conv_op.cc"],
3945    hdrs = ["depthwise_conv_op.h"],
3946    gpu_copts = if_not_windows([
3947        "-Wno-pass-failed",  # clang misses #pragma loop optimizations
3948    ]),
3949    gpu_srcs = [
3950        "depthwise_conv_op.h",
3951        "depthwise_conv_op_gpu.h",
3952        "depthwise_conv_op_gpu_double.cu.cc",
3953        "depthwise_conv_op_gpu_float.cu.cc",
3954        "depthwise_conv_op_gpu_half.cu.cc",
3955    ],
3956    deps = [
3957        ":conv_ops",
3958        ":ops_util",
3959        "//tensorflow/core:core_cpu",
3960        "//tensorflow/core:framework",
3961        "//tensorflow/core:lib",
3962        "//tensorflow/core/framework:bounds_check",
3963    ] + if_cuda([
3964        "@local_config_cuda//cuda:cub_headers",
3965        "@local_config_cuda//cuda:cudnn_header",
3966    ]) + if_rocm([
3967        "@local_config_rocm//rocm:rocprim",
3968    ]),
3969)
3970
3971tf_kernel_library(
3972    name = "depthwise_conv_grad_op",
3973    hdrs = [
3974        "depthwise_conv_op.h",
3975    ],
3976    prefix = "depthwise_conv_grad_op",
3977    deps = [
3978        ":cast_op",
3979        ":conv_ops",
3980        ":ops_util",
3981        "//tensorflow/core:core_cpu",
3982        "//tensorflow/core:framework",
3983        "//tensorflow/core:lib",
3984        "//tensorflow/core/framework:bounds_check",
3985    ] + if_cuda([
3986        "@local_config_cuda//cuda:cudnn_header",
3987    ]),
3988)
3989
3990cc_library(
3991    name = "nn",
3992    deps = [
3993        ":batch_norm_op",
3994        ":bias_op",
3995        ":conv_ops",
3996        ":data_format_ops",
3997        ":depthwise_conv_grad_op",
3998        ":depthwise_conv_op",
3999        ":dilation_ops",
4000        ":fused_batch_norm_op",
4001        ":in_topk_op",
4002        ":l2loss_op",
4003        ":lrn_op",
4004        ":nth_element_op",
4005        ":relu_op",
4006        ":softmax_op",
4007        ":softplus_op",
4008        ":softsign_op",
4009        ":topk_op",
4010        ":xent_op",
4011    ],
4012)
4013
4014# Kernels for the nodes intented to be added to the graph by the Grappler optimizers.
4015cc_library(
4016    name = "grappler",
4017    deps = [
4018        ":unary_ops_composition",
4019    ],
4020)
4021
4022NN_DEPS = if_cuda_or_rocm([":conv_2d"]) + [
4023    ":eigen_contraction_kernel",
4024    ":ops_util",
4025    "//tensorflow/core:framework",
4026    "//tensorflow/core:lib",
4027    "//tensorflow/core:lib_internal",
4028    "//tensorflow/core:nn_grad",
4029    "//tensorflow/core/framework:bounds_check",
4030    "//third_party/eigen3",
4031]
4032
4033tf_kernel_library(
4034    name = "batch_norm_op",
4035    prefix = "batch_norm_op",
4036    deps = NN_DEPS,
4037)
4038
4039tf_kernel_library(
4040    name = "data_format_ops",
4041    prefix = "data_format_ops",
4042    deps = NN_DEPS,
4043)
4044
4045tf_kernel_library(
4046    name = "bias_op",
4047    prefix = "bias_op",
4048    deps = NN_DEPS + [
4049        ":redux_functor",
4050        "//tensorflow/core/profiler/lib:scoped_annotation",
4051    ] + if_cuda_or_rocm([
4052        ":reduction_ops",
4053    ]) + if_cuda([
4054        "@local_config_cuda//cuda:cub_headers",
4055        "//tensorflow/core/platform:stream_executor",
4056        "//tensorflow/stream_executor/cuda:cuda_stream",
4057    ]) + if_rocm([
4058        "@local_config_rocm//rocm:rocprim",
4059    ]),
4060)
4061
4062tf_kernel_library(
4063    name = "fused_batch_norm_op",
4064    prefix = "fused_batch_norm_op",
4065    deps = NN_DEPS + [
4066        ":fill_functor",
4067        ":redux_functor",
4068        ":transpose_functor",
4069        "//tensorflow/core/util:determinism_for_kernels",
4070    ] + if_cuda([
4071        "//tensorflow/core/platform:stream_executor",
4072    ]),
4073)
4074
4075tf_kernel_library(
4076    name = "in_topk_op",
4077    prefix = "in_topk_op",
4078    deps = NN_DEPS + [":reduction_ops"],
4079)
4080
4081tf_kernel_library(
4082    name = "lrn_op",
4083    prefix = "lrn_op",
4084    deps = NN_DEPS + if_rocm([":conv_ops_gpu_hdrs"]),
4085)
4086
4087tf_kernel_library(
4088    name = "relu_op",
4089    copts = if_mlir_generated_experimental_kernels_enabled(
4090        ["-DMLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED"],
4091    ) + if_mlir_generated_gpu_kernels_enabled(
4092        ["-DMLIR_GENERATED_GPU_KERNELS_ENABLED"],
4093    ),
4094    # *.cu.cc sources are compiled with gpu_copts instead of copts.
4095    gpu_copts = if_mlir_generated_experimental_kernels_enabled(
4096        ["-DMLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED"],
4097    ) + if_mlir_generated_gpu_kernels_enabled(
4098        ["-DMLIR_GENERATED_GPU_KERNELS_ENABLED"],
4099    ),
4100    prefix = "relu_op",
4101    deps = NN_DEPS + [
4102        "//tensorflow/core/kernels/mlir_generated:relu_op",
4103    ],
4104)
4105
4106tf_kernel_library(
4107    name = "softmax_op",
4108    prefix = "softmax_op",
4109    deps = NN_DEPS + if_cuda_or_rocm([
4110        ":reduction_ops",
4111    ]) + [":gpu_prim_hdrs"],
4112)
4113
4114tf_kernel_library(
4115    name = "softplus_op",
4116    copts = if_mlir_generated_gpu_kernels_enabled(
4117        ["-DMLIR_GENERATED_GPU_KERNELS_ENABLED"],
4118    ),
4119    # *.cu.cc sources are compiled with gpu_copts instead of copts.
4120    gpu_copts = if_mlir_generated_gpu_kernels_enabled(
4121        ["-DMLIR_GENERATED_GPU_KERNELS_ENABLED"],
4122    ),
4123    prefix = "softplus_op",
4124    deps = NN_DEPS + [
4125        "//tensorflow/core/kernels/mlir_generated:softplus_op",
4126    ],
4127)
4128
4129tf_kernel_library(
4130    name = "softsign_op",
4131    copts = if_mlir_generated_gpu_kernels_enabled(
4132        ["-DMLIR_GENERATED_GPU_KERNELS_ENABLED"],
4133    ),
4134    # *.cu.cc sources are compiled with gpu_copts instead of copts.
4135    gpu_copts = if_mlir_generated_gpu_kernels_enabled(
4136        ["-DMLIR_GENERATED_GPU_KERNELS_ENABLED"],
4137    ),
4138    prefix = "softsign_op",
4139    deps = NN_DEPS + [
4140        "//tensorflow/core/kernels/mlir_generated:softsign_op",
4141    ],
4142)
4143
4144tf_kernel_library(
4145    name = "topk_op",
4146    srcs = ["topk_op.cc"],
4147    hdrs = ["topk_op.h"],
4148    gpu_srcs = [
4149        "topk_op.h",
4150        "topk_op_gpu.h",
4151        "topk_op_gpu_double.cu.cc",
4152        "topk_op_gpu_float.cu.cc",
4153        "topk_op_gpu_half.cu.cc",
4154        "topk_op_gpu_uint64.cu.cc",
4155        "topk_op_gpu_int64.cu.cc",
4156        "topk_op_gpu_uint32.cu.cc",
4157        "topk_op_gpu_int32.cu.cc",
4158        "topk_op_gpu_int16.cu.cc",
4159        "topk_op_gpu_uint16.cu.cc",
4160        "topk_op_gpu_int8.cu.cc",
4161        "topk_op_gpu_uint8.cu.cc",
4162    ],
4163    deps = NN_DEPS + [":gpu_prim_hdrs"],
4164)
4165
4166tf_kernel_library(
4167    name = "nth_element_op",
4168    prefix = "nth_element_op",
4169    deps = NN_DEPS,
4170)
4171
4172tf_kernel_library(
4173    name = "xent_op",
4174    gpu_copts = tf_disable_ptxas_warning_flags(),
4175    prefix = "xent_op",
4176    deps = NN_DEPS + ["//tensorflow/core/util:determinism_for_kernels"],
4177)
4178
4179tf_kernel_library(
4180    name = "bincount_op",
4181    prefix = "bincount_op",
4182    deps = [
4183        ":fill_functor",
4184        ":gpu_prim_hdrs",
4185        "//tensorflow/core:framework",
4186        "//tensorflow/core:lib",
4187        "//tensorflow/core:lib_internal",
4188        "//third_party/eigen3",
4189    ],
4190)
4191
4192tf_kernel_library(
4193    name = "histogram_op",
4194    prefix = "histogram_op",
4195    deps = [
4196        ":gpu_prim_hdrs",
4197        "//tensorflow/core:framework",
4198        "//tensorflow/core:lib",
4199        "//tensorflow/core:lib_internal",
4200        "//third_party/eigen3",
4201    ],
4202)
4203
4204tf_kernel_library(
4205    name = "l2loss_op",
4206    prefix = "l2loss_op",
4207    deps = [
4208        ":gpu_prim_hdrs",
4209        ":reduction_ops",
4210        "//tensorflow/core:framework",
4211        "//tensorflow/core:lib",
4212        "//tensorflow/core:lib_internal",
4213        "//tensorflow/core:nn_grad",
4214        "//third_party/eigen3",
4215    ],
4216)
4217
4218tf_cuda_cc_test(
4219    name = "lrn_op_test",
4220    srcs = ["lrn_op_test.cc"],
4221    deps = [
4222        ":nn",
4223        ":ops_testutil",
4224        ":ops_util",
4225        ":xent_op",
4226        "//tensorflow/cc:cc_ops",
4227        "//tensorflow/core:core_cpu",
4228        "//tensorflow/core:core_cpu_internal",
4229        "//tensorflow/core:framework",
4230        "//tensorflow/core:lib",
4231        "//tensorflow/core:protos_all_cc",
4232        "//tensorflow/core:test",
4233        "//tensorflow/core:test_main",
4234        "//tensorflow/core:testlib",
4235    ],
4236)
4237
4238tf_cuda_cc_test(
4239    name = "xent_op_test",
4240    srcs = ["xent_op_test.cc"],
4241    deps = [
4242        ":nn",
4243        ":ops_testutil",
4244        ":ops_util",
4245        ":xent_op",
4246        "//tensorflow/cc:cc_ops",
4247        "//tensorflow/core:core_cpu",
4248        "//tensorflow/core:core_cpu_internal",
4249        "//tensorflow/core:framework",
4250        "//tensorflow/core:lib",
4251        "//tensorflow/core:protos_all_cc",
4252        "//tensorflow/core:test",
4253        "//tensorflow/core:test_main",
4254        "//tensorflow/core:testlib",
4255    ],
4256)
4257
4258tf_cuda_cc_test(
4259    name = "nn_ops_test",
4260    srcs = ["nn_ops_test.cc"],
4261    deps = [
4262        ":host_constant_op",
4263        ":nn",
4264        ":ops_testutil",
4265        ":ops_util",
4266        ":pooling_ops",
4267        "//tensorflow/cc:cc_ops",
4268        "//tensorflow/cc:cc_ops_internal",
4269        "//tensorflow/core:core_cpu",
4270        "//tensorflow/core:core_cpu_internal",
4271        "//tensorflow/core:framework",
4272        "//tensorflow/core:lib",
4273        "//tensorflow/core:protos_all_cc",
4274        "//tensorflow/core:test",
4275        "//tensorflow/core:test_main",
4276        "//tensorflow/core:testlib",
4277        "//third_party/eigen3",
4278    ],
4279)
4280
4281tf_kernel_library(
4282    name = "pooling_ops",
4283    srcs = [
4284        "avgpooling_op.cc",
4285        "cudnn_pooling_gpu.cc",
4286        "fractional_avg_pool_op.cc",
4287        "fractional_max_pool_op.cc",
4288        "fractional_pool_common.cc",
4289        "maxpooling_op.cc",
4290        "pooling_ops_3d.cc",
4291        "pooling_ops_common.cc",
4292    ],
4293    hdrs = [
4294        "avgpooling_op.h",
4295        "cudnn_pooling_gpu.h",
4296        "fractional_pool_common.h",
4297        "maxpooling_op.h",
4298        "pooling_ops_3d.h",
4299        "pooling_ops_common.h",
4300    ],
4301    gpu_srcs = [
4302        "avgpooling_op.h",
4303        "avgpooling_op_gpu.cu.cc",
4304        "maxpooling_op.h",
4305        "maxpooling_op_gpu.cu.cc",
4306        "maxpooling_op_gpu.h",
4307        "pooling_ops_common.h",
4308        "pooling_ops_common_gpu.h",
4309        "pooling_ops_3d_gpu.h",
4310        "pooling_ops_3d_gpu.cu.cc",
4311    ],
4312    deps = [
4313        ":conv_2d",
4314        ":conv_3d",
4315        ":conv_ops",
4316        ":eigen_helpers",
4317        ":ops_util",
4318        "//tensorflow/core:core_cpu",
4319        "//tensorflow/core:framework",
4320        "//tensorflow/core:lib",
4321        "//tensorflow/core:lib_internal",
4322        "//tensorflow/core/framework:bounds_check",
4323        "//tensorflow/core/platform:stream_executor",
4324        "//tensorflow/core/util:determinism_for_kernels",
4325        "//third_party/eigen3",
4326    ],
4327)
4328
4329tf_kernel_library(
4330    name = "fake_quant_ops",
4331    srcs = ["fake_quant_ops.cc"],
4332    hdrs = ["fake_quant_ops_functor.h"],
4333    gpu_copts = tf_disable_ptxas_warning_flags(),
4334    gpu_srcs = [
4335        "fake_quant_ops_gpu.cu.cc",
4336        "fake_quant_ops_functor.h",
4337    ],
4338    deps = [
4339        "//tensorflow/core:framework",
4340        "//tensorflow/core:lib",
4341        "//third_party/eigen3",
4342    ],
4343    alwayslink = 1,
4344)
4345
4346cc_library(
4347    name = "pooling_ops_hdrs",
4348    hdrs = [
4349        "avgpooling_op.h",
4350        "maxpooling_op.h",
4351        "pooling_ops_common.h",
4352    ],
4353    deps = [
4354        ":eigen_helpers",
4355        ":ops_util_hdrs",
4356        "//third_party/eigen3",
4357    ],
4358)
4359
4360tf_kernel_library(
4361    name = "dilation_ops",
4362    prefix = "dilation_ops",
4363    deps = [
4364        ":ops_util",
4365        "//tensorflow/core:core_cpu",
4366        "//tensorflow/core:framework",
4367        "//tensorflow/core:lib",
4368        "//tensorflow/core/util:determinism_for_kernels",
4369        "//third_party/eigen3",
4370    ],
4371)
4372
4373tf_kernel_library(
4374    name = "batch_space_ops",
4375    srcs = [
4376        "batchtospace_op.cc",
4377        "spacetobatch_functor.cc",
4378        "spacetobatch_functor.h",
4379        "spacetobatch_op.cc",
4380    ],
4381    gpu_srcs = [
4382        "spacetobatch_functor.h",
4383        "spacetobatch_functor_gpu.cu.cc",
4384    ],
4385    visibility = [":friends"],
4386    deps = [
4387        "//tensorflow/core:framework",
4388        "//tensorflow/core:lib",
4389        "//tensorflow/core/framework:bounds_check",
4390        "//third_party/eigen3",
4391    ],
4392)
4393
4394tf_cuda_cc_test(
4395    name = "spacetobatch_benchmark_test",
4396    srcs = ["spacetobatch_benchmark_test.cc"],
4397    deps = [
4398        ":batch_space_ops",
4399        ":host_constant_op",
4400        ":ops_testutil",
4401        ":ops_util",
4402        "//tensorflow/core:core_cpu",
4403        "//tensorflow/core:framework",
4404        "//tensorflow/core:protos_all_cc",
4405        "//tensorflow/core:test",
4406        "//tensorflow/core:test_main",
4407        "//tensorflow/core:testlib",
4408    ],
4409)
4410
4411tf_kernel_library(
4412    name = "depth_space_ops",
4413    srcs = [
4414        "depthtospace_op.cc",
4415        "spacetodepth_op.cc",
4416    ],
4417    hdrs = [
4418        "depthtospace_op.h",
4419        "spacetodepth_op.h",
4420    ],
4421    gpu_srcs = [
4422        "depthtospace_op.h",
4423        "depthtospace_op_gpu.cu.cc",
4424        "spacetodepth_op.h",
4425        "spacetodepth_op_gpu.cu.cc",
4426    ],
4427    visibility = [":friends"],
4428    deps = [
4429        "//tensorflow/core:framework",
4430        "//tensorflow/core:lib",
4431        "//third_party/eigen3",
4432    ],
4433)
4434
4435cc_library(
4436    name = "parsing",
4437    deps = [
4438        ":decode_compressed_op",
4439        ":decode_csv_op",
4440        ":decode_padded_raw_op",
4441        ":decode_raw_op",
4442        ":example_parsing_ops",
4443        ":parse_tensor_op",
4444        ":string_to_number_op",
4445    ],
4446)
4447
4448PARSING_DEPS = [
4449    "@com_google_absl//absl/base",
4450    "//tensorflow/core:core_cpu_internal",
4451    "//tensorflow/core:framework",
4452    "//tensorflow/core:lib",
4453    "//tensorflow/core:protos_all_cc",
4454]
4455
4456tf_kernel_library(
4457    name = "decode_csv_op",
4458    prefix = "decode_csv_op",
4459    deps = PARSING_DEPS,
4460)
4461
4462tf_kernel_library(
4463    name = "decode_raw_op",
4464    prefix = "decode_raw_op",
4465    deps = PARSING_DEPS,
4466)
4467
4468tf_kernel_library(
4469    name = "decode_padded_raw_op",
4470    prefix = "decode_padded_raw_op",
4471    deps = PARSING_DEPS,
4472)
4473
4474tf_kernel_library(
4475    name = "decode_compressed_op",
4476    prefix = "decode_compressed_op",
4477    deps = [
4478        "//tensorflow/core:lib_internal",
4479    ] + PARSING_DEPS,
4480)
4481
4482tf_kernel_library(
4483    name = "example_parsing_ops",
4484    prefix = "example_parsing_ops",
4485    deps = PARSING_DEPS,
4486)
4487
4488tf_kernel_library(
4489    name = "parse_tensor_op",
4490    prefix = "parse_tensor_op",
4491    deps = PARSING_DEPS,
4492)
4493
4494tf_cc_test(
4495    name = "parse_tensor_test",
4496    srcs = ["parse_tensor_test.cc"],
4497    deps = [
4498        ":ops_testutil",
4499        ":parse_tensor_op",
4500        "//tensorflow/core:core_cpu",
4501        "//tensorflow/core:core_cpu_internal",
4502        "//tensorflow/core:framework",
4503        "//tensorflow/core:test",
4504        "//tensorflow/core:test_main",
4505        "//tensorflow/core:testlib",
4506    ],
4507)
4508
4509tf_kernel_library(
4510    name = "string_to_number_op",
4511    prefix = "string_to_number_op",
4512    deps = PARSING_DEPS,
4513)
4514
4515cc_library(
4516    name = "random_ops",
4517    deps = [
4518        ":random_op",
4519        ":random_shuffle_op",
4520    ],
4521)
4522
4523RANDOM_OPS_DEPS = [
4524    "//tensorflow/core:core_cpu",
4525    "//tensorflow/core:framework",
4526    "//tensorflow/core:lib",
4527    "//tensorflow/core:lib_internal",
4528]
4529
4530tf_kernel_library(
4531    name = "random_op",
4532    prefix = "random_op",
4533    deps = RANDOM_OPS_DEPS,
4534)
4535
4536tf_kernel_library(
4537    name = "random_shuffle_op",
4538    prefix = "random_shuffle_op",
4539    deps = RANDOM_OPS_DEPS,
4540)
4541
4542tf_cuda_cc_test(
4543    name = "random_op_test",
4544    size = "small",
4545    srcs = ["random_op_test.cc"],
4546    deps = [
4547        ":host_constant_op",
4548        ":random_ops",
4549        "//tensorflow/core:core_cpu",
4550        "//tensorflow/core:framework",
4551        "//tensorflow/core:lib",
4552        "//tensorflow/core:test",
4553        "//tensorflow/core:test_main",
4554        "//tensorflow/core:testlib",
4555    ],
4556)
4557
4558cc_library(
4559    name = "stateful_random_ops_header",
4560    hdrs = ["stateful_random_ops.h"],
4561    deps = [
4562        "//tensorflow/core:framework",
4563        "//tensorflow/core:lib",
4564    ],
4565)
4566
4567cc_library(
4568    name = "stateless_random_ops_v2_header",
4569    hdrs = ["stateless_random_ops_v2.h"],
4570    deps = [
4571        "//tensorflow/core:framework",
4572        "//tensorflow/core:lib",
4573    ],
4574)
4575
4576tf_kernel_library(
4577    name = "stateful_random_ops",
4578    prefix = "stateful_random_ops",
4579    deps = [
4580        ":dense_update_functor",
4581        ":fill_functor",
4582        ":gather_functor",
4583        ":mutex_ops",
4584        ":random_op",
4585        ":resource_variable_ops",
4586        ":scatter_functor",
4587        ":state",
4588        ":stateful_random_ops_header",
4589        ":training_op_helpers",
4590        ":variable_ops",
4591        "//tensorflow/core:core_cpu",
4592        "//tensorflow/core:core_cpu_lib",
4593        "//tensorflow/core:framework",
4594        "//tensorflow/core:lib",
4595        "//tensorflow/core:lib_internal",
4596        "//tensorflow/core/framework:bounds_check",
4597        "@com_google_absl//absl/strings",
4598        "@com_google_absl//absl/types:variant",
4599    ],
4600)
4601
4602tf_kernel_library(
4603    name = "stateless_random_gamma_op",
4604    prefix = "stateless_random_gamma_op",
4605    deps = [
4606        ":stateless_random_ops",
4607        "//tensorflow/core:framework",
4608        "//tensorflow/core:lib",
4609    ],
4610)
4611
4612tf_kernel_library(
4613    name = "stateless_random_ops",
4614    prefix = "stateless_random_ops",
4615    deps = [
4616        ":random_op",
4617        ":random_poisson_op",
4618        "//tensorflow/core:framework",
4619        "//tensorflow/core:lib",
4620        "//tensorflow/core/framework:bounds_check",
4621    ],
4622)
4623
4624cc_library(
4625    name = "required",
4626    deps = [
4627        ":no_op",
4628        ":sendrecv_ops",
4629    ],
4630)
4631
4632REQUIRED_DEPS = [
4633    "//tensorflow/core:framework",
4634    "//tensorflow/core:lib",
4635    "//tensorflow/core:protos_all_cc",
4636]
4637
4638tf_kernel_library(
4639    name = "no_op",
4640    prefix = "no_op",
4641    deps = REQUIRED_DEPS,
4642)
4643
4644tf_kernel_library(
4645    name = "sendrecv_ops",
4646    prefix = "sendrecv_ops",
4647    deps = REQUIRED_DEPS + [
4648        "//tensorflow/core/profiler/lib:traceme",
4649    ],
4650)
4651
4652tf_cc_test(
4653    name = "sendrecv_ops_test",
4654    srcs = ["sendrecv_ops_test.cc"],
4655    linkstatic = tf_kernel_tests_linkstatic(),  # Required for benchmarking
4656    deps = [
4657        ":ops_testutil",
4658        ":ops_util",
4659        ":sendrecv_ops",
4660        "//tensorflow/core:framework",
4661        "//tensorflow/core:test",
4662        "//tensorflow/core:test_main",
4663        "//tensorflow/core:testlib",
4664    ],
4665)
4666
4667cc_library(
4668    name = "sparse",
4669    deps = [
4670        ":deserialize_sparse_string_op",
4671        ":deserialize_sparse_variant_op",
4672        ":serialize_sparse_op",
4673        ":sparse_add_grad_op",
4674        ":sparse_add_op",
4675        ":sparse_concat_op",
4676        ":sparse_cross_op",
4677        ":sparse_dense_binary_op_shared",
4678        ":sparse_fill_empty_rows_op",
4679        ":sparse_reduce_op",
4680        ":sparse_reorder_op",
4681        ":sparse_reshape_op",
4682        ":sparse_slice_grad_op",
4683        ":sparse_slice_op",
4684        ":sparse_softmax",
4685        ":sparse_sparse_binary_op_shared",
4686        ":sparse_split_op",
4687        ":sparse_tensor_dense_add_op",
4688        ":sparse_tensor_dense_matmul_op",
4689        ":sparse_tensors_map_ops",
4690        ":sparse_to_dense_op",
4691        ":sparse_xent_op",
4692    ],
4693)
4694
4695SPARSE_DEPS = [
4696    "//tensorflow/core:framework",
4697    "//tensorflow/core:lib",
4698]
4699
4700tf_kernel_library(
4701    name = "sparse_add_grad_op",
4702    prefix = "sparse_add_grad_op",
4703    deps = SPARSE_DEPS,
4704)
4705
4706tf_kernel_library(
4707    name = "sparse_add_op",
4708    prefix = "sparse_add_op",
4709    deps = SPARSE_DEPS,
4710)
4711
4712tf_kernel_library(
4713    name = "sparse_concat_op",
4714    prefix = "sparse_concat_op",
4715    deps = SPARSE_DEPS,
4716)
4717
4718tf_kernel_library(
4719    name = "sparse_fill_empty_rows_op",
4720    prefix = "sparse_fill_empty_rows_op",
4721    deps = SPARSE_DEPS + [":gpu_prim_hdrs"] + if_cuda_or_rocm([
4722        ":gpu_prim_helpers",
4723    ]) + if_cuda([
4724        "//tensorflow/core/util:cuda_solvers",
4725    ]) + if_rocm([
4726        "//tensorflow/core/util:rocm_solvers",
4727    ]),
4728)
4729
4730tf_kernel_library(
4731    name = "sparse_cross_op",
4732    prefix = "sparse_cross_op",
4733    deps = SPARSE_DEPS + [
4734        "//third_party/eigen3",
4735    ],
4736)
4737
4738tf_kernel_library(
4739    name = "sparse_reduce_op",
4740    prefix = "sparse_reduce_op",
4741    deps = SPARSE_DEPS,
4742)
4743
4744tf_kernel_library(
4745    name = "sparse_dense_binary_op_shared",
4746    prefix = "sparse_dense_binary_op_shared",
4747    deps = SPARSE_DEPS + [
4748        ":cwise_op",
4749        "//third_party/eigen3",
4750    ],
4751)
4752
4753tf_kernel_library(
4754    name = "sparse_sparse_binary_op_shared",
4755    prefix = "sparse_sparse_binary_op_shared",
4756    deps = SPARSE_DEPS + [
4757        ":cwise_op",
4758        "//third_party/eigen3",
4759    ],
4760)
4761
4762tf_kernel_library(
4763    name = "sparse_reorder_op",
4764    prefix = "sparse_reorder_op",
4765    deps = SPARSE_DEPS + if_cuda_or_rocm([
4766        ":gpu_prim_hdrs",
4767        ":gpu_prim_helpers",
4768    ]),
4769)
4770
4771tf_kernel_library(
4772    name = "sparse_reshape_op",
4773    prefix = "sparse_reshape_op",
4774    deps = SPARSE_DEPS + [
4775        ":reshape_util",
4776    ],
4777)
4778
4779tf_kernel_library(
4780    name = "sparse_slice_grad_op",
4781    prefix = "sparse_slice_grad_op",
4782    deps = SPARSE_DEPS,
4783)
4784
4785tf_kernel_library(
4786    name = "sparse_slice_op",
4787    prefix = "sparse_slice_op",
4788    deps = SPARSE_DEPS,
4789)
4790
4791tf_kernel_library(
4792    name = "sparse_softmax",
4793    prefix = "sparse_softmax",
4794    deps = SPARSE_DEPS + [
4795        "//third_party/eigen3",
4796    ],
4797)
4798
4799tf_kernel_library(
4800    name = "sparse_split_op",
4801    prefix = "sparse_split_op",
4802    deps = SPARSE_DEPS,
4803)
4804
4805tf_kernel_library(
4806    name = "sparse_tensor_dense_add_op",
4807    prefix = "sparse_tensor_dense_add_op",
4808    deps = SPARSE_DEPS + [
4809        ":scatter_functor",
4810        "//third_party/eigen3",
4811    ],
4812)
4813
4814tf_kernel_library(
4815    name = "sparse_tensor_dense_matmul_op",
4816    prefix = "sparse_tensor_dense_matmul_op",
4817    deps = SPARSE_DEPS + [
4818        ":fill_functor",
4819        "//third_party/eigen3",
4820        "//tensorflow/core/framework:bounds_check",
4821        "//tensorflow/core/util:determinism_for_kernels",
4822    ],
4823)
4824
4825tf_kernel_library(
4826    name = "sparse_to_dense_op",
4827    prefix = "sparse_to_dense_op",
4828    deps = SPARSE_DEPS + [
4829        "//third_party/eigen3",
4830    ] + if_cuda_or_rocm([
4831        ":gpu_utils",
4832        "//tensorflow/core/platform:stream_executor",
4833    ]),
4834)
4835
4836tf_kernel_library(
4837    name = "sparse_xent_op",
4838    gpu_copts = tf_disable_ptxas_warning_flags(),
4839    prefix = "sparse_xent_op",
4840    deps = SPARSE_DEPS + [
4841        "//third_party/eigen3",
4842        "//tensorflow/core/framework:bounds_check",
4843        "//tensorflow/core:lib_internal",
4844        "//tensorflow/core/util:determinism_for_kernels",
4845    ] + if_cuda_or_rocm([
4846        ":reduction_ops",
4847    ]) + if_cuda([
4848        "@local_config_cuda//cuda:cub_headers",
4849    ]) + if_rocm([
4850        "@local_config_rocm//rocm:rocprim",
4851    ]),
4852)
4853
4854tf_kernel_library(
4855    name = "serialize_sparse_op",
4856    prefix = "serialize_sparse_op",
4857    deps = SPARSE_DEPS + [
4858        ":reshape_util",
4859        "//tensorflow/core:core_cpu_internal",
4860        "//tensorflow/core:protos_all_cc",
4861    ],
4862)
4863
4864tf_kernel_library(
4865    name = "deserialize_sparse_string_op",
4866    prefix = "deserialize_sparse_string_op",
4867    deps = SPARSE_DEPS + [
4868        ":reshape_util",
4869        "//tensorflow/core:protos_all_cc",
4870    ],
4871)
4872
4873tf_kernel_library(
4874    name = "deserialize_sparse_variant_op",
4875    prefix = "deserialize_sparse_variant_op",
4876    deps = SPARSE_DEPS + [
4877        "//tensorflow/core:protos_all_cc",
4878    ],
4879)
4880
4881tf_kernel_library(
4882    name = "sparse_tensors_map_ops",
4883    prefix = "sparse_tensors_map_ops",
4884    deps = SPARSE_DEPS,
4885)
4886
4887tf_cuda_cc_tests(
4888    name = "sparse2_tests",
4889    size = "small",
4890    srcs = [
4891        "sparse_tensor_dense_matmul_op_test.cc",
4892        "sparse_to_dense_op_test.cc",
4893        "sparse_xent_op_test.cc",
4894    ],
4895    deps = [
4896        ":host_constant_op",
4897        ":ops_testutil",
4898        ":ops_util",
4899        ":sparse",
4900        ":xent_op",
4901        "//tensorflow/core:core_cpu",
4902        "//tensorflow/core:core_cpu_internal",
4903        "//tensorflow/core:framework",
4904        "//tensorflow/core:protos_all_cc",
4905        "//tensorflow/core:test",
4906        "//tensorflow/core:test_main",
4907        "//tensorflow/core:testlib",
4908    ],
4909)
4910
4911cc_library(
4912    name = "loss_updaters",
4913    hdrs = [
4914        "hinge-loss.h",
4915        "logistic-loss.h",
4916        "loss.h",
4917        "poisson-loss.h",
4918        "smooth-hinge-loss.h",
4919        "squared-loss.h",
4920    ],
4921    deps = [
4922        "//tensorflow/core:framework_headers_lib",
4923        "//tensorflow/core:lib",
4924    ],
4925)
4926
4927tf_cc_test(
4928    name = "loss_test",
4929    size = "small",
4930    srcs = ["loss_test.cc"],
4931    deps = [
4932        ":loss_updaters",
4933        "//tensorflow/core:lib",
4934        "//tensorflow/core:test",
4935        "//tensorflow/core:test_main",
4936    ],
4937)
4938
4939tf_cc_test(
4940    name = "sdca_ops_test",
4941    size = "small",
4942    srcs = ["sdca_ops_test.cc"],
4943    linkstatic = tf_kernel_tests_linkstatic(),  # Required for benchmarking
4944    deps = [
4945        ":ops_util",
4946        "//tensorflow/core:all_kernels",
4947        "//tensorflow/core:core_cpu",
4948        "//tensorflow/core:framework",
4949        "//tensorflow/core:lib_internal",
4950        "//tensorflow/core:test",
4951        "//tensorflow/core:test_main",
4952        "//tensorflow/core:testlib",
4953    ],
4954)
4955
4956tf_kernel_library(
4957    name = "sdca_ops",
4958    prefix = "sdca_ops",
4959    deps = [
4960        ":loss_updaters",
4961        ":sdca_internal",
4962        "//tensorflow/core:framework",
4963        "//tensorflow/core:lib",
4964        "//tensorflow/core:lib_internal",
4965        "//third_party/eigen3",
4966        "@com_google_absl//absl/strings:str_format",
4967    ],
4968    alwayslink = 1,
4969)
4970
4971cc_library(
4972    name = "sdca_internal",
4973    srcs = ["sdca_internal.cc"],
4974    hdrs = ["sdca_internal.h"],
4975    deps = [
4976        ":eigen_contraction_kernel",
4977        ":loss_updaters",
4978        "//tensorflow/core:framework",
4979        "//tensorflow/core:lib",
4980        "//tensorflow/core:lib_internal",
4981        "//third_party/eigen3",
4982    ],
4983)
4984
4985cc_library(
4986    name = "state",
4987    deps = [
4988        ":count_up_to_op",
4989        ":dense_update_ops",
4990        ":scatter_nd_op",
4991        ":scatter_op",
4992        ":variable_ops",
4993    ],
4994)
4995
4996STATE_DEPS = [
4997    ":assign_op",
4998    "//tensorflow/core/framework:bounds_check",
4999    ":fill_functor",
5000    ":scatter_functor",
5001    "//third_party/eigen3",
5002    "//tensorflow/core:framework",
5003    "//tensorflow/core:lib",
5004    "//tensorflow/core:lib_internal",
5005]
5006
5007tf_kernel_library(
5008    name = "count_up_to_op",
5009    prefix = "count_up_to_op",
5010    deps = STATE_DEPS + [":variable_ops"],
5011)
5012
5013tf_kernel_library(
5014    name = "dense_update_ops",
5015    prefix = "dense_update_ops",
5016    deps = STATE_DEPS + [":dense_update_functor"],
5017)
5018
5019tf_kernel_library(
5020    name = "scatter_op",
5021    prefix = "scatter_op",
5022    deps = STATE_DEPS,
5023)
5024
5025tf_kernel_library(
5026    name = "count_ops",
5027    prefix = "count_ops",
5028    deps = STATE_DEPS + [
5029        "@com_google_absl//absl/container:flat_hash_map",
5030        "//tensorflow/core/framework:op_requires",
5031    ],
5032)
5033
5034tf_cc_test(
5035    name = "count_ops_test",
5036    size = "small",
5037    srcs = ["count_ops_test.cc"],
5038    deps = [
5039        ":count_ops",
5040        ":ops_testutil",
5041        ":ops_util",
5042        "//tensorflow/core:framework",
5043        "//tensorflow/core:lib",
5044        "//tensorflow/core:protos_all_cc",
5045        "//tensorflow/core:test",
5046        "//tensorflow/core:test_main",
5047        "//tensorflow/core:testlib",
5048    ],
5049)
5050
5051tf_kernel_library(
5052    name = "scatter_nd_op",
5053    srcs = [
5054        "scatter_nd_op.cc",
5055        "scatter_nd_op_cpu_impl_0.cc",
5056        "scatter_nd_op_cpu_impl_1.cc",
5057        "scatter_nd_op_cpu_impl_2.cc",
5058        "scatter_nd_op_cpu_impl_3.cc",
5059        "scatter_nd_op_cpu_impl_4.cc",
5060        "scatter_nd_op_cpu_impl_5.cc",
5061        "scatter_nd_op_cpu_impl_6.cc",
5062        "scatter_nd_op_cpu_impl_7.cc",
5063    ],
5064    hdrs = [
5065        "scatter_nd_op.h",
5066        "scatter_nd_op_cpu_impl.h",
5067    ],
5068    gpu_copts = if_not_windows([
5069        "-Wno-pass-failed",  # clang misses #pragma loop optimizations
5070    ]),
5071    gpu_srcs = [
5072        "scatter_nd_op.h",
5073        "scatter_nd_op_gpu.cu.cc",
5074    ],
5075    deps = STATE_DEPS + [
5076        ":dense_update_functor",
5077        ":training_op_helpers",
5078        ":variable_ops",
5079        ":inplace_ops",
5080    ],
5081)
5082
5083tf_kernel_library(
5084    name = "variable_ops",
5085    prefix = "variable_ops",
5086    deps = STATE_DEPS,
5087)
5088
5089tf_kernel_library(
5090    name = "mutex_ops",
5091    prefix = "mutex_ops",
5092    deps = STATE_DEPS + [":ops_util"],
5093)
5094
5095tf_cc_test(
5096    name = "scatter_op_test",
5097    size = "small",
5098    srcs = ["scatter_op_test.cc"],
5099    deps = [
5100        ":fill_functor",
5101        ":ops_testutil",
5102        ":ops_util",
5103        ":scatter_op",
5104        "//tensorflow/core:framework",
5105        "//tensorflow/core:lib",
5106        "//tensorflow/core:protos_all_cc",
5107        "//tensorflow/core:test",
5108        "//tensorflow/core:test_main",
5109        "//tensorflow/core:testlib",
5110    ],
5111)
5112
5113tf_cuda_cc_test(
5114    name = "scatter_nd_op_test",
5115    size = "small",
5116    srcs = ["scatter_nd_op_test.cc"],
5117    tags = ["noasan"],  # http://b/32635055
5118    deps = [
5119        ":ops_testutil",
5120        ":ops_util",
5121        ":scatter_nd_op",
5122        "//tensorflow/core:core_cpu",
5123        "//tensorflow/core:framework",
5124        "//tensorflow/core:lib",
5125        "//tensorflow/core:protos_all_cc",
5126        "//tensorflow/core:test",
5127        "//tensorflow/core:test_main",
5128        "//tensorflow/core:testlib",
5129    ],
5130)
5131
5132cc_library(
5133    name = "string",
5134    deps = [
5135        ":as_string_op",
5136        ":base64_ops",
5137        ":reduce_join_op",
5138        ":regex_full_match_op",
5139        ":regex_replace_op",
5140        ":string_format_op",
5141        ":string_join_op",
5142        ":string_length_op",
5143        ":string_lower_op",
5144        ":string_ngrams_op",
5145        ":string_split_op",
5146        ":string_strip_op",
5147        ":string_to_hash_bucket_op",
5148        ":string_upper_op",
5149        ":substr_op",
5150        ":tensor_to_hash_bucket_op",
5151        ":unicode_ops",
5152        ":unicode_script_op",
5153        ":unsorted_segment_join_op",
5154    ],
5155)
5156
5157cc_library(
5158    name = "string_util",
5159    srcs = ["string_util.cc"],
5160    hdrs = ["string_util.h"],
5161    deps = [
5162        "//tensorflow/core:framework",
5163        "//tensorflow/core:lib",
5164        "//tensorflow/core:protos_all_cc",
5165        "@icu//:common",
5166    ],
5167)
5168
5169STRING_DEPS = [
5170    "//tensorflow/core/framework:bounds_check",
5171    ":string_util",
5172    "//third_party/eigen3",
5173    "//tensorflow/core:framework",
5174    "//tensorflow/core:lib",
5175    "//tensorflow/core:lib_internal",
5176]
5177
5178tf_kernel_library(
5179    name = "string_to_hash_bucket_op",
5180    srcs = [
5181        "string_to_hash_bucket_fast_op.cc",
5182        "string_to_hash_bucket_op.cc",
5183    ],
5184    hdrs = [
5185        "string_to_hash_bucket_fast_op.h",
5186        "string_to_hash_bucket_op.h",
5187    ],
5188    deps = STRING_DEPS,
5189)
5190
5191tf_kernel_library(
5192    name = "tensor_to_hash_bucket_op",
5193    prefix = "tensor_to_hash_bucket_op",
5194    deps = STRING_DEPS + if_oss(
5195        if_cuda(["@farmhash_gpu_archive//:farmhash_gpu"]),
5196        tf_fingerprint_deps(),
5197    ),
5198)
5199
5200tf_kernel_library(
5201    name = "reduce_join_op",
5202    prefix = "reduce_join_op",
5203    deps = STRING_DEPS,
5204)
5205
5206tf_kernel_library(
5207    name = "unsorted_segment_join_op",
5208    prefix = "unsorted_segment_join_op",
5209    deps = STRING_DEPS,
5210)
5211
5212tf_kernel_library(
5213    name = "string_format_op",
5214    prefix = "string_format_op",
5215    deps = STRING_DEPS + ["@com_google_absl//absl/strings"],
5216)
5217
5218tf_cc_test(
5219    name = "string_format_op_test",
5220    size = "small",
5221    srcs = ["string_format_op_test.cc"],
5222    deps = [
5223        ":ops_testutil",
5224        ":ops_util",
5225        ":string_format_op",
5226        "//tensorflow/core:core_cpu",
5227        "//tensorflow/core:framework",
5228        "//tensorflow/core:lib",
5229        "//tensorflow/core:protos_all_cc",
5230        "//tensorflow/core:test",
5231        "//tensorflow/core:test_main",
5232        "//tensorflow/core:testlib",
5233    ],
5234)
5235
5236tf_kernel_library(
5237    name = "string_join_op",
5238    prefix = "string_join_op",
5239    deps = STRING_DEPS,
5240)
5241
5242tf_kernel_library(
5243    name = "string_length_op",
5244    prefix = "string_length_op",
5245    deps = STRING_DEPS,
5246)
5247
5248tf_kernel_library(
5249    name = "regex_full_match_op",
5250    prefix = "regex_full_match_op",
5251    deps = STRING_DEPS + ["@com_googlesource_code_re2//:re2"],
5252)
5253
5254tf_kernel_library(
5255    name = "regex_replace_op",
5256    prefix = "regex_replace_op",
5257    deps = STRING_DEPS + ["@com_googlesource_code_re2//:re2"],
5258)
5259
5260tf_cc_test(
5261    name = "regex_replace_op_test",
5262    size = "small",
5263    srcs = ["regex_replace_op_test.cc"],
5264    deps = [
5265        ":ops_testutil",
5266        ":ops_util",
5267        ":regex_replace_op",
5268        "//tensorflow/core:core_cpu",
5269        "//tensorflow/core:framework",
5270        "//tensorflow/core:lib",
5271        "//tensorflow/core:protos_all_cc",
5272        "//tensorflow/core:test",
5273        "//tensorflow/core:test_main",
5274        "//tensorflow/core:testlib",
5275    ],
5276)
5277
5278tf_kernel_library(
5279    name = "string_split_op",
5280    prefix = "string_split_op",
5281    deps = STRING_DEPS,
5282)
5283
5284tf_cc_test(
5285    name = "string_split_op_test",
5286    size = "small",
5287    srcs = ["string_split_op_test.cc"],
5288    deps = [
5289        ":ops_testutil",
5290        ":ops_util",
5291        ":string_split_op",
5292        "//tensorflow/core:core_cpu",
5293        "//tensorflow/core:framework",
5294        "//tensorflow/core:lib",
5295        "//tensorflow/core:protos_all_cc",
5296        "//tensorflow/core:test",
5297        "//tensorflow/core:test_main",
5298        "//tensorflow/core:testlib",
5299    ],
5300)
5301
5302tf_kernel_library(
5303    name = "string_ngrams_op",
5304    srcs = ["string_ngrams_op.cc"],
5305    deps = STRING_DEPS + [
5306        "@com_google_absl//absl/strings",
5307    ],
5308)
5309
5310tf_cc_test(
5311    name = "string_ngrams_op_test",
5312    srcs = ["string_ngrams_op_test.cc"],
5313    deps = [
5314        ":ops_testutil",
5315        ":ops_util",
5316        ":string_ngrams_op",
5317        "//tensorflow/core:framework",
5318        "//tensorflow/core:lib",
5319        "//tensorflow/core:protos_all_cc",
5320        "//tensorflow/core:test",
5321        "//tensorflow/core:test_main",
5322        "//tensorflow/core:testlib",
5323    ],
5324)
5325
5326tf_kernel_library(
5327    name = "string_strip_op",
5328    prefix = "string_strip_op",
5329    deps = STRING_DEPS,
5330)
5331
5332tf_kernel_library(
5333    name = "string_lower_op",
5334    prefix = "string_lower_op",
5335    deps = STRING_DEPS + [
5336        "@com_google_absl//absl/strings",
5337        "@icu//:common",
5338    ],
5339)
5340
5341tf_kernel_library(
5342    name = "string_upper_op",
5343    prefix = "string_upper_op",
5344    deps = STRING_DEPS + [
5345        "@com_google_absl//absl/strings",
5346        "@icu//:common",
5347    ],
5348)
5349
5350tf_kernel_library(
5351    name = "substr_op",
5352    prefix = "substr_op",
5353    deps = STRING_DEPS,
5354)
5355
5356tf_cc_test(
5357    name = "substr_op_test",
5358    size = "small",
5359    srcs = ["substr_op_test.cc"],
5360    deps = [
5361        ":ops_testutil",
5362        ":ops_util",
5363        ":substr_op",
5364        "//tensorflow/core:core_cpu",
5365        "//tensorflow/core:framework",
5366        "//tensorflow/core:lib",
5367        "//tensorflow/core:lib_internal",
5368        "//tensorflow/core:protos_all_cc",
5369        "//tensorflow/core:test",
5370        "//tensorflow/core:test_main",
5371        "//tensorflow/core:testlib",
5372    ],
5373)
5374
5375tf_kernel_library(
5376    name = "as_string_op",
5377    prefix = "as_string_op",
5378    deps = STRING_DEPS,
5379)
5380
5381tf_cc_test(
5382    name = "as_string_op_test",
5383    size = "small",
5384    srcs = ["as_string_op_test.cc"],
5385    deps = [
5386        ":as_string_op",
5387        ":ops_testutil",
5388        ":ops_util",
5389        "//tensorflow/core:core_cpu",
5390        "//tensorflow/core:framework",
5391        "//tensorflow/core:lib",
5392        "//tensorflow/core:protos_all_cc",
5393        "//tensorflow/core:test",
5394        "//tensorflow/core:test_main",
5395        "//tensorflow/core:testlib",
5396    ],
5397)
5398
5399tf_kernel_library(
5400    name = "unicode_ops",
5401    prefix = "unicode_ops",
5402    deps = [
5403        ":string_util",
5404        "//tensorflow/core:framework",
5405        "//tensorflow/core:lib",
5406        "//tensorflow/core:lib_internal",
5407        "//tensorflow/core/framework:bounds_check",
5408        "//third_party/eigen3",
5409        "//third_party/icu/data:conversion_data",
5410        "@icu//:common",
5411    ],
5412)
5413
5414tf_kernel_library(
5415    name = "base64_ops",
5416    prefix = "base64_ops",
5417    deps = STRING_DEPS,
5418)
5419
5420tf_kernel_library(
5421    name = "training_ops",
5422    prefix = "training_ops",
5423    deps = [
5424        ":training_op_helpers",
5425        ":variable_ops",
5426        "//tensorflow/core:framework",
5427        "//tensorflow/core:lib",
5428        "//tensorflow/core/framework:bounds_check",
5429        "//third_party/eigen3",
5430    ],
5431)
5432
5433tf_cc_test(
5434    name = "training_ops_test",
5435    size = "small",
5436    srcs = ["training_ops_test.cc"],
5437    deps = [
5438        ":dense_update_ops",
5439        ":ops_util",
5440        ":training_ops",
5441        "//tensorflow/core:core_cpu",
5442        "//tensorflow/core:framework",
5443        "//tensorflow/core:test",
5444        "//tensorflow/core:test_main",
5445        "//tensorflow/core:testlib",
5446    ],
5447)
5448
5449tf_kernel_library(
5450    name = "multinomial_op",
5451    prefix = "multinomial_op",
5452    deps = [
5453        ":random_op",
5454        ":random_ops",
5455        ":stateless_random_ops",
5456        ":gpu_prim_hdrs",
5457        "//third_party/eigen3",
5458        "//tensorflow/core:framework",
5459        "//tensorflow/core:lib",
5460        "//tensorflow/core:lib_internal",
5461    ] + if_cuda_or_rocm([
5462        ":reduction_ops",
5463    ]),
5464)
5465
5466tf_cuda_cc_test(
5467    name = "multinomial_op_test",
5468    size = "small",
5469    srcs = ["multinomial_op_test.cc"],
5470    deps = [
5471        ":host_constant_op",
5472        ":multinomial_op",
5473        ":ops_util",
5474        "//tensorflow/core:core_cpu",
5475        "//tensorflow/core:framework",
5476        "//tensorflow/core:test",
5477        "//tensorflow/core:test_main",
5478        "//tensorflow/core:testlib",
5479    ],
5480)
5481
5482tf_kernel_library(
5483    name = "parameterized_truncated_normal_op",
5484    gpu_copts = if_not_windows([
5485        "-Wno-pass-failed",  # clang misses #pragma loop optimizations
5486    ]),
5487    prefix = "parameterized_truncated_normal_op",
5488    deps = [
5489        ":stateless_random_ops",
5490        "//tensorflow/core:core_cpu",
5491        "//tensorflow/core:framework",
5492        "//tensorflow/core:lib",
5493        "//tensorflow/core:lib_internal",
5494    ],
5495)
5496
5497tf_cuda_cc_test(
5498    name = "parameterized_truncated_normal_op_test",
5499    size = "small",
5500    srcs = ["parameterized_truncated_normal_op_test.cc"],
5501    deps = [
5502        ":host_constant_op",
5503        ":ops_util",
5504        ":parameterized_truncated_normal_op",
5505        "//tensorflow/core:core_cpu",
5506        "//tensorflow/core:framework",
5507        "//tensorflow/core:test",
5508        "//tensorflow/core:test_main",
5509        "//tensorflow/core:testlib",
5510    ],
5511)
5512
5513tf_kernel_library(
5514    name = "random_binomial_op",
5515    prefix = "random_binomial_op",
5516    deps = [
5517        ":cwise_op",
5518        ":random_op",
5519        ":resource_variable_ops",
5520        ":stateful_random_ops",
5521        ":stateless_random_ops",
5522        ":training_op_helpers",
5523        "//tensorflow/core:framework",
5524        "//tensorflow/core:framework_internal",
5525        "//tensorflow/core:lib",
5526        "//tensorflow/core:lib_internal",
5527        "//tensorflow/core:random_ops_op_lib",
5528    ],
5529)
5530
5531tf_cuda_cc_test(
5532    name = "random_binomial_op_test",
5533    size = "small",
5534    srcs = ["random_binomial_op_test.cc"],
5535    deps = [
5536        ":ops_util",
5537        ":random_binomial_op",
5538        "//tensorflow/core:core_cpu",
5539        "//tensorflow/core:framework",
5540        "//tensorflow/core:test",
5541        "//tensorflow/core:test_main",
5542        "//tensorflow/core:testlib",
5543    ],
5544)
5545
5546tf_kernel_library(
5547    name = "random_poisson_op",
5548    prefix = "random_poisson_op",
5549    deps = [
5550        ":random_ops",
5551        "//tensorflow/core:framework",
5552        "//tensorflow/core:lib",
5553        "//tensorflow/core:lib_internal",
5554    ],
5555)
5556
5557tf_cuda_cc_test(
5558    name = "random_poisson_op_test",
5559    size = "small",
5560    srcs = ["random_poisson_op_test.cc"],
5561    deps = [
5562        ":ops_util",
5563        ":random_poisson_op",
5564        "//tensorflow/core:core_cpu",
5565        "//tensorflow/core:framework",
5566        "//tensorflow/core:test",
5567        "//tensorflow/core:test_main",
5568        "//tensorflow/core:testlib",
5569    ],
5570)
5571
5572tf_kernel_library(
5573    name = "word2vec_kernels",
5574    prefix = "word2vec_kernels",
5575    deps = [
5576        "//tensorflow/core:framework",
5577        "//tensorflow/core:lib",
5578        "//tensorflow/core:lib_internal",
5579        "//tensorflow/core:word2vec_ops",
5580    ],
5581)
5582
5583tf_kernel_library(
5584    name = "encode_wav_op",
5585    prefix = "encode_wav_op",
5586    deps = [
5587        "//tensorflow/core:framework",
5588        "//tensorflow/core:lib",
5589        "//tensorflow/core:lib_internal",
5590        "//tensorflow/core:protos_all_cc",
5591        "//tensorflow/core/framework:bounds_check",
5592    ],
5593)
5594
5595tf_cc_test(
5596    name = "encode_wav_op_test",
5597    size = "small",
5598    srcs = ["encode_wav_op_test.cc"],
5599    deps = [
5600        ":decode_wav_op",
5601        ":encode_wav_op",
5602        ":ops_testutil",
5603        ":ops_util",
5604        "//tensorflow/cc:cc_ops",
5605        "//tensorflow/cc:client_session",
5606        "//tensorflow/core:core_cpu",
5607        "//tensorflow/core:framework",
5608        "//tensorflow/core:framework_internal",
5609        "//tensorflow/core:lib",
5610        "//tensorflow/core:protos_all_cc",
5611        "//tensorflow/core:tensorflow",
5612        "//tensorflow/core:test",
5613        "//tensorflow/core:test_main",
5614        "//tensorflow/core:testlib",
5615    ],
5616)
5617
5618tf_kernel_library(
5619    name = "decode_wav_op",
5620    prefix = "decode_wav_op",
5621    deps = [
5622        "//tensorflow/core:framework",
5623        "//tensorflow/core:lib",
5624        "//tensorflow/core:lib_internal",
5625        "//tensorflow/core:protos_all_cc",
5626    ],
5627)
5628
5629tf_cc_test(
5630    name = "decode_wav_op_test",
5631    size = "small",
5632    srcs = ["decode_wav_op_test.cc"],
5633    deps = [
5634        ":decode_wav_op",
5635        ":ops_testutil",
5636        ":ops_util",
5637        "//tensorflow/cc:cc_ops",
5638        "//tensorflow/cc:client_session",
5639        "//tensorflow/core:core_cpu",
5640        "//tensorflow/core:framework",
5641        "//tensorflow/core:framework_internal",
5642        "//tensorflow/core:lib",
5643        "//tensorflow/core:protos_all_cc",
5644        "//tensorflow/core:tensorflow",
5645        "//tensorflow/core:test",
5646        "//tensorflow/core:test_main",
5647        "//tensorflow/core:testlib",
5648    ],
5649)
5650
5651alias(
5652    name = "spectrogram_test_data",
5653    actual = "//tensorflow/core/kernels/spectrogram_test_data:spectrogram_test_data",
5654    visibility = ["//visibility:public"],
5655)
5656
5657cc_library(
5658    name = "spectrogram",
5659    srcs = ["spectrogram.cc"],
5660    hdrs = ["spectrogram.h"],
5661    copts = tf_copts(),
5662    deps = [
5663        "//tensorflow/core:framework",
5664        "//tensorflow/core:lib",
5665        "//third_party/fft2d:fft2d_headers",
5666        "@fft2d",
5667    ],
5668)
5669
5670cc_library(
5671    name = "spectrogram_test_utils",
5672    testonly = 1,
5673    srcs = ["spectrogram_test_utils.cc"],
5674    hdrs = ["spectrogram_test_utils.h"],
5675    copts = tf_copts(),
5676    deps = [
5677        "//tensorflow/core:framework",
5678        "//tensorflow/core:lib",
5679        "//tensorflow/core:lib_internal",
5680        "//tensorflow/core:protos_all_cc",
5681        "//tensorflow/core:test",
5682    ],
5683)
5684
5685tf_cc_binary(
5686    name = "spectrogram_convert_test_data",
5687    testonly = 1,
5688    srcs = ["spectrogram_convert_test_data.cc"],
5689    deps = [
5690        ":spectrogram_test_utils",
5691        "//tensorflow/core:lib",
5692        "//tensorflow/core:lib_internal",
5693    ],
5694)
5695
5696tf_cc_test(
5697    name = "spectrogram_test",
5698    size = "medium",
5699    srcs = ["spectrogram_test.cc"],
5700    data = [":spectrogram_test_data"],
5701    deps = [
5702        ":spectrogram",
5703        ":spectrogram_test_utils",
5704        "//tensorflow/core:lib",
5705        "//tensorflow/core:lib_internal",
5706        "//tensorflow/core:lib_test_internal",
5707        "//tensorflow/core:protos_all_cc",
5708        "//tensorflow/core:test",
5709        "//tensorflow/core:test_main",
5710        "//tensorflow/core/platform:resource_loader",
5711        "//third_party/eigen3",
5712    ],
5713)
5714
5715tf_kernel_library(
5716    name = "spectrogram_op",
5717    prefix = "spectrogram_op",
5718    deps = [
5719        ":spectrogram",
5720        "//tensorflow/core:core_cpu",
5721        "//tensorflow/core:framework",
5722        "//tensorflow/core:lib",
5723        "//tensorflow/core:lib_internal",
5724    ],
5725    alwayslink = 1,
5726)
5727
5728tf_cuda_cc_test(
5729    name = "spectrogram_op_test",
5730    size = "small",
5731    srcs = ["spectrogram_op_test.cc"],
5732    deps = [
5733        ":ops_util",
5734        ":spectrogram_op",
5735        "//tensorflow/cc:cc_ops",
5736        "//tensorflow/cc:client_session",
5737        "//tensorflow/core:core_cpu",
5738        "//tensorflow/core:framework",
5739        "//tensorflow/core:framework_internal",
5740        "//tensorflow/core:lib",
5741        "//tensorflow/core:protos_all_cc",
5742        "//tensorflow/core:tensorflow",
5743        "//tensorflow/core:test",
5744        "//tensorflow/core:test_main",
5745        "//tensorflow/core:testlib",
5746    ],
5747)
5748
5749cc_library(
5750    name = "mfcc_dct",
5751    srcs = ["mfcc_dct.cc"],
5752    hdrs = ["mfcc_dct.h"],
5753    copts = tf_copts(),
5754    deps = [
5755        "//tensorflow/core:framework",
5756        "//tensorflow/core:lib",
5757    ],
5758)
5759
5760tf_cc_test(
5761    name = "mfcc_dct_test",
5762    size = "small",
5763    srcs = ["mfcc_dct_test.cc"],
5764    deps = [
5765        ":mfcc_dct",
5766        "//tensorflow/core:lib",
5767        "//tensorflow/core:lib_internal",
5768        "//tensorflow/core:lib_test_internal",
5769        "//tensorflow/core:protos_all_cc",
5770        "//tensorflow/core:test",
5771        "//tensorflow/core:test_main",
5772        "//third_party/eigen3",
5773    ],
5774)
5775
5776cc_library(
5777    name = "mfcc_mel_filterbank",
5778    srcs = ["mfcc_mel_filterbank.cc"],
5779    hdrs = ["mfcc_mel_filterbank.h"],
5780    copts = tf_copts(),
5781    deps = [
5782        "//tensorflow/core:framework",
5783        "//tensorflow/core:lib",
5784    ],
5785)
5786
5787tf_cc_test(
5788    name = "mfcc_mel_filterbank_test",
5789    size = "small",
5790    srcs = ["mfcc_mel_filterbank_test.cc"],
5791    deps = [
5792        ":mfcc_mel_filterbank",
5793        "//tensorflow/core:lib",
5794        "//tensorflow/core:lib_internal",
5795        "//tensorflow/core:lib_test_internal",
5796        "//tensorflow/core:protos_all_cc",
5797        "//tensorflow/core:test",
5798        "//tensorflow/core:test_main",
5799        "//third_party/eigen3",
5800    ],
5801)
5802
5803cc_library(
5804    name = "mfcc",
5805    srcs = ["mfcc.cc"],
5806    hdrs = ["mfcc.h"],
5807    copts = tf_copts(),
5808    deps = [
5809        ":mfcc_dct",
5810        ":mfcc_mel_filterbank",
5811        "//tensorflow/core:framework",
5812        "//tensorflow/core:lib",
5813    ],
5814)
5815
5816tf_cc_test(
5817    name = "mfcc_test",
5818    size = "small",
5819    srcs = ["mfcc_test.cc"],
5820    deps = [
5821        ":mfcc",
5822        "//tensorflow/core:lib",
5823        "//tensorflow/core:lib_internal",
5824        "//tensorflow/core:lib_test_internal",
5825        "//tensorflow/core:protos_all_cc",
5826        "//tensorflow/core:test",
5827        "//tensorflow/core:test_main",
5828        "//third_party/eigen3",
5829    ],
5830)
5831
5832tf_kernel_library(
5833    name = "mfcc_op",
5834    prefix = "mfcc_op",
5835    deps = [
5836        ":mfcc",
5837        "//tensorflow/core:core_cpu",
5838        "//tensorflow/core:framework",
5839        "//tensorflow/core:lib",
5840        "//tensorflow/core:lib_internal",
5841    ],
5842    alwayslink = 1,
5843)
5844
5845tf_cuda_cc_test(
5846    name = "mfcc_op_test",
5847    size = "small",
5848    srcs = ["mfcc_op_test.cc"],
5849    deps = [
5850        ":mfcc_op",
5851        ":ops_util",
5852        "//tensorflow/cc:cc_ops",
5853        "//tensorflow/cc:client_session",
5854        "//tensorflow/core:core_cpu",
5855        "//tensorflow/core:framework",
5856        "//tensorflow/core:framework_internal",
5857        "//tensorflow/core:lib",
5858        "//tensorflow/core:protos_all_cc",
5859        "//tensorflow/core:tensorflow",
5860        "//tensorflow/core:test",
5861        "//tensorflow/core:test_main",
5862        "//tensorflow/core:testlib",
5863    ],
5864)
5865
5866cc_library(
5867    name = "audio",
5868    deps = [
5869        ":decode_wav_op",
5870        ":encode_wav_op",
5871        ":mfcc_op",
5872        ":spectrogram_op",
5873    ],
5874)
5875
5876cc_library(
5877    name = "meta_support",
5878    srcs = ["meta_support.cc"],
5879    hdrs = ["meta_support.h"],
5880    deps = [
5881        ":quantization_utils",
5882        "//tensorflow/core:framework",
5883        "//tensorflow/core/platform:logging",
5884        "//tensorflow/core/platform:mutex",
5885        "@gemmlowp",
5886    ],
5887)
5888
5889# Android libraries -----------------------------------------------------------
5890filegroup(
5891    name = "mobile_srcs",
5892    srcs = [
5893        "avgpooling_op.h",
5894        "batch_util.h",
5895        "cwise_ops.h",
5896        "cwise_ops_common.h",
5897        "cwise_ops_gradients.h",
5898        "eigen_activations.h",
5899        "eigen_attention.h",
5900        "eigen_backward_cuboid_convolutions.h",
5901        "eigen_backward_spatial_convolutions.h",
5902        "eigen_convolution_helpers.h",
5903        "eigen_cuboid_convolution.h",
5904        "eigen_pooling.h",
5905        "eigen_spatial_convolutions.h",
5906        "eigen_spatial_convolutions-inl.h",
5907        "fifo_queue.h",
5908        "maxpooling_op.h",
5909        "ops_util.h",
5910        "padding_fifo_queue.h",
5911        "pooling_ops_common.cc",
5912        "pooling_ops_common.h",
5913        "queue_base.h",
5914        "queue_op.h",
5915        "typed_queue.h",
5916    ],
5917)
5918
5919alias(
5920    name = "android_srcs",
5921    actual = ":mobile_srcs",
5922)
5923
5924# Core kernels we want on Android. Only a subset of kernels to keep
5925# base library small.
5926filegroup(
5927    name = "portable_core_ops",
5928    srcs = [
5929        "aggregate_ops.cc",
5930        "aggregate_ops.h",
5931        "aggregate_ops_cpu.h",
5932        "assign_op.h",
5933        "bias_op.cc",
5934        "bias_op.h",
5935        "cast_op.cc",
5936        "cast_op.h",
5937        "cast_op_impl.h",
5938        "cast_op_impl_bfloat.cc",
5939        "cast_op_impl_bool.cc",
5940        "cast_op_impl_complex128.cc",
5941        "cast_op_impl_complex64.cc",
5942        "cast_op_impl_double.cc",
5943        "cast_op_impl_float.cc",
5944        "cast_op_impl_half.cc",
5945        "cast_op_impl_int16.cc",
5946        "cast_op_impl_int32.cc",
5947        "cast_op_impl_int64.cc",
5948        "cast_op_impl_int8.cc",
5949        "cast_op_impl_uint16.cc",
5950        "cast_op_impl_uint32.cc",
5951        "cast_op_impl_uint64.cc",
5952        "cast_op_impl_uint8.cc",
5953        "concat_lib.h",
5954        "concat_lib_cpu.cc",
5955        "concat_lib_cpu.h",
5956        "concat_op.cc",
5957        "constant_op.cc",
5958        "constant_op.h",
5959        "cwise_ops.h",
5960        "cwise_ops_common.cc",
5961        "cwise_ops_common.h",
5962        "cwise_ops_gradients.h",
5963        "dense_update_functor.cc",
5964        "dense_update_functor.h",
5965        "dense_update_ops.cc",
5966        "example_parsing_ops.cc",
5967        "fill_functor.cc",
5968        "fill_functor.h",
5969        "function_ops.cc",
5970        "function_ops.h",
5971        "gather_functor.h",
5972        "gather_functor_batched.h",
5973        "gather_nd_op.cc",
5974        "gather_nd_op.h",
5975        "gather_nd_op_cpu_impl_0.cc",
5976        "gather_nd_op_cpu_impl_1.cc",
5977        "gather_nd_op_cpu_impl_2.cc",
5978        "gather_nd_op_cpu_impl_3.cc",
5979        "gather_nd_op_cpu_impl_4.cc",
5980        "gather_nd_op_cpu_impl_5.cc",
5981        "gather_nd_op_cpu_impl_6.cc",
5982        "gather_nd_op_cpu_impl_7.cc",
5983        "gather_op.cc",
5984        "identity_n_op.cc",
5985        "identity_n_op.h",
5986        "identity_op.cc",
5987        "identity_op.h",
5988        "immutable_constant_op.cc",
5989        "immutable_constant_op.h",
5990        "matmul_op_impl.h",
5991        "matmul_op_real.cc",
5992        "no_op.cc",
5993        "no_op.h",
5994        "one_hot_op.cc",
5995        "one_hot_op.h",
5996        "ops_util.h",
5997        "pack_op.cc",
5998        "pooling_ops_common.h",
5999        "redux_functor.h",
6000        "reshape_op.cc",
6001        "reshape_op.h",
6002        "reverse_sequence_op.cc",
6003        "reverse_sequence_op.h",
6004        "sendrecv_ops.cc",
6005        "sendrecv_ops.h",
6006        "sequence_ops.cc",
6007        "shape_ops.cc",
6008        "shape_ops.h",
6009        "slice_op.cc",
6010        "slice_op.h",
6011        "slice_op_cpu_impl_1.cc",
6012        "slice_op_cpu_impl_2.cc",
6013        "slice_op_cpu_impl_3.cc",
6014        "slice_op_cpu_impl_4.cc",
6015        "slice_op_cpu_impl_5.cc",
6016        "slice_op_cpu_impl_6.cc",
6017        "slice_op_cpu_impl_7.cc",
6018        "slice_op_cpu_impl_8.cc",
6019        "softmax_op.cc",
6020        "softmax_op_functor.h",
6021        "split_lib.h",
6022        "split_lib_cpu.cc",
6023        "split_op.cc",
6024        "split_v_op.cc",
6025        "strided_slice_op.cc",
6026        "strided_slice_op.h",
6027        "strided_slice_op_inst_0.cc",
6028        "strided_slice_op_inst_1.cc",
6029        "strided_slice_op_inst_2.cc",
6030        "strided_slice_op_inst_3.cc",
6031        "strided_slice_op_inst_4.cc",
6032        "strided_slice_op_inst_5.cc",
6033        "strided_slice_op_inst_6.cc",
6034        "strided_slice_op_inst_7.cc",
6035        "strided_slice_op_inst_8.cc",
6036        "unpack_op.cc",
6037        "variable_ops.cc",
6038        "variable_ops.h",
6039    ] + [
6040        "//tensorflow/c/kernels:portable_all_op_kernels",
6041        "//tensorflow/core/kernels/image:non_max_suppression_op.cc",
6042        "//tensorflow/core/kernels/image:non_max_suppression_op.h",
6043    ],
6044)
6045
6046# Other kernels we may want on Android.
6047#
6048# The kernels can be consumed as a whole or in two groups for
6049# supporting separate compilation. Note that the split into groups
6050# is entirely for improving compilation time, and not for
6051# organizational reasons; you should not depend on any
6052# of those groups independently.
6053filegroup(
6054    name = "portable_extended_ops",
6055    srcs = [
6056        ":portable_extended_ops_group1",
6057        ":portable_extended_ops_group2",
6058        ":portable_quantized_ops",
6059    ],
6060    visibility = ["//visibility:public"],
6061)
6062
6063filegroup(
6064    name = "portable_extended_ops_headers",
6065    srcs = [
6066        "argmax_op.h",
6067        "avgpooling_op.h",
6068        "batch_norm_op.h",
6069        "bincount_op.h",
6070        "broadcast_to_op.h",
6071        "bucketize_op.h",
6072        "concat_lib.h",
6073        "control_flow_ops.h",
6074        "conv_2d.h",
6075        "conv_3d.h",
6076        "conv_ops.h",
6077        "conv_ops_gpu.h",
6078        "data_format_ops.h",
6079        "depthtospace_op.h",
6080        "depthwise_conv_op.h",
6081        "diag_op.h",
6082        "dilation_ops.h",
6083        "fake_quant_ops_functor.h",
6084        "fused_batch_norm_op.h",
6085        "initializable_lookup_table.h",
6086        "inplace_ops.cc",
6087        "inplace_ops_functor.h",
6088        "lookup_table_init_op.h",
6089        "lookup_table_op.h",
6090        "lookup_util.h",
6091        "list_kernels.h",
6092        "map_kernels.h",
6093        "maxpooling_op.h",
6094        "mfcc.h",
6095        "mfcc_dct.h",
6096        "mfcc_mel_filterbank.h",
6097        "multinomial_op.h",
6098        "pad_op.h",
6099        "pooling_ops_3d.h",
6100        "ragged_tensor_variant.h",
6101        "random_op.h",
6102        "random_poisson_op.h",
6103        "reduction_ops.h",
6104        "reduction_ops_common.h",
6105        "relu_op.h",
6106        "relu_op_functor.h",
6107        "reshape_util.h",
6108        "resource_variable_ops.h",
6109        "reverse_op.h",
6110        "roll_op.h",
6111        "save_restore_tensor.h",
6112        "scan_ops.h",
6113        "scatter_functor.h",
6114        "scatter_nd_op.h",
6115        "segment_reduction_ops.h",
6116        "segment_reduction_ops_impl.h",
6117        "softplus_op.h",
6118        "softsign_op.h",
6119        "spacetobatch_functor.h",
6120        "spacetodepth_op.h",
6121        "spectrogram.h",
6122        "stateless_random_gamma_op.h",
6123        "stateless_random_ops.h",
6124        "stateless_random_ops_v2.h",
6125        "sparse_xent_op.h",
6126        "sparse_fill_empty_rows_op.h",
6127        "sparse_reorder_op.h",
6128        "sparse_tensor_dense_matmul_op.h",
6129        "string_util.h",
6130        "string_to_hash_bucket_op.h",
6131        "string_to_hash_bucket_fast_op.h",
6132        "tensor_array.h",
6133        "tensor_list.h",
6134        "tensor_map.h",
6135        "tile_functor.h",
6136        "tile_ops_impl.h",
6137        "topk_op.h",
6138        "training_op_helpers.h",
6139        "training_ops.h",
6140        "transpose_functor.h",
6141        "transpose_op.h",
6142        "where_op.h",
6143        "xent_op.h",
6144    ] + [
6145        "//tensorflow/core/data:captured_function.h",
6146        "//tensorflow/core/data:dataset_utils.h",
6147        "//tensorflow/core/data:name_utils.h",
6148        "//tensorflow/core/data:rewrite_utils.h",
6149        "//tensorflow/core/data:split_utils.h",
6150        "//tensorflow/core/data:root_dataset.h",
6151        "//tensorflow/core/data:serialization_utils.h",
6152        "//tensorflow/core/data:stats_utils.h",
6153        "//tensorflow/core/data:unbounded_thread_pool.h",
6154        "//tensorflow/core/kernels/boosted_trees/quantiles:weighted_quantiles_hdrs",
6155        "//tensorflow/core/kernels/data:batch_dataset_op.h",
6156        "//tensorflow/core/kernels/data:iterator_ops.h",
6157        "//tensorflow/core/kernels/data:finalize_dataset_op.h",
6158        "//tensorflow/core/kernels/data:flat_map_dataset_op.h",
6159        "//tensorflow/core/kernels/data:map_dataset_op.h",
6160        "//tensorflow/core/kernels/data:take_dataset_op.h",
6161        "//tensorflow/core/kernels/data:model_dataset_op.h",
6162        "//tensorflow/core/kernels/data:optimize_dataset_op.h",
6163        "//tensorflow/core/kernels/data:optional_ops.h",
6164        "//tensorflow/core/kernels/data:reduce_dataset_op.h",
6165        "//tensorflow/core/kernels/data:repeat_dataset_op.h",
6166        "//tensorflow/core/kernels/data:tensor_slice_dataset_op.h",
6167        "//tensorflow/core/kernels/data/experimental:threadpool_dataset_op.h",
6168        "//tensorflow/core/kernels/image:adjust_contrast_op.h",
6169        "//tensorflow/core/kernels/image:adjust_hue_op.h",
6170        "//tensorflow/core/kernels/image:adjust_saturation_op.h",
6171        "//tensorflow/core/kernels/image:colorspace_op.h",
6172        "//tensorflow/core/kernels/image:extract_image_patches_op.h",
6173        "//tensorflow/core/kernels/image:image_ops.h",
6174        "//tensorflow/core/kernels/image:mirror_pad_op.h",
6175        "//tensorflow/core/kernels/image:mirror_pad_op_cpu_impl.h",
6176        "//tensorflow/core/kernels/image:resize_bilinear_op.h",
6177        "//tensorflow/core/kernels/image:resize_nearest_neighbor_op.h",
6178        "//tensorflow/core/kernels/linalg:linalg_ops_common.h",
6179        "//tensorflow/core/kernels/linalg:matrix_band_part_op.h",
6180        "//tensorflow/core/kernels/linalg:matrix_diag_op.h",
6181        "//tensorflow/core/kernels/linalg:matrix_set_diag_op.h",
6182        "//tensorflow/core/kernels/linalg:matrix_triangular_solve_op_impl.h",
6183        "//tensorflow/core/util:image_resizer_state.h",
6184    ],
6185)
6186
6187filegroup(
6188    name = "portable_extended_ops_group1",
6189    srcs = [
6190        ":portable_extended_ops_headers",
6191        "argmax_op.cc",
6192        "avgpooling_op.cc",
6193        "batch_norm_op.cc",
6194        "bcast_ops.cc",
6195        "check_numerics_op.cc",
6196        "control_flow_ops.cc",
6197        "conv_2d.h",
6198        "conv_grad_filter_ops.cc",
6199        "conv_grad_input_ops.h",
6200        "conv_grad_input_ops_double.cc",
6201        "conv_grad_input_ops_float.cc",
6202        "conv_grad_input_ops_half.cc",
6203        "conv_grad_input_ops_int32.cc",
6204        "conv_grad_input_ops.cc",
6205        "conv_grad_ops.h",
6206        "conv_grad_ops_3d.cc",
6207        "conv_grad_shape_utils.cc",
6208        "conv_grad_shape_utils.h",
6209        "conv_ops.cc",
6210        "conv_ops_3d.cc",
6211        "conv_ops_fused_double.cc",
6212        "conv_ops_fused_float.cc",
6213        "conv_ops_fused_half.cc",
6214        "conv_ops_fused_image_transform.cc",
6215        "conv_ops_fused_impl.h",
6216        "conv_ops_using_gemm.cc",
6217        "cwise_op_abs.cc",
6218        "cwise_op_add_1.cc",
6219        "cwise_op_add_2.cc",
6220        "cwise_op_arg.cc",
6221        "cwise_op_atan.cc",
6222        "cwise_op_atan2.cc",
6223        "cwise_op_bitwise_and.cc",
6224        "cwise_op_bitwise_or.cc",
6225        "cwise_op_bitwise_xor.cc",
6226        "cwise_op_ceil.cc",
6227        "cwise_op_complex.cc",
6228        "cwise_op_conj.cc",
6229        "cwise_op_cos.cc",
6230        "cwise_op_cosh.cc",
6231        "cwise_op_div.cc",
6232        "cwise_op_equal_to_1.cc",
6233        "cwise_op_equal_to_2.cc",
6234        "cwise_op_erf.cc",
6235        "cwise_op_exp.cc",
6236        "cwise_op_floor.cc",
6237        "cwise_op_floor_div.cc",
6238        "cwise_op_floor_mod.cc",
6239        "cwise_op_greater.cc",
6240        "cwise_op_greater_equal.cc",
6241        "cwise_op_imag.cc",
6242        "cwise_op_invert.cc",
6243        "cwise_op_isfinite.cc",
6244        "cwise_op_isnan.cc",
6245        "cwise_op_left_shift.cc",
6246        "cwise_op_less.cc",
6247        "cwise_op_less_equal.cc",
6248        "cwise_op_log.cc",
6249        "cwise_op_logical_and.cc",
6250        "cwise_op_logical_not.cc",
6251        "cwise_op_logical_or.cc",
6252        "cwise_op_maximum.cc",
6253        "cwise_op_minimum.cc",
6254        "cwise_op_mul_1.cc",
6255        "cwise_op_mul_2.cc",
6256        "cwise_op_neg_1.cc",
6257        "cwise_op_neg_2.cc",
6258        "cwise_op_not_equal_to_1.cc",
6259        "cwise_op_not_equal_to_2.cc",
6260        "cwise_op_pow.cc",
6261        "cwise_op_real.cc",
6262        "cwise_op_reciprocal.cc",
6263        "cwise_op_right_shift.cc",
6264        "cwise_op_round.cc",
6265        "cwise_op_rsqrt.cc",
6266        "cwise_op_select.cc",
6267        "cwise_op_sigmoid.cc",
6268        "cwise_op_sign.cc",
6269        "cwise_op_sin.cc",
6270        "cwise_op_sinh.cc",
6271        "cwise_op_sqrt.cc",
6272        "cwise_op_square.cc",
6273        "cwise_op_squared_difference.cc",
6274        "cwise_op_sub.cc",
6275        "cwise_op_tan.cc",
6276        "cwise_op_tanh.cc",
6277        "cwise_op_xdivy.cc",
6278        "cwise_op_xlog1py.cc",
6279        "cwise_op_xlogy.cc",
6280        "data_format_ops.cc",
6281        "decode_raw_op.cc",
6282        "decode_wav_op.cc",
6283        "deep_conv2d.cc",
6284        "deep_conv2d.h",
6285        "depthwise_conv_grad_op.cc",
6286        "depthwise_conv_op.cc",
6287        "dynamic_partition_op.cc",
6288        "eigen_contraction_kernel.cc",
6289        "eigen_contraction_kernel.h",
6290        "encode_wav_op.cc",
6291        "fake_quant_ops.cc",
6292        "fifo_queue.cc",
6293        "fifo_queue_op.cc",
6294        "fingerprint_op.cc",
6295        "fused_batch_norm_op.cc",
6296        "fused_eigen_output_kernels.cc",
6297        "fused_eigen_output_kernels.h",
6298        "listdiff_op.cc",
6299        "population_count_op.cc",
6300        "population_count_op.h",
6301        "winograd_transform.h",
6302    ] + [
6303        "//tensorflow/core/kernels/image:crop_and_resize_op.cc",
6304        "//tensorflow/core/kernels/image:crop_and_resize_op.h",
6305        "//tensorflow/core/kernels/linalg:einsum_op_impl_half.cc",
6306        "//tensorflow/core/kernels/linalg:einsum_op_impl_bfloat16.cc",
6307        "//tensorflow/core/kernels/linalg:einsum_op_impl_int32.cc",
6308        "//tensorflow/core/kernels/linalg:einsum_op_impl_int64.cc",
6309        "//tensorflow/core/kernels/linalg:einsum_op_impl_float.cc",
6310        "//tensorflow/core/kernels/linalg:einsum_op_impl_double.cc",
6311        "//tensorflow/core/kernels/linalg:einsum_op_impl_complex64.cc",
6312        "//tensorflow/core/kernels/linalg:einsum_op_impl_complex128.cc",
6313        "//tensorflow/core/kernels/linalg:einsum_op_impl.h",
6314        "//tensorflow/core/kernels/linalg:einsum_op.h",
6315        "//tensorflow/core/kernels/image:decode_image_op.cc",
6316        "//tensorflow/core/kernels/image:encode_jpeg_op.cc",
6317        "//tensorflow/core/kernels/image:encode_png_op.cc",
6318        "//tensorflow/core/kernels/image:colorspace_op.cc",
6319    ] + select({
6320        ":xsmm_convolutions": [
6321            "xsmm_conv2d.h",
6322            "xsmm_conv2d.cc",
6323        ],
6324        "//conditions:default": [],
6325    }),
6326)
6327
6328filegroup(
6329    name = "portable_extended_ops_group2",
6330    srcs = [
6331        ":portable_extended_ops_headers",
6332        "as_string_op.cc",
6333        "base64_ops.cc",
6334        "batchtospace_op.cc",
6335        "bincount_op.cc",
6336        "broadcast_to_op.cc",
6337        "bucketize_op.cc",
6338        "ctc_decoder_ops.cc",
6339        "decode_padded_raw_op.cc",
6340        "depthtospace_op.cc",
6341        "diag_op.cc",
6342        "dilation_ops.cc",
6343        "dynamic_stitch_op.cc",
6344        "fft_ops.cc",
6345        "in_topk_op.cc",
6346        "in_topk_op.h",
6347        "initializable_lookup_table.cc",
6348        "list_kernels.cc",
6349        "logging_ops.cc",
6350        "logging_ops.h",
6351        "lookup_table_init_op.cc",
6352        "lookup_table_op.cc",
6353        "lookup_util.cc",
6354        "lrn_op.cc",
6355        "map_kernels.cc",
6356        "maxpooling_op.cc",
6357        "mfcc.cc",
6358        "mfcc_dct.cc",
6359        "mfcc_mel_filterbank.cc",
6360        "mfcc_op.cc",
6361        "multinomial_op.cc",
6362        "pad_op.cc",
6363        "padding_fifo_queue.cc",
6364        "padding_fifo_queue_op.cc",
6365        "parse_tensor_op.cc",
6366        "pooling_ops_3d.cc",
6367        "queue_base.cc",
6368        "queue_op.cc",
6369        "queue_ops.cc",
6370        "ragged_tensor_variant.cc",
6371        "ragged_range_op.cc",
6372        "ragged_gather_op.cc",
6373        "ragged_tensor_to_sparse_kernel.cc",
6374        "ragged_tensor_to_tensor_op.cc",
6375        "ragged_tensor_to_variant_op.cc",
6376        "ragged_tensor_from_variant_op.cc",
6377        "random_op.cc",
6378        "random_op_cpu.h",
6379        "random_ops_util.h",
6380        "random_poisson_op.cc",
6381        "random_shuffle_op.cc",
6382        "reduce_join_op.cc",
6383        "reduction_ops_all.cc",
6384        "reduction_ops_any.cc",
6385        "reduction_ops_common.cc",
6386        "reduction_ops_max.cc",
6387        "reduction_ops_mean.cc",
6388        "reduction_ops_min.cc",
6389        "reduction_ops_prod.cc",
6390        "reduction_ops_sum.cc",
6391        "regex_replace_op.cc",
6392        "regex_full_match_op.cc",
6393        "relu_op.cc",
6394        "reshape_util.cc",
6395        "resource_variable_ops.cc",
6396        "restore_op.cc",
6397        "reverse_op.cc",
6398        "roll_op.cc",
6399        "save_op.cc",
6400        "save_restore_tensor.cc",
6401        "save_restore_v2_ops.cc",
6402        "scan_ops.cc",
6403        "scatter_functor.cc",
6404        "scatter_nd_op.cc",
6405        "scatter_nd_op_cpu_impl_0.cc",
6406        "scatter_nd_op_cpu_impl_1.cc",
6407        "scatter_nd_op_cpu_impl_2.cc",
6408        "scatter_nd_op_cpu_impl_3.cc",
6409        "scatter_nd_op_cpu_impl_4.cc",
6410        "scatter_nd_op_cpu_impl_5.cc",
6411        "scatter_nd_op_cpu_impl_6.cc",
6412        "scatter_nd_op_cpu_impl_7.cc",
6413        "segment_reduction_ops_impl_1.cc",
6414        "segment_reduction_ops_impl_2.cc",
6415        "segment_reduction_ops_impl_3.cc",
6416        "segment_reduction_ops_impl_4.cc",
6417        "segment_reduction_ops_impl_5.cc",
6418        "session_ops.cc",
6419        "set_kernels.cc",
6420        "softplus_op.cc",
6421        "softsign_op.cc",
6422        "spacetobatch_functor.cc",
6423        "spacetobatch_op.cc",
6424        "spacetodepth_op.cc",
6425        "sparse_add_op.cc",
6426        "sparse_cross_op.cc",
6427        "sparse_reduce_op.cc",
6428        "sparse_xent_op.cc",
6429        "sparse_fill_empty_rows_op.cc",
6430        "sparse_reorder_op.cc",
6431        "sparse_reshape_op.cc",
6432        "sparse_slice_op.cc",
6433        "sparse_tensor_dense_matmul_op.cc",
6434        "sparse_to_dense_op.cc",
6435        "spectrogram.cc",
6436        "spectrogram_op.cc",
6437        "stack.cc",
6438        "stack.h",
6439        "stack_ops.cc",
6440        "stateless_random_gamma_op.cc",
6441        "stateless_random_ops.cc",
6442        "stateless_random_ops_v2.cc",
6443        "string_format_op.cc",
6444        "string_join_op.cc",
6445        "string_length_op.cc",
6446        "string_lower_op.cc",
6447        "string_util.cc",
6448        "string_split_op.cc",
6449        "string_strip_op.cc",
6450        "string_to_hash_bucket_op.cc",
6451        "string_to_hash_bucket_fast_op.cc",
6452        "string_to_number_op.cc",
6453        "substr_op.cc",
6454        "tensor_array.cc",
6455        "tensor_array_ops.cc",
6456        "tensor_list.cc",
6457        "tensor_map.cc",
6458        "tile_functor_cpu.h",
6459        "tile_functor_cpu_bfloat16.cc",
6460        "tile_functor_cpu_bool.cc",
6461        "tile_functor_cpu_complex128.cc",
6462        "tile_functor_cpu_complex64.cc",
6463        "tile_functor_cpu_double.cc",
6464        "tile_functor_cpu_float.cc",
6465        "tile_functor_cpu_half.cc",
6466        "tile_functor_cpu_int16.cc",
6467        "tile_functor_cpu_int32.cc",
6468        "tile_functor_cpu_int64.cc",
6469        "tile_functor_cpu_int8.cc",
6470        "tile_functor_cpu_tstring.cc",
6471        "tile_functor_cpu_uint32.cc",
6472        "tile_functor_cpu_uint64.cc",
6473        "tile_functor_cpu_uint8.cc",
6474        "tile_functor_cpu_variant.cc",
6475        "tile_ops.cc",
6476        "tile_ops_cpu_impl_1.cc",
6477        "tile_ops_cpu_impl_2.cc",
6478        "tile_ops_cpu_impl_3.cc",
6479        "tile_ops_cpu_impl_4.cc",
6480        "tile_ops_cpu_impl_5.cc",
6481        "tile_ops_cpu_impl_6.cc",
6482        "tile_ops_cpu_impl_7.cc",
6483        "topk_op.cc",
6484        "training_op_helpers.cc",
6485        "training_ops.cc",
6486        "transpose_functor_cpu.cc",
6487        "transpose_op.cc",
6488        "unicode_ops.cc",
6489        "unique_op.cc",
6490        "where_op.cc",
6491        "xent_op.cc",
6492    ] + [
6493        "//tensorflow/core/kernels/boosted_trees:quantile_ops.cc",
6494        "//tensorflow/core/data:captured_function.cc",
6495        "//tensorflow/core/data:dataset_utils.cc",
6496        "//tensorflow/core/data:name_utils.cc",
6497        "//tensorflow/core/data:rewrite_utils.cc",
6498        "//tensorflow/core/data:root_dataset.cc",
6499        "//tensorflow/core/data:serialization_utils.cc",
6500        "//tensorflow/core/data:split_utils.cc",
6501        "//tensorflow/core/data:stats_utils.cc",
6502        "//tensorflow/core/data:unbounded_thread_pool.cc",
6503        "//tensorflow/core/kernels/data:batch_dataset_op.cc",
6504        "//tensorflow/core/kernels/data:iterator_ops.cc",
6505        "//tensorflow/core/kernels/data:finalize_dataset_op.cc",
6506        "//tensorflow/core/kernels/data:flat_map_dataset_op.cc",
6507        "//tensorflow/core/kernels/data:map_dataset_op.cc",
6508        "//tensorflow/core/kernels/data:model_dataset_op.cc",
6509        "//tensorflow/core/kernels/data:take_dataset_op.cc",
6510        "//tensorflow/core/kernels/data:optimize_dataset_op.cc",
6511        "//tensorflow/core/kernels/data:optional_ops.cc",
6512        "//tensorflow/core/kernels/data:reduce_dataset_op.cc",
6513        "//tensorflow/core/kernels/data:repeat_dataset_op.cc",
6514        "//tensorflow/core/kernels/data:tensor_slice_dataset_op.cc",
6515        # TODO(b/185903858): This should not be needed since this is part of tensorflow/core/kernels/data/experimental:portable_all_op_kernels.
6516        "//tensorflow/core/kernels/data/experimental:lookup_ops.cc",
6517        "//tensorflow/core/kernels/data/experimental:threadpool_dataset_op.cc",
6518        "//tensorflow/core/kernels/image:adjust_contrast_op.cc",
6519        "//tensorflow/core/kernels/image:adjust_hue_op.cc",
6520        "//tensorflow/core/kernels/image:adjust_saturation_op.cc",
6521        "//tensorflow/core/kernels/image:extract_image_patches_op.cc",
6522        "//tensorflow/core/kernels/image:image_ops.cc",
6523        "//tensorflow/core/kernels/image:mirror_pad_op.cc",
6524        "//tensorflow/core/kernels/image:mirror_pad_op_cpu_impl_1.cc",
6525        "//tensorflow/core/kernels/image:mirror_pad_op_cpu_impl_2.cc",
6526        "//tensorflow/core/kernels/image:mirror_pad_op_cpu_impl_3.cc",
6527        "//tensorflow/core/kernels/image:mirror_pad_op_cpu_impl_4.cc",
6528        "//tensorflow/core/kernels/image:mirror_pad_op_cpu_impl_5.cc",
6529        "//tensorflow/core/kernels/image:resize_bicubic_op.cc",
6530        "//tensorflow/core/kernels/image:resize_bilinear_op.cc",
6531        "//tensorflow/core/kernels/image:resize_nearest_neighbor_op.cc",
6532        "//tensorflow/core/kernels/image:sample_distorted_bounding_box_op.cc",
6533        "//tensorflow/core/kernels/linalg:cholesky_op.cc",
6534        "//tensorflow/core/kernels/linalg:determinant_op.cc",
6535        "//tensorflow/core/kernels/linalg:linalg_ops_common.cc",
6536        "//tensorflow/core/kernels/linalg:matrix_band_part_op.cc",
6537        "//tensorflow/core/kernels/linalg:matrix_diag_op.cc",
6538        "//tensorflow/core/kernels/linalg:matrix_inverse_op.cc",
6539        "//tensorflow/core/kernels/linalg:matrix_set_diag_op.cc",
6540        "//tensorflow/core/kernels/linalg:matrix_triangular_solve_op_complex.cc",
6541        "//tensorflow/core/kernels/linalg:matrix_triangular_solve_op_real.cc",
6542    ],
6543)
6544
6545filegroup(
6546    name = "portable_quantized_ops",
6547    srcs = [
6548        "dequantize_op.cc",
6549        "meta_support.cc",
6550        "meta_support.h",
6551        "quantization_utils.cc",
6552        "quantization_utils.h",
6553        "quantize_down_and_shrink_range.cc",
6554        "quantize_op.cc",
6555        "quantized_activation_ops.cc",
6556        "quantized_add_op.cc",
6557        "quantized_batch_norm_op.cc",
6558        "quantized_bias_add_op.cc",
6559        "quantized_concat_op.cc",
6560        "quantized_conv_ops.cc",
6561        "quantized_instance_norm.cc",
6562        "quantized_matmul_op.cc",
6563        "quantized_mul_op.cc",
6564        "quantized_pooling_ops.cc",
6565        "quantized_reshape_op.cc",
6566        "quantized_resize_bilinear_op.cc",
6567        "reference_gemm.h",
6568        "requantization_range_op.cc",
6569        "requantize.cc",
6570        "reshape_op.h",
6571    ],
6572    visibility = ["//visibility:public"],
6573)
6574
6575ANDROID_TEXTUAL_HDRS = [
6576    "eigen_convolution_helpers.h",
6577    "eigen_spatial_convolutions-inl.h",
6578    "gather_nd_op_cpu_impl.h",
6579    "gemm_functors.h",
6580    "scatter_nd_op_cpu_impl.h",
6581    "slice_op_cpu_impl.h",
6582    "strided_slice_op_impl.h",
6583    "tile_ops_cpu_impl.h",
6584]
6585
6586# A file group which contains nearly all available operators which
6587# may work on mobile environment. This is intended to be used with selective
6588# registration.
6589filegroup(
6590    name = "portable_all_ops",
6591    srcs = [
6592        "//tensorflow/c/kernels:portable_all_op_kernels",
6593        "//tensorflow/core/kernels/data:portable_all_op_kernels",
6594        "//tensorflow/core/kernels/image:portable_all_op_kernels",
6595        "//tensorflow/core/kernels/linalg:portable_all_op_kernels",
6596    ] + glob(
6597        [
6598            "*.cc",
6599            "*.h",
6600        ],
6601        exclude = [
6602            "*test.cc",
6603            "*test_util*",
6604            "*testutil*",
6605            "*testlib*",
6606            "*main.cc",
6607            "*_gpu*",
6608            "*_3d*",
6609            "*.cu.*",
6610            # Helper files for tests
6611            "eigen_benchmark.h",
6612            # Ops already in android_srcs
6613            "pooling_ops_common.cc",
6614            # Ops which we are currently excluding because they are likely
6615            # not used on Android. Those ops also do not compile if included,
6616            # unless we add the additional deps they need.
6617            "tf_record_reader_op.*",
6618            "cudnn_rnn_ops.*",
6619            "lmdb_reader_op.*",
6620            "string_to_hash_bucket_op.*",
6621            "sdca_ops.*",
6622            "sdca_internal.*",
6623            "sparse_cross_op.*",
6624            "text_line_reader_op.*",
6625            "summary_image_op.*",
6626            "identity_reader_op.*",
6627            "fixed_length_record_reader_op.*",
6628            "sample_distorted_bounding_box_op.*",
6629            "ctc_loss_op.*",
6630            "summary_interface.*",
6631            "summary_kernels.*",
6632            "spectrogram_convert_test_data.cc",
6633            "decode_proto_op.cc",
6634            "encode_proto_op.cc",
6635            "sobol_op.cc",
6636            # Excluded due to experimental status:
6637            "debug_ops.*",
6638            "mutex_ops.*",
6639            "batch_kernels.*",
6640            "regex_replace_op.cc",
6641            "string_lower_op.cc",  # Requires ICU for unicode.
6642            "string_upper_op.cc",  # Requires ICU for unicode.
6643            "unicode_ops.cc",
6644            "unicode_script_op.cc",
6645            # Ops that are inherently incompatible with Android (e.g. tied to x86 platform).
6646            "xsmm_*",
6647            "nextafter_op.cc",
6648        ] + ANDROID_TEXTUAL_HDRS,
6649    ) + [
6650        # Referenced by stateful_random_ops.cc but excluded with the *gpu*
6651        # rule above. Seems to have only have worked before because of
6652        # hdrs_check loose.
6653        "stateful_random_ops_cpu_gpu.h",
6654        # Allows conv_3d ops for android but excluded from *_3d* rule above.
6655        "conv_3d.h",
6656        "conv_ops_3d.cc",
6657        "conv_ops_gpu.h",
6658    ],
6659    visibility = ["//visibility:public"],
6660)
6661
6662alias(
6663    name = "android_all_ops",
6664    actual = ":portable_all_ops",
6665)
6666
6667filegroup(
6668    name = "portable_all_ops_textual_hdrs",
6669    srcs = ANDROID_TEXTUAL_HDRS + [
6670        "//tensorflow/core/kernels/image:portable_all_ops_textual_hdrs",
6671        "//tensorflow/core/util:image_resizer_state.h",
6672    ],
6673    visibility = ["//visibility:public"],
6674)
6675
6676alias(
6677    name = "android_all_ops_textual_hdrs",
6678    actual = "portable_all_ops_textual_hdrs",
6679)
6680
6681cc_library(
6682    name = "portable_tensorflow_kernels",
6683    srcs = if_mobile([
6684        "//tensorflow/core/kernels:portable_core_ops",
6685        "//tensorflow/core/kernels:portable_extended_ops",
6686    ]),
6687    copts = tf_copts() + tf_opts_nortti_if_lite_protos(),
6688    linkopts = if_android(["-ldl"]),
6689    tags = [
6690        "manual",
6691        "notap",
6692    ],
6693    # These headers are not self-contained, so should be included in textual_hdrs only.
6694    textual_hdrs = ANDROID_TEXTUAL_HDRS,
6695    visibility = ["//visibility:public"],
6696    deps = [
6697        "//tensorflow/core:portable_gif_internal",
6698        "//tensorflow/core:portable_jpeg_internal",
6699        "//tensorflow/core:portable_tensorflow_lib_lite",
6700        "//tensorflow/core:protos_all_cc_impl",
6701        "//tensorflow/core/lib/png:png_io",
6702        "//tensorflow/core/platform:strong_hash",
6703        "//third_party/eigen3",
6704        "//third_party/fft2d:fft2d_headers",
6705        "//third_party/icu/data:conversion_data",
6706        "@com_google_absl//absl/base",
6707        "@com_google_protobuf//:protobuf",
6708        "@fft2d",
6709        "@gemmlowp",
6710        "@icu//:common",
6711    ],
6712    alwayslink = 1,
6713)
6714
6715build_test(
6716    name = "portable_tensorflow_kernels_build_test",
6717    targets = [":portable_tensorflow_kernels"],
6718)
6719
6720cc_library(
6721    name = "android_whole_file_read_ops",
6722    srcs = if_android(["whole_file_read_ops.cc"]),
6723    copts = tf_copts(),
6724    linkopts = ["-ldl"],
6725    visibility = ["//visibility:public"],
6726    deps = [
6727        "//tensorflow/core:portable_tensorflow_lib_lite",
6728    ],
6729    alwayslink = 1,
6730)
6731
6732#   Quantization-specific OpKernels
6733
6734tf_kernel_library(
6735    name = "quantized_ops",
6736    srcs = [
6737        "dequantize_op.cc",
6738        "quantize_down_and_shrink_range.cc",
6739        "quantize_op.cc",
6740        "quantized_activation_ops.cc",
6741        "quantized_add_op.cc",
6742        "quantized_batch_norm_op.cc",
6743        "quantized_bias_add_op.cc",
6744        "quantized_concat_op.cc",
6745        "quantized_conv_ops.cc",
6746        "quantized_instance_norm.cc",
6747        "quantized_matmul_op.cc",
6748        "quantized_mul_op.cc",
6749        "quantized_pooling_ops.cc",
6750        "quantized_reshape_op.cc",
6751        "quantized_resize_bilinear_op.cc",
6752        "requantization_range_op.cc",
6753        "requantize.cc",
6754        "reshape_op.h",
6755    ],
6756    hdrs = ["reference_gemm.h"],
6757    deps = [
6758        ":concat_lib_hdrs",
6759        ":conv_ops",
6760        ":cwise_op",
6761        ":eigen_helpers",
6762        ":meta_support",
6763        ":ops_util",
6764        ":pooling_ops",
6765        ":quantization_utils",
6766        "//tensorflow/core:core_cpu",
6767        "//tensorflow/core:framework",
6768        "//tensorflow/core:lib",
6769        "//tensorflow/core/util:determinism_for_kernels",
6770        "//tensorflow/core/util:image_resizer_state",
6771        "//third_party/eigen3",
6772        "@gemmlowp",
6773    ],
6774)
6775
6776tf_cc_test(
6777    name = "requantization_range_op_test",
6778    size = "small",
6779    srcs = ["requantization_range_op_test.cc"],
6780    deps = [
6781        ":ops_testutil",
6782        ":ops_util",
6783        ":quantized_ops",
6784        "//tensorflow/core:framework",
6785        "//tensorflow/core:protos_all_cc",
6786        "//tensorflow/core:test",
6787        "//tensorflow/core:test_main",
6788        "//tensorflow/core:testlib",
6789    ],
6790)
6791
6792tf_cc_test(
6793    name = "quantize_down_and_shrink_range_op_test",
6794    size = "small",
6795    srcs = ["quantize_down_and_shrink_range_op_test.cc"],
6796    deps = [
6797        ":ops_testutil",
6798        ":ops_util",
6799        ":quantized_ops",
6800        "//tensorflow/core:framework",
6801        "//tensorflow/core:protos_all_cc",
6802        "//tensorflow/core:test",
6803        "//tensorflow/core:test_main",
6804        "//tensorflow/core:testlib",
6805    ],
6806)
6807
6808tf_cc_test(
6809    name = "requantize_op_test",
6810    size = "small",
6811    srcs = ["requantize_op_test.cc"],
6812    deps = [
6813        ":ops_testutil",
6814        ":ops_util",
6815        ":quantized_ops",
6816        "//tensorflow/core:framework",
6817        "//tensorflow/core:protos_all_cc",
6818        "//tensorflow/core:test",
6819        "//tensorflow/core:test_main",
6820        "//tensorflow/core:testlib",
6821    ],
6822)
6823
6824tf_cc_test(
6825    name = "quantization_utils_test",
6826    srcs = ["quantization_utils_test.cc"],
6827    deps = [
6828        ":quantization_utils",
6829        ":quantized_ops",
6830        "//tensorflow/core:array_ops_op_lib",
6831        "//tensorflow/core:core_cpu",
6832        "//tensorflow/core:core_cpu_internal",
6833        "//tensorflow/core:framework",
6834        "//tensorflow/core:lib",
6835        "//tensorflow/core:math_ops_op_lib",
6836        "//tensorflow/core:nn_ops_op_lib",
6837        "//tensorflow/core:protos_all_cc",
6838        "//tensorflow/core:test",
6839        "//tensorflow/core:testlib",
6840        "//third_party/eigen3",
6841    ],
6842)
6843
6844# Android-only test for quantization utilities.
6845tf_cc_binary(
6846    name = "quantization_utils_test_android_only",
6847    testonly = 1,
6848    srcs = ["quantization_utils_test.cc"],
6849    copts = tf_copts(),
6850    linkopts = select({
6851        "//tensorflow:android": [
6852            "-lm",
6853            "-llog",
6854            "-pie",
6855        ],
6856        "//conditions:default": [],
6857    }),
6858    linkstatic = 1,
6859    tags = [
6860        "manual",
6861        "notap",
6862    ],
6863    deps = [
6864    ] + select({
6865        "//tensorflow:android": [
6866            ":portable_tensorflow_kernels",
6867            "//tensorflow/core:portable_tensorflow_lib",
6868            "//tensorflow/core:portable_tensorflow_test_lib",
6869        ],
6870        "//conditions:default": [
6871            ":quantized_ops",
6872            "//third_party/eigen3",
6873            "//tensorflow/core:core_cpu_internal",
6874            "//tensorflow/core:lib",
6875            "//tensorflow/core:test",
6876            "//tensorflow/cc:cc_ops",
6877            "//tensorflow/cc:client_session",
6878            "//tensorflow/core:framework",
6879            "//tensorflow/core/framework:tensor_testutil",
6880        ],
6881    }),
6882)
6883
6884tf_cc_test(
6885    name = "quantized_activation_ops_test",
6886    srcs = ["quantized_activation_ops_test.cc"],
6887    deps = [
6888        ":ops_testutil",
6889        ":ops_util",
6890        ":quantization_utils",
6891        ":quantized_ops",
6892        "//tensorflow/core:array_ops_op_lib",
6893        "//tensorflow/core:framework",
6894        "//tensorflow/core:math_ops_op_lib",
6895        "//tensorflow/core:nn_ops_op_lib",
6896        "//tensorflow/core:protos_all_cc",
6897        "//tensorflow/core:test",
6898        "//tensorflow/core:test_main",
6899        "//tensorflow/core:testlib",
6900    ],
6901)
6902
6903# Android-only test for quantized addition.
6904cc_binary(
6905    name = "quantized_add_op_test_android_only",
6906    testonly = 1,
6907    srcs = ["quantized_add_op_test.cc"],
6908    copts = tf_copts(),
6909    linkopts = select({
6910        "//tensorflow:android": [
6911            "-lm",
6912            "-llog",
6913            "-pie",
6914        ],
6915        "//conditions:default": [],
6916    }),
6917    linkstatic = 1,
6918    tags = [
6919        "manual",
6920        "notap",
6921    ],
6922    deps = [
6923        "//tensorflow/cc:cc_ops",
6924        "//tensorflow/cc:client_session",
6925    ] + select({
6926        "//tensorflow:android": [
6927            ":portable_tensorflow_kernels",
6928            "//tensorflow/core:portable_tensorflow_lib",
6929            "//tensorflow/core:portable_tensorflow_test_lib",
6930        ],
6931        "//conditions:default": [
6932            ":ops_util",
6933            ":quantized_ops",
6934            "//tensorflow/core:framework",
6935            "//tensorflow/core:protos_all_cc",
6936            "//tensorflow/core/framework:tensor_testutil",
6937            "//tensorflow/core:tensorflow",
6938            "//tensorflow/core:test",
6939        ],
6940    }),
6941)
6942
6943tf_cc_test(
6944    name = "quantized_add_op_test",
6945    size = "small",
6946    srcs = ["quantized_add_op_test.cc"],
6947    deps = [
6948        ":math",
6949        ":ops_testutil",
6950        ":ops_util",
6951        ":quantization_utils",
6952        ":quantized_ops",
6953        "//tensorflow/cc:cc_ops",
6954        "//tensorflow/cc:client_session",
6955        "//tensorflow/core:array_ops_op_lib",
6956        "//tensorflow/core:core_cpu",
6957        "//tensorflow/core:direct_session",
6958        "//tensorflow/core:framework",
6959        "//tensorflow/core:math_ops_op_lib",
6960        "//tensorflow/core:nn_ops_op_lib",
6961        "//tensorflow/core:protos_all_cc",
6962        "//tensorflow/core:test",
6963        "//tensorflow/core:testlib",
6964    ],
6965)
6966
6967tf_cc_test(
6968    name = "quantized_resize_bilinear_op_test",
6969    size = "small",
6970    srcs = ["quantized_resize_bilinear_op_test.cc"],
6971    deps = [
6972        ":ops_testutil",
6973        ":ops_util",
6974        ":quantization_utils",
6975        ":quantized_ops",
6976        "//tensorflow/cc:cc_ops",
6977        "//tensorflow/cc:client_session",
6978        "//tensorflow/core:core_cpu",
6979        "//tensorflow/core:direct_session",
6980        "//tensorflow/core:framework",
6981        "//tensorflow/core:image_ops_op_lib",
6982        "//tensorflow/core:protos_all_cc",
6983        "//tensorflow/core:test",
6984        "//tensorflow/core:testlib",
6985    ],
6986)
6987
6988# Android-only test for quantized resize bilinear.
6989cc_binary(
6990    name = "quantized_resize_bilinear_op_test_android_only",
6991    testonly = 1,
6992    srcs = ["quantized_resize_bilinear_op_test.cc"],
6993    copts = tf_copts(),
6994    linkopts = select({
6995        "//tensorflow:android": [
6996            "-lm",
6997            "-llog",
6998            "-pie",
6999        ],
7000        "//conditions:default": [],
7001    }),
7002    linkstatic = 1,
7003    tags = [
7004        "manual",
7005        "notap",
7006    ],
7007    deps = [
7008        "//tensorflow/cc:cc_ops",
7009        "//tensorflow/cc:client_session",
7010    ] + select({
7011        "//tensorflow:android": [
7012            ":portable_tensorflow_kernels",
7013            "//tensorflow/core:portable_tensorflow_lib",
7014            "//tensorflow/core:portable_tensorflow_test_lib",
7015        ],
7016        "//conditions:default": [
7017            ":ops_testutil",
7018            ":ops_util",
7019            ":quantized_ops",
7020            "//tensorflow/core:core_cpu",
7021            "//tensorflow/core:direct_session",
7022            "//tensorflow/core:framework",
7023            "//tensorflow/core:image_ops_op_lib",
7024            "//tensorflow/core:protos_all_cc",
7025            "//tensorflow/core:test",
7026            "//tensorflow/core:testlib",
7027        ],
7028    }),
7029)
7030
7031tf_cc_test(
7032    name = "quantized_bias_add_op_test",
7033    size = "small",
7034    srcs = ["quantized_bias_add_op_test.cc"],
7035    deps = [
7036        ":ops_testutil",
7037        ":ops_util",
7038        ":quantization_utils",
7039        ":quantized_ops",
7040        "//tensorflow/core:array_ops_op_lib",
7041        "//tensorflow/core:framework",
7042        "//tensorflow/core:math_ops_op_lib",
7043        "//tensorflow/core:nn_ops_op_lib",
7044        "//tensorflow/core:protos_all_cc",
7045        "//tensorflow/core:test",
7046        "//tensorflow/core:test_main",
7047        "//tensorflow/core:testlib",
7048    ],
7049)
7050
7051tf_cc_test(
7052    name = "quantized_conv_ops_test",
7053    size = "small",
7054    srcs = ["quantized_conv_ops_test.cc"],
7055    tags = ["nomsan"],  # http://b/32242946
7056    deps = [
7057        ":ops_testutil",
7058        ":ops_util",
7059        ":quantization_utils",
7060        ":quantized_ops",
7061        "//tensorflow/core:array_ops_op_lib",
7062        "//tensorflow/core:framework",
7063        "//tensorflow/core:math_ops_op_lib",
7064        "//tensorflow/core:nn_ops_op_lib",
7065        "//tensorflow/core:protos_all_cc",
7066        "//tensorflow/core:test",
7067        "//tensorflow/core:test_main",
7068        "//tensorflow/core:testlib",
7069    ],
7070)
7071
7072tf_cc_test(
7073    name = "quantize_op_test",
7074    size = "small",
7075    srcs = ["quantize_op_test.cc"],
7076    deps = [
7077        ":ops_testutil",
7078        ":ops_util",
7079        ":quantized_ops",
7080        "//tensorflow/core:array_ops_op_lib",
7081        "//tensorflow/core:framework",
7082        "//tensorflow/core:math_ops_op_lib",
7083        "//tensorflow/core:nn_ops_op_lib",
7084        "//tensorflow/core:protos_all_cc",
7085        "//tensorflow/core:test",
7086        "//tensorflow/core:test_main",
7087        "//tensorflow/core:testlib",
7088    ],
7089)
7090
7091tf_cc_test(
7092    name = "quantized_matmul_op_test",
7093    size = "small",
7094    srcs = ["quantized_matmul_op_test.cc"],
7095    tags = ["nomsan"],  # http://b/32242946
7096    deps = [
7097        ":ops_testutil",
7098        ":ops_util",
7099        ":quantization_utils",
7100        ":quantized_ops",
7101        "//tensorflow/core:array_ops_op_lib",
7102        "//tensorflow/core:framework",
7103        "//tensorflow/core:math_ops_op_lib",
7104        "//tensorflow/core:nn_ops_op_lib",
7105        "//tensorflow/core:protos_all_cc",
7106        "//tensorflow/core:test",
7107        "//tensorflow/core:test_main",
7108        "//tensorflow/core:testlib",
7109    ],
7110)
7111
7112# Android-only test for quantized multiply.
7113cc_binary(
7114    name = "quantized_mul_op_test_android_only",
7115    testonly = 1,
7116    srcs = ["quantized_mul_op_test.cc"],
7117    linkopts = select({
7118        "//tensorflow:android": [
7119            "-pie",
7120        ],
7121        "//conditions:default": [],
7122    }),
7123    linkstatic = 1,
7124    tags = [
7125        "manual",
7126        "notap",
7127    ],
7128    deps = [
7129        "//tensorflow/cc:cc_ops",
7130        "//tensorflow/cc:client_session",
7131    ] + select({
7132        "//tensorflow:android": [
7133            ":portable_tensorflow_kernels",
7134            "//tensorflow/core:portable_tensorflow_lib",
7135            "//tensorflow/core:portable_tensorflow_test_lib",
7136        ],
7137        "//conditions:default": [
7138            ":ops_util",
7139            ":quantized_ops",
7140            "//tensorflow/core:framework",
7141            "//tensorflow/core/framework:tensor_testutil",
7142            "//tensorflow/core:protos_all_cc",
7143            "//tensorflow/core:test",
7144        ],
7145    }),
7146)
7147
7148tf_cc_test(
7149    name = "quantized_mul_op_test",
7150    size = "small",
7151    srcs = ["quantized_mul_op_test.cc"],
7152    deps = [
7153        ":math",
7154        ":ops_testutil",
7155        ":ops_util",
7156        ":quantization_utils",
7157        ":quantized_ops",
7158        "//tensorflow/cc:cc_ops",
7159        "//tensorflow/cc:client_session",
7160        "//tensorflow/core:array_ops_op_lib",
7161        "//tensorflow/core:core_cpu",
7162        "//tensorflow/core:direct_session",
7163        "//tensorflow/core:framework",
7164        "//tensorflow/core:math_ops_op_lib",
7165        "//tensorflow/core:nn_ops_op_lib",
7166        "//tensorflow/core:protos_all_cc",
7167        "//tensorflow/core:test",
7168        "//tensorflow/core:testlib",
7169    ],
7170)
7171
7172tf_cc_test(
7173    name = "quantized_pooling_ops_test",
7174    size = "small",
7175    srcs = ["quantized_pooling_ops_test.cc"],
7176    deps = [
7177        ":ops_testutil",
7178        ":ops_util",
7179        ":quantization_utils",
7180        ":quantized_ops",
7181        "//tensorflow/core:array_ops_op_lib",
7182        "//tensorflow/core:framework",
7183        "//tensorflow/core:math_ops_op_lib",
7184        "//tensorflow/core:nn_ops_op_lib",
7185        "//tensorflow/core:protos_all_cc",
7186        "//tensorflow/core:test",
7187        "//tensorflow/core:test_main",
7188        "//tensorflow/core:testlib",
7189    ],
7190)
7191
7192tf_cc_test(
7193    name = "quantized_reshape_op_test",
7194    size = "small",
7195    srcs = ["quantized_reshape_op_test.cc"],
7196    deps = [
7197        ":ops_testutil",
7198        ":ops_util",
7199        ":quantized_ops",
7200        "//tensorflow/core:framework",
7201        "//tensorflow/core:lib",
7202        "//tensorflow/core:protos_all_cc",
7203        "//tensorflow/core:test",
7204        "//tensorflow/core:test_main",
7205        "//tensorflow/core:testlib",
7206    ],
7207)
7208
7209tf_cc_test(
7210    name = "quantized_concat_op_test",
7211    size = "small",
7212    srcs = ["quantized_concat_op_test.cc"],
7213    deps = [
7214        ":ops_testutil",
7215        ":ops_util",
7216        ":quantization_utils",
7217        ":quantized_ops",
7218        "//tensorflow/core:array_ops_op_lib",
7219        "//tensorflow/core:core_cpu",
7220        "//tensorflow/core:framework",
7221        "//tensorflow/core:lib",
7222        "//tensorflow/core:math_ops_op_lib",
7223        "//tensorflow/core:nn_ops_op_lib",
7224        "//tensorflow/core:protos_all_cc",
7225        "//tensorflow/core:test",
7226        "//tensorflow/core:test_main",
7227        "//tensorflow/core:testlib",
7228    ],
7229)
7230
7231tf_cc_test(
7232    name = "quantized_batch_norm_op_test",
7233    size = "small",
7234    srcs = ["quantized_batch_norm_op_test.cc"],
7235    deps = [
7236        ":batch_norm_op",
7237        ":ops_testutil",
7238        ":quantization_utils",
7239        ":quantized_ops",
7240        "//tensorflow/core:array_ops_op_lib",
7241        "//tensorflow/core:core_cpu_internal",
7242        "//tensorflow/core:framework",
7243        "//tensorflow/core:lib",
7244        "//tensorflow/core:math_ops_op_lib",
7245        "//tensorflow/core:nn_ops_op_lib",
7246        "//tensorflow/core:protos_all_cc",
7247        "//tensorflow/core:test",
7248        "//tensorflow/core:test_main",
7249        "//tensorflow/core:testlib",
7250        "//third_party/eigen3",
7251    ],
7252)
7253
7254# Android-only test for quantized instance norm.
7255cc_binary(
7256    name = "quantized_instance_norm_test_android_only",
7257    testonly = 1,
7258    srcs = ["quantized_instance_norm_test.cc"],
7259    linkopts = select({
7260        "//tensorflow:android": [
7261            "-pie",
7262        ],
7263        "//conditions:default": [],
7264    }),
7265    linkstatic = 1,
7266    tags = [
7267        "manual",
7268        "notap",
7269    ],
7270    deps = [
7271        "//tensorflow/cc:cc_ops",
7272        "//tensorflow/cc:client_session",
7273    ] + select({
7274        "//tensorflow:android": [
7275            ":portable_tensorflow_kernels",
7276            "//tensorflow/core:portable_tensorflow_lib",
7277            "//tensorflow/core:portable_tensorflow_test_lib",
7278        ],
7279        "//conditions:default": [
7280            "//tensorflow/core:framework",
7281            "//tensorflow/core/framework:tensor_testutil",
7282        ],
7283    }),
7284)
7285
7286tf_cc_test(
7287    name = "quantized_instance_norm_test",
7288    size = "small",
7289    srcs = ["quantized_instance_norm_test.cc"],
7290    deps = [
7291        ":ops_testutil",
7292        ":ops_util",
7293        ":quantized_ops",
7294        "//tensorflow/cc:cc_ops",
7295        "//tensorflow/cc:client_session",
7296        "//tensorflow/core:core_cpu",
7297        "//tensorflow/core:direct_session",
7298        "//tensorflow/core:framework",
7299        "//tensorflow/core:lib",
7300        "//tensorflow/core:protos_all_cc",
7301        "//tensorflow/core:test",
7302        "//tensorflow/core:testlib",
7303    ],
7304)
7305
7306cc_library(
7307    name = "quantization_utils",
7308    srcs = ["quantization_utils.cc"],
7309    hdrs = ["quantization_utils.h"],
7310    deps = [
7311        "//tensorflow/core:framework",
7312        "@gemmlowp",
7313    ],
7314)
7315
7316tf_cc_test(
7317    name = "bias_op_test",
7318    size = "small",
7319    srcs = ["bias_op_test.cc"],
7320    deps = [
7321        ":bias_op",
7322        "//tensorflow/core:framework",
7323        "//tensorflow/core:lib",
7324        "//tensorflow/core:test",
7325        "//tensorflow/core:test_main",
7326        "//tensorflow/core:testlib",
7327    ],
7328)
7329
7330# NOTE(lespeholt): This rule is deprecated, please use:
7331# tensorflow/core/util/batch_util.h
7332cc_library(
7333    name = "batch_util",
7334    hdrs = ["batch_util.h"],
7335    deps = [
7336        "//tensorflow/core:framework",
7337        "//tensorflow/core:lib",
7338    ],
7339)
7340
7341tf_kernel_library(
7342    name = "boosted_trees_ops",
7343    deps = [
7344        "//tensorflow/core/kernels/boosted_trees:boosted_trees_ops",
7345    ],
7346)
7347
7348tf_kernel_library(
7349    name = "data_service_ops",
7350    deps = [
7351        "//tensorflow/core/kernels/data/experimental:data_service_kernels",
7352    ],
7353)
7354
7355tf_kernel_library(
7356    name = "dataset_ops",
7357    deps = [
7358        "//tensorflow/core/kernels/data",
7359    ],
7360)
7361
7362cc_library(
7363    name = "summary_interface",
7364    hdrs = ["summary_interface.h"],
7365    deps = [
7366        "//tensorflow/core:framework",
7367        "//tensorflow/core:lib",
7368        "//tensorflow/core:protos_all_cc",
7369    ],
7370)
7371
7372tf_kernel_library(
7373    name = "summary_kernels",
7374    srcs = ["summary_kernels.cc"],
7375    deps = [
7376        "//tensorflow/core:framework",
7377        "//tensorflow/core:lib",
7378        "//tensorflow/core:lib_internal",
7379        "//tensorflow/core:protos_all_cc",
7380        "//tensorflow/core/lib/db:sqlite",
7381        "//tensorflow/core/summary:schema",
7382        "//tensorflow/core/summary:summary_db_writer",
7383        "//tensorflow/core/summary:summary_file_writer",
7384    ],
7385)
7386
7387tf_kernel_library(
7388    name = "decode_proto_op",
7389    srcs = [
7390        "decode_proto_op.cc",
7391    ],
7392    deps = [
7393        "//tensorflow/core:framework",
7394        "//tensorflow/core:lib",
7395        "//tensorflow/core/util/proto:decode",
7396        "//tensorflow/core/util/proto:descriptors",
7397        "//tensorflow/core/util/proto:proto_utils",
7398        "//third_party/eigen3",
7399        "@com_google_absl//absl/container:flat_hash_map",
7400        "@com_google_absl//absl/types:span",
7401    ],
7402)
7403
7404tf_kernel_library(
7405    name = "encode_proto_op",
7406    srcs = ["encode_proto_op.cc"],
7407    deps = [
7408        "//tensorflow/core:framework",
7409        "//tensorflow/core:lib",
7410        "//tensorflow/core/util/proto:descriptors",
7411        "//tensorflow/core/util/proto:proto_utils",
7412        "//third_party/eigen3",
7413    ],
7414)
7415
7416tf_kernel_library(
7417    name = "unicode_script_op",
7418    srcs = ["unicode_script_op.cc"],
7419    deps = [
7420        "//tensorflow/core:framework",
7421        "@icu//:common",
7422    ],
7423)
7424
7425# Library to link with when compiling the cwise_op kernels directly,
7426# e.g. for selective registration.
7427# should not be linked by projects that also link the cwise_op library.
7428cc_library(
7429    name = "cwise_lib",
7430    srcs = ["cwise_ops_common.cc"],
7431    hdrs = [
7432        "cwise_ops.h",
7433        "cwise_ops_common.h",
7434        "cwise_ops_gpu_common.cu.h",
7435        "cwise_ops_gpu_gradients.cu.h",
7436        "cwise_ops_gradients.h",
7437        "fill_functor.h",
7438    ],
7439    deps = [
7440        ":meta_support",
7441        ":quantization_utils",
7442        "//tensorflow/core:framework",
7443        "//tensorflow/core:lib",
7444        "//tensorflow/core/framework:bounds_check",
7445        "//third_party/eigen3",
7446        "@gemmlowp",
7447    ],
7448)
7449
7450# Header-only version of cwise_lib for clients that want to use the cwise_ops
7451# functionality in their own custom ops.
7452cc_header_only_library(
7453    name = "cwise_lib_hdrs",
7454    deps = [
7455        ":cwise_lib",
7456    ],
7457)
7458
7459# Library to link with when compiling the quantize and dequantize kernels directly,
7460# e.g. for selective registration.
7461cc_header_only_library(
7462    name = "quantize_and_dequantize_op_hdrs",
7463    deps = [
7464        ":quantize_and_dequantize_op",
7465    ],
7466)
7467
7468cc_library(
7469    name = "kernel_platform_strings",
7470    srcs = ["kernel_platform_strings.h"],
7471    deps = [
7472        "//tensorflow/core/platform:platform_strings",
7473    ],
7474    alwayslink = 1,
7475)
7476
7477# Shared object that links all the kernels TF needs.
7478tf_cc_shared_object(
7479    name = "libtfkernel_all_kernels.so",
7480    visibility = ["//visibility:public"],
7481    deps = [
7482        ":kernel_platform_strings",
7483        "//tensorflow/core:all_kernels_impl",
7484    ],
7485)
7486
7487# Manually curated set of tests that are useful for building and testing against
7488# platforms and architecures that don't support CUDA.
7489# TODO(b/153737462): Automatically filter tests to create the appropriate
7490# portable test list.
7491test_suite(
7492    name = "portable_kernel_tests",
7493    tags = [
7494        "manual",  # Avoid redundancy when using wildcard test patterns.
7495    ],
7496    tests = [
7497        ":batch_norm_op_test",
7498        ":broadcast_to_op_test",
7499        ":cast_op_test",
7500        ":concat_op_test",
7501        ":control_flow_ops_test",
7502        ":cwise_ops_test",
7503        ":deep_conv2d_test",
7504        ":dequantize_op_test",
7505        ":diag_op_test",
7506        ":eigen_activations_test",
7507        ":eigen_pooling_test",
7508        ":eigen_spatial_convolutions_test",
7509        ":gather_nd_op_test",
7510        ":matmul_op_test",
7511        ":mfcc_test",
7512        ":multinomial_op_test",
7513        ":nn_ops_test",
7514        ":quantization_utils_test",
7515        ":quantize_and_dequantize_op_test",
7516        ":quantize_op_test",
7517        ":quantized_activation_ops_test",
7518        ":quantized_batch_norm_op_test",
7519        ":quantized_conv_ops_test",
7520        ":quantized_matmul_op_test",
7521        ":quantized_pooling_ops_test",
7522        ":random_binomial_op_test",
7523        ":random_op_test",
7524        ":random_poisson_op_test",
7525        ":reduction_ops_test",
7526        ":requantization_range_op_test",
7527        ":scatter_op_test",
7528        ":segment_reduction_ops_test",
7529        ":slice_op_test",
7530        ":spectrogram_test",
7531        ":split_op_test",
7532        ":split_v_op_test",
7533        ":strided_slice_op_test",
7534        ":unique_op_test",
7535        ":variable_ops_test",
7536        "//tensorflow/core/kernels/image:crop_and_resize_op_test",
7537        "//tensorflow/core/kernels/image:non_max_suppression_op_test",
7538        "//tensorflow/core/kernels/image:resize_ops_test",
7539    ],
7540)
7541
7542exports_files([
7543    "cwise_op_abs.cc",
7544    "cwise_op_add_1.cc",
7545    "cwise_op_add_2.cc",
7546    "cwise_op_atan2.cc",
7547    "cwise_op_ceil.cc",
7548    "cwise_op_cos.cc",
7549    "cwise_op_div.cc",
7550    "cwise_op_equal_to_1.cc",
7551    "cwise_op_equal_to_2.cc",
7552    "cwise_op_exp.cc",
7553    "cwise_op_floor.cc",
7554    "cwise_op_floor_div.cc",
7555    "cwise_op_floor_mod.cc",
7556    "cwise_op_gpu_add.cu.cc",
7557    "cwise_op_gpu_atan2.cu.cc",
7558    "cwise_op_gpu_ceil.cu.cc",
7559    "cwise_op_gpu_cos.cu.cc",
7560    "cwise_op_gpu_div.cu.cc",
7561    "cwise_op_gpu_equal_to.cu.cc",
7562    "cwise_op_gpu_exp.cu.cc",
7563    "cwise_op_gpu_floor.cu.cc",
7564    "cwise_op_gpu_floor_div.cu.cc",
7565    "cwise_op_gpu_greater.cu.cc",
7566    "cwise_op_gpu_greater_equal.cu.cc",
7567    "cwise_op_gpu_isinf.cu.cc",
7568    "cwise_op_gpu_less.cu.cc",
7569    "cwise_op_gpu_less_equal.cu.cc",
7570    "cwise_op_gpu_log.cu.cc",
7571    "cwise_op_gpu_logical_and.cu.cc",
7572    "cwise_op_gpu_logical_not.cu.cc",
7573    "cwise_op_gpu_logical_or.cu.cc",
7574    "cwise_op_gpu_maximum.cu.cc",
7575    "cwise_op_gpu_minimum.cu.cc",
7576    "cwise_op_gpu_mod.cu.cc",
7577    "cwise_op_gpu_mul.cu.cc",
7578    "cwise_op_gpu_neg.cu.cc",
7579    "cwise_op_gpu_not_equal_to.cu.cc",
7580    "cwise_op_gpu_pow.cu.cc",
7581    "cwise_op_gpu_round.cu.cc",
7582    "cwise_op_gpu_rsqrt.cu.cc",
7583    "cwise_op_gpu_select.cu.cc",
7584    "cwise_op_gpu_sigmoid.cu.cc",
7585    "cwise_op_gpu_sin.cu.cc",
7586    "cwise_op_gpu_sqrt.cu.cc",
7587    "cwise_op_gpu_square.cu.cc",
7588    "cwise_op_gpu_squared_difference.cu.cc",
7589    "cwise_op_gpu_sub.cu.cc",
7590    "cwise_op_gpu_tanh.cu.cc",
7591    "cwise_op_greater.cc",
7592    "cwise_op_greater_equal.cc",
7593    "cwise_op_isinf.cc",
7594    "cwise_op_less.cc",
7595    "cwise_op_less_equal.cc",
7596    "cwise_op_log.cc",
7597    "cwise_op_logical_and.cc",
7598    "cwise_op_logical_not.cc",
7599    "cwise_op_logical_or.cc",
7600    "cwise_op_maximum.cc",
7601    "cwise_op_minimum.cc",
7602    "cwise_op_mod.cc",
7603    "cwise_op_mul_1.cc",
7604    "cwise_op_mul_2.cc",
7605    "cwise_op_neg_1.cc",
7606    "cwise_op_neg_2.cc",
7607    "cwise_op_not_equal_to_1.cc",
7608    "cwise_op_not_equal_to_2.cc",
7609    "cwise_op_pow.cc",
7610    "cwise_op_round.cc",
7611    "cwise_op_rsqrt.cc",
7612    "cwise_op_select.cc",
7613    "cwise_op_sigmoid.cc",
7614    "cwise_op_sin.cc",
7615    "cwise_op_sign.cc",
7616    "cwise_op_sqrt.cc",
7617    "cwise_op_square.cc",
7618    "cwise_op_squared_difference.cc",
7619    "cwise_op_sub.cc",
7620    "cwise_op_tanh.cc",
7621    "dequantize_op.cc",
7622    "ops_testutil.h",
7623    "quantize_and_dequantize_op.cc",
7624    "quantize_op.cc",
7625    "sparse_cross_op.cc",
7626    "sparse_fill_empty_rows_op.cc",
7627    "sparse_reshape_op.cc",
7628    "unary_ops_composition.cc",
7629])
7630
7631tf_kernel_library(
7632    name = "sobol_op",
7633    srcs = [
7634        "sobol_op.cc",
7635    ],
7636    deps = [
7637        "//tensorflow/core:framework",
7638        "//tensorflow/core:lib",
7639        "//third_party/eigen3",
7640        "@sobol_data",
7641    ],
7642)
7643
7644# ---- temporary forwarding declaration for libraries in linalg
7645# TODO(b/160344057): Remove after updating dependencies.
7646tf_kernel_library(
7647    name = "matrix_inverse_op",
7648    deps = ["//tensorflow/core/kernels/linalg:matrix_inverse_op"],
7649)
7650
7651tf_kernel_library(
7652    name = "einsum_op",
7653    deps = ["//tensorflow/core/kernels/linalg:einsum_op"],
7654)
7655
7656tf_kernel_library(
7657    name = "isotonic_regression_op",
7658    srcs = [
7659        "isotonic_regression_op.cc",
7660    ],
7661    deps = [
7662        "//tensorflow/core:framework",
7663        "//tensorflow/core:lib",
7664        "//third_party/eigen3",
7665    ],
7666)
7667
7668tf_cc_test(
7669    name = "isotonic_regression_op_test",
7670    size = "small",
7671    srcs = ["isotonic_regression_op_test.cc"],
7672    deps = [
7673        ":isotonic_regression_op",
7674        ":ops_testutil",
7675        ":ops_util",
7676        "//tensorflow/core:framework",
7677        "//tensorflow/core:lib",
7678        "//tensorflow/core:lib_internal",
7679        "//tensorflow/core:test",
7680        "//tensorflow/core:test_main",
7681        "//tensorflow/core:testlib",
7682    ],
7683)
7684