From 2408e359cc9e51bedf561fc62c0a40e337fa63b9 Mon Sep 17 00:00:00 2001 From: Josh Levenberg Date: Tue, 23 Feb 2016 13:53:22 -0800 Subject: [PATCH] Give tensorflow/core/kernels/ its own BUILD file. Change: 115379524 --- tensorflow/core/BUILD | 377 +++--- tensorflow/core/kernels/BUILD | 1099 +++++++++++++++++ tensorflow/core/kernels/LICENSE | 203 +++ .../kernels/{concat_op.h => concat_lib.h} | 6 +- .../{concat_op_cpu.cc => concat_lib_cpu.cc} | 2 +- ...ncat_op_gpu.cu.cc => concat_lib_gpu.cu.cc} | 1 + tensorflow/core/kernels/concat_op.cc | 2 +- .../{core_ops_test.cc => nn_ops_test.cc} | 0 tensorflow/core/kernels/ops_util.h | 1 + tensorflow/core/kernels/pack_op.cc | 2 +- .../core/kernels/reduction_ops_common.h | 2 +- .../kernels/sparse_tensor_dense_matmul_op.cc | 1 - .../core/kernels/{split_op.h => split_lib.h} | 6 +- .../{split_op_cpu.cc => split_lib_cpu.cc} | 2 +- ...split_op_gpu.cu.cc => split_lib_gpu.cu.cc} | 2 +- tensorflow/core/kernels/split_op.cc | 3 +- tensorflow/core/kernels/tensor_array_ops.cc | 6 +- ...spose_op_functor.h => transpose_functor.h} | 6 +- ...ose_op_cpu.cc => transpose_functor_cpu.cc} | 2 +- ..._gpu.cu.cc => transpose_functor_gpu.cu.cc} | 2 +- tensorflow/core/kernels/transpose_op.cc | 2 +- tensorflow/core/kernels/unpack_op.cc | 2 +- tensorflow/core/ops/function_ops.cc | 8 - tensorflow/models/embedding/BUILD | 1 + tensorflow/python/BUILD | 1 + tensorflow/tensorflow.bzl | 71 +- 26 files changed, 1561 insertions(+), 249 deletions(-) create mode 100644 tensorflow/core/kernels/BUILD create mode 100644 tensorflow/core/kernels/LICENSE rename tensorflow/core/kernels/{concat_op.h => concat_lib.h} (91%) rename tensorflow/core/kernels/{concat_op_cpu.cc => concat_lib_cpu.cc} (98%) rename tensorflow/core/kernels/{concat_op_gpu.cu.cc => concat_lib_gpu.cu.cc} (97%) rename tensorflow/core/kernels/{core_ops_test.cc => nn_ops_test.cc} (100%) rename tensorflow/core/kernels/{split_op.h => split_lib.h} (93%) rename tensorflow/core/kernels/{split_op_cpu.cc => split_lib_cpu.cc} (97%) rename tensorflow/core/kernels/{split_op_gpu.cu.cc => split_lib_gpu.cu.cc} (98%) rename tensorflow/core/kernels/{transpose_op_functor.h => transpose_functor.h} (93%) rename tensorflow/core/kernels/{transpose_op_cpu.cc => transpose_functor_cpu.cc} (98%) rename tensorflow/core/kernels/{transpose_op_gpu.cu.cc => transpose_functor_gpu.cu.cc} (98%) diff --git a/tensorflow/core/BUILD b/tensorflow/core/BUILD index a38e32f410f..c4d1cd36ff3 100644 --- a/tensorflow/core/BUILD +++ b/tensorflow/core/BUILD @@ -25,8 +25,8 @@ # public/: Public APIs for running graphs # ":core" - The code for ":core_cpu" plus a GPU runtime # ":kernel_lib" - Library with code common to multiple kernel implementations. -# ":gpu_kernels" - The gpu-specific kernels -# ":all_kernels" - The cpu-specific kernels, plus ":gpu_kernels" if +# DEPRECATED! Use libraries defined in the kernels/ directory instead. +# ":all_kernels" - The cpu-specific kernels, plus gpu kernels if # built with Cuda # ":tensorflow_opensource" - The complete open-source package, including # ":all_kernels", ":core", and a Session implementation. @@ -236,34 +236,6 @@ cc_binary( deps = [":framework"], ) -tf_cuda_library( - name = "ops", - srcs = glob( - [ - "ops/**/*.h", - "ops/**/*.cc", - "user_ops/**/*.h", - "user_ops/**/*.cc", - ], - exclude = [ - "**/*test*", - "**/*main.cc", - "user_ops/**/*.cu.cc", - ], - ), - copts = tf_copts(), - linkstatic = 1, - visibility = ["//visibility:public"], - deps = [ - ":framework", - ":lib", - ":protos_cc", - "//tensorflow/models/embedding:word2vec_ops", - "//third_party/eigen3", - ], - alwayslink = 1, -) - # Generates library per group of ops. tf_gen_op_libs( op_lib_names = [ @@ -272,11 +244,12 @@ tf_gen_op_libs( "candidate_sampling_ops", "control_flow_ops", "data_flow_ops", + "function_ops", + "functional_ops", "image_ops", "io_ops", "linalg_ops", "logging_ops", - "functional_ops", "math_ops", "nn_ops", "no_op", @@ -303,6 +276,91 @@ cc_library( alwayslink = 1, ) +cc_library( + name = "ops", + visibility = ["//visibility:public"], + deps = [ + ":array_ops_op_lib", + ":attention_ops_op_lib", + ":candidate_sampling_ops_op_lib", + ":control_flow_ops_op_lib", + ":data_flow_ops_op_lib", + ":function_ops_op_lib", + ":functional_ops_op_lib", + ":image_ops_op_lib", + ":io_ops_op_lib", + ":linalg_ops_op_lib", + ":logging_ops_op_lib", + ":math_ops_op_lib", + ":nn_ops_op_lib", + ":no_op_op_lib", + ":parsing_ops_op_lib", + ":random_ops_op_lib", + ":script_ops_op_lib", + ":sendrecv_ops_op_lib", + ":sparse_ops_op_lib", + ":state_ops_op_lib", + ":string_ops_op_lib", + ":summary_ops_op_lib", + ":training_ops_op_lib", + ":user_ops_op_lib", + "//tensorflow/models/embedding:word2vec_ops", + ], + alwayslink = 1, +) + +cc_library( + name = "array_grad", + srcs = ["ops/array_grad.cc"], + linkstatic = 1, # Seems to be needed since alwayslink is broken in bazel + visibility = ["//visibility:public"], + deps = [ + ":array_ops_op_lib", + ":framework", + ":lib", + ], + alwayslink = 1, +) + +cc_library( + name = "functional_grad", + srcs = ["ops/functional_grad.cc"], + linkstatic = 1, # Seems to be needed since alwayslink is broken in bazel + visibility = ["//visibility:public"], + deps = [ + ":framework", + ":functional_ops_op_lib", + ":lib", + ], + alwayslink = 1, +) + +cc_library( + name = "math_grad", + srcs = ["ops/math_grad.cc"], + linkstatic = 1, # Seems to be needed since alwayslink is broken in bazel + visibility = ["//visibility:public"], + deps = [ + ":framework", + ":lib", + ":math_ops_op_lib", + ], + alwayslink = 1, +) + +cc_library( + name = "nn_grad", + srcs = ["ops/nn_grad.cc"], + linkstatic = 1, # Seems to be needed since alwayslink is broken in bazel + visibility = ["//visibility:public"], + deps = [ + ":framework", + ":lib", + ":nn_ops_op_lib", + ], + alwayslink = 1, +) + tf_cuda_library( name = "core_cpu", hdrs = [ @@ -333,71 +391,65 @@ cc_library( ], ) -tf_gpu_kernel_library( - name = "gpu_kernels", - srcs = glob( - [ - "kernels/**/*.h", - "kernels/*.cu.cc", - "user_ops/**/*.h", - "user_ops/*.cu.cc", - ], - ), - visibility = ["//visibility:public"], - deps = [ - ":cuda", - ":framework", - ":framework_internal", - ":lib", - ":lib_internal", - "//third_party/eigen3", - ], -) - # Common libraries used for implementing kernels. +# DEPRECATED: Use libraries from the kernels/ directory instead. # TODO(josh11b): This also currently includes all the kernel implementations, # should split that out into the ":all_kernels" target. -tf_cuda_library( +cc_library( name = "kernel_lib", - # TODO(josh11b): Pull common dependencies out into a separate library. - srcs = glob( - [ - "kernels/**/*.cc", - ], - exclude = [ - "kernels/**/*test*", - "kernels/**/*main.cc", - "kernels/**/*.cu.cc", - ], - ), - hdrs = glob(["kernels/**/*.h"]), - copts = tf_copts(), - cuda_deps = [ - ":gpu_kernels", + hdrs = [ + "//tensorflow/core/kernels:assign_op.h", + "//tensorflow/core/kernels:conv_2d.h", + "//tensorflow/core/kernels:fill_functor.h", + "//tensorflow/core/kernels:initializable_lookup_table.h", + "//tensorflow/core/kernels:io.h", + "//tensorflow/core/kernels:lookup_util.h", + "//tensorflow/core/kernels:ops_util.h", + "//tensorflow/core/kernels:queue_base.h", + "//tensorflow/core/kernels:reader_base.h", + "//tensorflow/core/kernels:typed_queue.h", ], - linkstatic = 0, + deprecation = "Use libraries from .../kernels instead.", visibility = ["//visibility:public"], deps = [ - ":core_cpu", - ":framework", - ":framework_internal", - ":lib", - ":lib_internal", - ":ops", - ":protos_all_cc", - ":stream_executor", - "//tensorflow/models/embedding:word2vec_kernels", - "//third_party/eigen3", + ":all_kernels", + "//tensorflow/core/kernels:assign_op", + "//tensorflow/core/kernels:conv_2d", + "//tensorflow/core/kernels:fill_functor", + "//tensorflow/core/kernels:initializable_lookup_table", + "//tensorflow/core/kernels:lookup_util", + "//tensorflow/core/kernels:ops_util", + "//tensorflow/core/kernels:queue_base", + "//tensorflow/core/kernels:reader_base", + "//tensorflow/core/kernels:save_restore_tensor", + "//tensorflow/core/kernels:typed_queue", ], - alwayslink = 1, ) # This includes implementations of all kernels built into TensorFlow. -tf_cuda_library( +cc_library( name = "all_kernels", visibility = ["//visibility:public"], deps = [ - ":kernel_lib", + "//tensorflow/core/kernels:array", + "//tensorflow/core/kernels:candidate_sampler_ops", + "//tensorflow/core/kernels:control_flow_ops", + "//tensorflow/core/kernels:data_flow", + "//tensorflow/core/kernels:fact_op", + "//tensorflow/core/kernels:image", + "//tensorflow/core/kernels:io", + "//tensorflow/core/kernels:linalg", + "//tensorflow/core/kernels:logging", + "//tensorflow/core/kernels:math", + "//tensorflow/core/kernels:nn", + "//tensorflow/core/kernels:parsing", + "//tensorflow/core/kernels:random_ops", + "//tensorflow/core/kernels:required", + "//tensorflow/core/kernels:sparse", + "//tensorflow/core/kernels:state", + "//tensorflow/core/kernels:string", + "//tensorflow/core/kernels:training_ops", + "//tensorflow/models/embedding:word2vec_kernels", ], ) @@ -431,9 +483,7 @@ cc_library( "common_runtime/kernel_benchmark_testlib.cc", "framework/fake_input.cc", "framework/function_testlib.cc", - "framework/tensor_testutil.cc", "graph/testlib.cc", - "kernels/ops_testutil.cc", ], hdrs = [ "common_runtime/kernel_benchmark_testlib.h", @@ -441,7 +491,9 @@ cc_library( "framework/function_testlib.h", "framework/tensor_testutil.h", "graph/testlib.h", - "kernels/ops_testutil.h", + # TODO(josh11b): Drop this once users are depending on + # kernels:ops_testutil instead. + "//tensorflow/core/kernels:ops_testutil.h", ], copts = tf_copts(), visibility = ["//visibility:public"], @@ -451,11 +503,14 @@ cc_library( ":core_cpu_internal", ":framework", ":framework_internal", - ":kernel_lib", ":lib", ":protos_all_cc", + ":tensor_testutil", ":tensorflow", # TODO(josh11b): Drop this dep? ":test", + "//tensorflow/core/kernels:constant_op", + "//tensorflow/core/kernels:ops_testutil", + "//tensorflow/core/kernels:ops_util", "//tensorflow/core/platform/default/build_config:gtest", ], ) @@ -477,7 +532,7 @@ filegroup( # sources. filegroup( name = "android_srcs", - srcs = glob( + srcs = ["//tensorflow/core/kernels:android_srcs"] + glob( [ "client/**/*.cc", "common_runtime/**/*.h", @@ -497,12 +552,6 @@ filegroup( "public/**/*.h", "util/**/*.h", "util/**/*.cc", - "kernels/ops_util.cc", - "kernels/ops_util.h", - "kernels/avgpooling_op.h", - "kernels/maxpooling_op.h", - "kernels/pooling_ops_common.h", - "kernels/pooling_ops_common.cc", ], exclude = [ "**/*test.cc", @@ -526,7 +575,6 @@ filegroup( "platform/google/*.cc", "platform/google/test_benchmark.cc", "platform/google/test_benchmark.h", - "kernels/**/*.cu.cc", "user_ops/**/*.cu.cc", "common_runtime/gpu/*.cc", "common_runtime/gpu_device_factory.cc", @@ -540,54 +588,7 @@ filegroup( filegroup( name = "android_core_ops", srcs = [ - "//tensorflow/core:kernels/aggregate_ops.cc", - "//tensorflow/core:kernels/aggregate_ops.h", - "//tensorflow/core:kernels/aggregate_ops_cpu.h", - "//tensorflow/core:kernels/assign_op.h", - "//tensorflow/core:kernels/bias_op.cc", - "//tensorflow/core:kernels/bias_op.h", - "//tensorflow/core:kernels/cast_op.cc", - "//tensorflow/core:kernels/cast_op.h", - "//tensorflow/core:kernels/concat_op.cc", - "//tensorflow/core:kernels/concat_op.h", - "//tensorflow/core:kernels/concat_op_cpu.cc", - "//tensorflow/core:kernels/constant_op.cc", - "//tensorflow/core:kernels/constant_op.h", - "//tensorflow/core:kernels/cwise_ops.h", - "//tensorflow/core:kernels/cwise_ops_common.cc", - "//tensorflow/core:kernels/cwise_ops_common.h", - "//tensorflow/core:kernels/dense_update_ops.cc", - "//tensorflow/core:kernels/dense_update_ops.h", - "//tensorflow/core:kernels/example_parsing_ops.cc", - "//tensorflow/core:kernels/fill_functor.h", - "//tensorflow/core:kernels/gather_op.cc", - "//tensorflow/core:kernels/identity_op.cc", - "//tensorflow/core:kernels/identity_op.h", - "//tensorflow/core:kernels/matmul_op.cc", - "//tensorflow/core:kernels/matmul_op.h", - "//tensorflow/core:kernels/no_op.cc", - "//tensorflow/core:kernels/no_op.h", - "//tensorflow/core:kernels/ops_util.h", - "//tensorflow/core:kernels/pack_op.cc", - "//tensorflow/core:kernels/pooling_ops_common.h", - "//tensorflow/core:kernels/reshape_op.cc", - "//tensorflow/core:kernels/reshape_op.h", - "//tensorflow/core:kernels/reverse_sequence_op.cc", - "//tensorflow/core:kernels/reverse_sequence_op.h", - "//tensorflow/core:kernels/sendrecv_ops.cc", - "//tensorflow/core:kernels/sendrecv_ops.h", - "//tensorflow/core:kernels/sequence_ops.cc", - "//tensorflow/core:kernels/shape_ops.cc", - "//tensorflow/core:kernels/slice_op.cc", - "//tensorflow/core:kernels/slice_op.h", - "//tensorflow/core:kernels/softmax_op.cc", - "//tensorflow/core:kernels/softmax_op.h", - "//tensorflow/core:kernels/split_op.cc", - "//tensorflow/core:kernels/split_op.h", - "//tensorflow/core:kernels/split_op_cpu.cc", - "//tensorflow/core:kernels/unpack_op.cc", - "//tensorflow/core:kernels/variable_ops.cc", - "//tensorflow/core:kernels/variable_ops.h", + "//tensorflow/core/kernels:android_core_ops", ], visibility = ["//visibility:public"], ) @@ -611,23 +612,7 @@ filegroup( filegroup( name = "android_extended_ops_headers", srcs = [ - "//tensorflow/core:kernels/argmax_op.h", - "//tensorflow/core:kernels/avgpooling_op.h", - "//tensorflow/core:kernels/control_flow_ops.h", - "//tensorflow/core:kernels/conv_2d.h", - "//tensorflow/core:kernels/io.h", - "//tensorflow/core:kernels/maxpooling_op.h", - "//tensorflow/core:kernels/reduction_ops.h", - "//tensorflow/core:kernels/reduction_ops_common.h", - "//tensorflow/core:kernels/relu_op.h", - "//tensorflow/core:kernels/softplus_op.h", - "//tensorflow/core:kernels/softsign_op.h", - "//tensorflow/core:kernels/tile_ops.h", - "//tensorflow/core:kernels/training_ops.h", - "//tensorflow/core:kernels/transpose_op.h", - "//tensorflow/core:kernels/transpose_op_functor.h", - "//tensorflow/core:kernels/where_op.h", - "//tensorflow/core:kernels/xent_op.h", + "//tensorflow/core/kernels:android_extended_ops_headers", ], ) @@ -635,31 +620,7 @@ filegroup( name = "android_extended_ops_group1", srcs = [ ":android_extended_ops_headers", - "//tensorflow/core:kernels/argmax_op.cc", - "//tensorflow/core:kernels/avgpooling_op.cc", - "//tensorflow/core:kernels/bcast_ops.cc", - "//tensorflow/core:kernels/control_flow_ops.cc", - "//tensorflow/core:kernels/conv_2d.h", - "//tensorflow/core:kernels/conv_ops.cc", - "//tensorflow/core:kernels/cwise_op_add.cc", - "//tensorflow/core:kernels/cwise_op_div.cc", - "//tensorflow/core:kernels/cwise_op_equal_to.cc", - "//tensorflow/core:kernels/cwise_op_exp.cc", - "//tensorflow/core:kernels/cwise_op_greater.cc", - "//tensorflow/core:kernels/cwise_op_isfinite.cc", - "//tensorflow/core:kernels/cwise_op_less.cc", - "//tensorflow/core:kernels/cwise_op_log.cc", - "//tensorflow/core:kernels/cwise_op_maximum.cc", - "//tensorflow/core:kernels/cwise_op_minimum.cc", - "//tensorflow/core:kernels/cwise_op_mul.cc", - "//tensorflow/core:kernels/cwise_op_neg.cc", - "//tensorflow/core:kernels/cwise_op_select.cc", - "//tensorflow/core:kernels/cwise_op_sigmoid.cc", - "//tensorflow/core:kernels/cwise_op_sqrt.cc", - "//tensorflow/core:kernels/cwise_op_square.cc", - "//tensorflow/core:kernels/cwise_op_sub.cc", - "//tensorflow/core:kernels/cwise_op_tanh.cc", - "//tensorflow/core:kernels/dynamic_partition_op.cc", + "//tensorflow/core/kernels:android_extended_ops_group1", ], visibility = ["//visibility:public"], ) @@ -668,30 +629,7 @@ filegroup( name = "android_extended_ops_group2", srcs = [ ":android_extended_ops_headers", - "//tensorflow/core:kernels/dynamic_stitch_op.cc", - "//tensorflow/core:kernels/in_topk_op.cc", - "//tensorflow/core:kernels/io.cc", - "//tensorflow/core:kernels/lrn_op.cc", - "//tensorflow/core:kernels/maxpooling_op.cc", - "//tensorflow/core:kernels/reduction_ops_max.cc", - "//tensorflow/core:kernels/reduction_ops_mean.cc", - "//tensorflow/core:kernels/reduction_ops_min.cc", - "//tensorflow/core:kernels/reduction_ops_prod.cc", - "//tensorflow/core:kernels/reduction_ops_sum.cc", - "//tensorflow/core:kernels/relu_op.cc", - "//tensorflow/core:kernels/restore_op.cc", - "//tensorflow/core:kernels/save_op.cc", - "//tensorflow/core:kernels/softplus_op.cc", - "//tensorflow/core:kernels/softsign_op.cc", - "//tensorflow/core:kernels/sparse_to_dense_op.cc", - "//tensorflow/core:kernels/stack_ops.cc", - "//tensorflow/core:kernels/tile_ops.cc", - "//tensorflow/core:kernels/topk_op.cc", - "//tensorflow/core:kernels/training_ops.cc", - "//tensorflow/core:kernels/transpose_op.cc", - "//tensorflow/core:kernels/transpose_op_cpu.cc", - "//tensorflow/core:kernels/where_op.cc", - "//tensorflow/core:kernels/xent_op.cc", + "//tensorflow/core/kernels:android_extended_ops_group2", ], visibility = ["//visibility:public"], ) @@ -1013,9 +951,13 @@ tf_cuda_library( deps = [ ":framework", ":framework_internal", + ":function_ops_op_lib", + ":functional_grad", + ":functional_ops_op_lib", ":lib", ":lib_internal", ":protos_all_cc", + "//tensorflow/core/kernels:required", "//third_party/eigen3", ], alwayslink = 1, @@ -1096,6 +1038,19 @@ cc_library( deps = [":lib_internal"], ) +cc_library( + name = "tensor_testutil", + testonly = 1, + srcs = ["framework/tensor_testutil.cc"], + hdrs = ["framework/tensor_testutil.h"], + copts = tf_copts(), + deps = [ + ":framework", + ":lib", + ":test", + ], +) + # Main program for tests cc_library( name = "test_main", @@ -1183,7 +1138,6 @@ tf_cc_tests( ":direct_session", ":framework", ":framework_internal", - ":kernel_lib", ":lib", ":lib_internal", ":ops", @@ -1192,6 +1146,7 @@ tf_cc_tests( ":test_main", ":testlib", "//tensorflow/cc:cc_ops", + "//tensorflow/core/kernels:ops_util", "//third_party/eigen3", ], ) @@ -1202,7 +1157,6 @@ tf_cc_tests( tags = tf_cuda_tests_tags(), tests = glob( [ - "kernels/**/*_test.cc", "user_ops/**/*_test.cc", "common_runtime/gpu/*_test.cc", ], @@ -1219,7 +1173,6 @@ tf_cc_tests( ":framework", ":framework_internal", ":gpu_runtime", - ":kernel_lib", ":lib", ":lib_internal", ":protos_all_cc", @@ -1227,6 +1180,7 @@ tf_cc_tests( ":test_main", ":testlib", "//tensorflow/cc:cc_ops", + "//tensorflow/core/kernels:ops_util", ], ) @@ -1242,7 +1196,6 @@ tf_cc_tests( ":framework", ":framework_internal", ":gpu_runtime", - ":kernel_lib", ":lib", ":lib_internal", ":protos_all_cc", diff --git a/tensorflow/core/kernels/BUILD b/tensorflow/core/kernels/BUILD new file mode 100644 index 00000000000..2d8528f0721 --- /dev/null +++ b/tensorflow/core/kernels/BUILD @@ -0,0 +1,1099 @@ +# Description: +# Op kernel implementations for TensorFlow. + +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) # Apache 2.0 + +exports_files(["LICENSE"]) + +load( + "//tensorflow:tensorflow.bzl", + "tf_cc_test", + "tf_cc_tests", + "tf_kernel_libraries", + "tf_kernel_library", +) +load( + "//tensorflow/core:platform/default/build_config.bzl", + "tf_proto_library", +) + +# Public support libraries ---------------------------------------------------- + +cc_library( + name = "assign_op", + hdrs = ["assign_op.h"], + deps = [ + "//tensorflow/core:framework", + "//third_party/eigen3", + ], +) + +tf_kernel_library( + name = "concat_lib", + srcs = ["concat_lib_cpu.cc"], + hdrs = ["concat_lib.h"], + gpu_srcs = [ + "concat_lib_gpu.cu.cc", + "concat_lib.h", + ], + deps = [ + "//tensorflow/core:framework", + "//third_party/eigen3", + ], + alwayslink = 0, +) + +cc_library( + name = "conv_2d", + hdrs = ["conv_2d.h"], + deps = [ + "//tensorflow/core:framework", + "//third_party/eigen3", + ], +) + +cc_library( + name = "fill_functor", + hdrs = ["fill_functor.h"], + deps = [ + "//tensorflow/core:framework", + "//third_party/eigen3", + ], +) + +cc_library( + name = "initializable_lookup_table", + srcs = ["initializable_lookup_table.cc"], + hdrs = ["initializable_lookup_table.h"], + deps = [ + "//tensorflow/core:framework", + "//tensorflow/core:lib", + ], +) + +cc_library( + name = "lookup_util", + srcs = ["lookup_util.cc"], + hdrs = ["lookup_util.h"], + deps = [ + ":initializable_lookup_table", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + ], +) + +cc_library( + name = "ops_testutil", + testonly = 1, + srcs = ["ops_testutil.cc"], + hdrs = ["ops_testutil.h"], + deps = [ + "//tensorflow/core:core_cpu", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:tensor_testutil", + "//tensorflow/core:test", + "//third_party/eigen3", + ], +) + +cc_library( + name = "ops_util", + srcs = ["ops_util.cc"], + hdrs = ["ops_util.h"], + deps = [ + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//third_party/eigen3", + ], +) + +tf_cc_test( + name = "ops_util_test", + deps = [ + ":ops_util", + "//tensorflow/core:test", + "//tensorflow/core:test_main", + ], +) + +cc_library( + name = "queue_base", + srcs = ["queue_base.cc"], + hdrs = ["queue_base.h"], + deps = [ + "//tensorflow/core:framework", + "//tensorflow/core:lib", + ], +) + +cc_library( + name = "queue_op", + hdrs = ["queue_op.h"], + deps = [ + ":queue_base", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + ], +) + +tf_proto_library( + name = "reader_base_proto", + srcs = ["reader_base.proto"], + cc_api_version = 2, + go_api_version = 2, + java_api_version = 2, + py_api_version = 2, +) + +cc_library( + name = "reader_base", + srcs = ["reader_base.cc"], + hdrs = ["reader_base.h"], + deps = [ + ":reader_base_proto_cc", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + ], +) + +cc_library( + name = "save_restore_tensor", + # TODO(josh11b): Rename io.* -> save_restore_tensor.* + srcs = ["io.cc"], + hdrs = ["io.h"], + deps = [ + "//tensorflow/core:framework", + "//tensorflow/core:lib", + ], +) + +tf_kernel_library( + name = "split_lib", + srcs = ["split_lib_cpu.cc"], + hdrs = ["split_lib.h"], + gpu_srcs = [ + "split_lib_gpu.cu.cc", + "split_lib.h", + ], + deps = [ + "//tensorflow/core:framework", + "//third_party/eigen3", + ], + alwayslink = 0, +) + +cc_library( + name = "typed_queue", + hdrs = ["typed_queue.h"], + deps = [ + ":queue_base", + ], +) + +# OpKernel libraries ---------------------------------------------------------- + +tf_kernel_libraries( + name = "array", + prefixes = [ + "bcast_ops", + "bitcast_op", + "depthtospace_op", + "concat_op", + "constant_op", + "diag_op", + "edit_distance_op", + "gather_op", + "identity_op", + "listdiff_op", + "pack_op", + "pad_op", + "random_shuffle_op", + "reshape_op", + "reverse_op", + "reverse_sequence_op", + "shape_ops", + "slice_op", + "spacetodepth_op", + "split_op", + "tile_ops", + "transpose_op", + "unique_op", + "unpack_op", + "where_op", + ], + deps = [ + ":concat_lib", + ":fill_functor", + ":ops_util", + ":split_lib", + ":transpose_functor", + "//tensorflow/core:array_grad", + "//tensorflow/core:array_ops_op_lib", + "//tensorflow/core:core_cpu", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:lib_internal", + "//tensorflow/core:protos_all_cc", + "//third_party/eigen3", + ], +) + +tf_cc_tests( + tests = [ + "concat_op_test", + "constant_op_test", + "gather_op_test", + "identity_op_test", + "reverse_op_test", + "slice_op_test", + "unique_op_test", + ], + deps = [ + ":array", + ":ops_testutil", + ":ops_util", + "//tensorflow/core:core_cpu", + "//tensorflow/core:core_cpu_internal", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:protos_all_cc", + "//tensorflow/core:test", + "//tensorflow/core:test_main", + "//tensorflow/core:testlib", + ], +) + +tf_kernel_library( + name = "transpose_functor", + srcs = ["transpose_functor_cpu.cc"], + hdrs = ["transpose_functor.h"], + gpu_srcs = [ + "transpose_functor_gpu.cu.cc", + "transpose_functor.h", + ], + visibility = ["//visibility:private"], + deps = [ + "//tensorflow/core:framework", + "//third_party/eigen3", + ], + alwayslink = 0, +) + +tf_kernel_library( + name = "candidate_sampler_ops", + prefix = "candidate_sampler_ops", + deps = [ + ":range_sampler", + "//tensorflow/core:candidate_sampling_ops_op_lib", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + ], +) + +cc_library( + name = "range_sampler", + srcs = ["range_sampler.cc"], + hdrs = ["range_sampler.h"], + visibility = ["//visibility:private"], + deps = [ + "//tensorflow/core:lib", + "//tensorflow/core:lib_internal", + ], +) + +tf_cc_test( + name = "range_sampler_test", + deps = [ + ":range_sampler", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:test", + "//tensorflow/core:test_main", + ], +) + +tf_kernel_library( + name = "control_flow_ops", + prefix = "control_flow_ops", + deps = [ + "//tensorflow/core:control_flow_ops_op_lib", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + ], +) + +tf_cc_test( + name = "control_flow_ops_test", + deps = [ + ":control_flow_ops", + ":ops_testutil", + ":ops_util", + "//tensorflow/core:framework", + "//tensorflow/core:protos_all_cc", + "//tensorflow/core:test", + "//tensorflow/core:test_main", + "//tensorflow/core:testlib", + ], +) + +tf_kernel_libraries( + name = "data_flow", + prefixes = [ + "dynamic_partition_op", + "dynamic_stitch_op", + "fifo_queue_op", + "lookup_table_init_op", + "lookup_table_op", + "padding_fifo_queue_op", + "queue_ops", + "random_shuffle_queue_op", + "stack_ops", + "tensor_array_ops", + ], + deps = [ + ":concat_lib", + ":fifo_queue", + ":initializable_lookup_table", + ":lookup_util", + ":padding_fifo_queue", + ":queue_base", + ":queue_op", + ":split_lib", + ":tensor_array", + ":typed_queue", + "//tensorflow/core:core_cpu", + "//tensorflow/core:data_flow_ops_op_lib", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:lib_internal", + "//third_party/eigen3", + ], +) + +tf_cc_tests( + tests = [ + "dynamic_partition_op_test", + "dynamic_stitch_op_test", + ], + deps = [ + ":data_flow", + ":ops_testutil", + ":ops_util", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:protos_all_cc", + "//tensorflow/core:test", + "//tensorflow/core:test_main", + "//tensorflow/core:testlib", + ], +) + +cc_library( + name = "fifo_queue", + srcs = ["fifo_queue.cc"], + hdrs = ["fifo_queue.h"], + visibility = ["//visibility:private"], + deps = [ + ":queue_base", + ":typed_queue", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + ], +) + +cc_library( + name = "padding_fifo_queue", + srcs = ["padding_fifo_queue.cc"], + hdrs = ["padding_fifo_queue.h"], + visibility = ["//visibility:private"], + deps = [ + ":fifo_queue", + ":queue_base", + ":typed_queue", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + ], +) + +cc_library( + name = "tensor_array", + srcs = ["tensor_array.cc"], + hdrs = ["tensor_array.h"], + visibility = ["//visibility:private"], + deps = [ + "//tensorflow/core:framework", + "//tensorflow/core:lib", + ], +) + +tf_kernel_library( + name = "fact_op", + prefix = "fact_op", + deps = [ + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:user_ops_op_lib", + ], +) + +tf_kernel_libraries( + name = "io", + prefixes = [ + "fixed_length_record_reader_op", + "identity_reader_op", + "matching_files_op", + "reader_ops", + "restore_op", + "save_op", + "text_line_reader_op", + "tf_record_reader_op", + "whole_file_read_ops", + ], + deps = [ + ":reader_base", + ":save_restore_tensor", + "//tensorflow/core:framework", + "//tensorflow/core:io_ops_op_lib", + "//tensorflow/core:lib", + "//tensorflow/core:lib_internal", + ], +) + +tf_cc_tests( + tests = [ + "restore_op_test", + "save_op_test", + ], + deps = [ + ":io", + ":ops_testutil", + ":ops_util", + "//tensorflow/core:core_cpu", + "//tensorflow/core:core_cpu_internal", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:protos_all_cc", + "//tensorflow/core:test", + "//tensorflow/core:test_main", + "//tensorflow/core:testlib", + ], +) + +tf_kernel_libraries( + name = "image", + prefixes = [ + "adjust_contrast_op", + "attention_ops", + "colorspace_op", + "decode_jpeg_op", + "decode_png_op", + "draw_bounding_box_op", + "encode_jpeg_op", + "encode_png_op", + "random_crop_op", + "resize_area_op", + "resize_bicubic_op", + "resize_bilinear_op", + "resize_nearest_neighbor_op", + "sample_distorted_bounding_box_op", + ], + deps = [ + "//third_party/eigen3", + "//tensorflow/core:protos_all_cc", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:lib_internal", + # TODO(josh11b): Merge these ops libs + "//tensorflow/core:image_ops_op_lib", + "//tensorflow/core:attention_ops_op_lib", + ], +) + +tf_cc_tests( + tests = [ + "adjust_contrast_op_benchmark_test", + "adjust_contrast_op_test", + "colorspace_op_test", + "resize_bilinear_op_test", + "resize_nearest_neighbor_op_test", + ], + deps = [ + ":image", + ":ops_testutil", + ":ops_util", + "//tensorflow/core:core_cpu", + "//tensorflow/core:framework", + "//tensorflow/core:protos_all_cc", + "//tensorflow/core:test", + "//tensorflow/core:test_main", + "//tensorflow/core:testlib", + ], +) + +tf_kernel_libraries( + name = "linalg", + prefixes = [ + "cholesky_op", + "determinant_op", + "self_adjoint_eig_op", + "matrix_inverse_op", + "matrix_solve_ls_op", + "matrix_solve_op", + "matrix_triangular_solve_op", + ], + deps = [ + ":binary_linalg_ops_common", + ":linalg_ops_common", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:linalg_ops_op_lib", + "//third_party/eigen3", + ], +) + +# TODO(josh11b): Should these two *linalg_ops_common libraries be merged? +cc_library( + name = "linalg_ops_common", + srcs = ["linalg_ops_common.cc"], + hdrs = ["linalg_ops_common.h"], + visibility = ["//visibility:private"], + deps = [ + "//tensorflow/core:framework", + "//third_party/eigen3", + ], +) + +cc_library( + name = "binary_linalg_ops_common", + srcs = ["binary_linalg_ops_common.cc"], + hdrs = ["binary_linalg_ops_common.h"], + visibility = ["//visibility:private"], + deps = [ + "//tensorflow/core:framework", + "//third_party/eigen3", + ], +) + +tf_kernel_libraries( + name = "logging", + prefixes = [ + "logging_ops", + "summary_image_op", + "summary_op", + ], + deps = [ + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:lib_internal", + "//tensorflow/core:protos_all_cc", + # TODO(josh11b): Merge these ops libs? + "//tensorflow/core:summary_ops_op_lib", + "//tensorflow/core:logging_ops_op_lib", + ], +) + +tf_cc_tests( + tests = [ + "logging_ops_test", + "summary_image_op_test", + "summary_op_test", + ], + deps = [ + ":logging", + ":ops_testutil", + ":ops_util", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:protos_all_cc", + "//tensorflow/core:test", + "//tensorflow/core:test_main", + "//tensorflow/core:testlib", + ], +) + +tf_kernel_libraries( + name = "math", + prefixes = [ + "aggregate_ops", + "argmax_op", + "batch_matmul_op", + "cast_op", + "check_numerics_op", + "cross_op", + "cwise_op", + "fft_ops", + "matmul_op", + "reduction_ops", + "segment_reduction_ops", + "sequence_ops", + "sparse_matmul_op", + ], + deps = [ + ":fill_functor", + ":transpose_functor", + "//tensorflow/core:core_cpu", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:lib_internal", + "//tensorflow/core:math_grad", + "//tensorflow/core:math_ops_op_lib", + "//third_party/eigen3", + ], +) + +tf_cc_tests( + tests = [ + "cast_op_test", + "cross_op_test", + "cwise_ops_test", + "matmul_op_test", + "reduction_ops_test", + "segment_reduction_ops_test", + "sparse_matmul_op_test", + ], + deps = [ + ":math", + ":ops_testutil", + ":ops_util", + "//tensorflow/core:core_cpu", + "//tensorflow/core:core_cpu_internal", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:protos_all_cc", + "//tensorflow/core:test", + "//tensorflow/core:test_main", + "//tensorflow/core:testlib", + ], +) + +# conv_grad_ops currently has to be built with conv_ops*. +# TODO(josh11b, zhengxq): put these a separate libraries in ":nn" below once +# conv_ops_gpu.h has be separated into its own library. +tf_kernel_library( + name = "conv_ops", + srcs = ["conv_grad_ops.cc"], + prefix = "conv_ops", + deps = [ + ":conv_2d", + ":ops_util", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:nn_ops_op_lib", + ], +) + +tf_kernel_libraries( + name = "nn", + prefixes = [ + "batch_norm_op", + "bias_op", + "in_topk_op", + "l2loss_op", + "lrn_op", + "relu_op", + "softmax_op", + "softplus_op", + "softsign_op", + "topk_op", + "xent_op", + ], + deps = [ + ":conv_2d", + ":conv_ops", + ":ops_util", + ":pooling_ops", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:lib_internal", + "//tensorflow/core:nn_grad", + "//tensorflow/core:nn_ops_op_lib", + "//third_party/eigen3", + ], +) + +tf_cc_tests( + tests = [ + "lrn_op_test", + "nn_ops_test", + "xent_op_test", + ], + deps = [ + ":nn", + ":ops_testutil", + ":ops_util", + ":xent_op", + "//tensorflow/cc:cc_ops", + "//tensorflow/core:core_cpu", + "//tensorflow/core:core_cpu_internal", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:protos_all_cc", + "//tensorflow/core:test", + "//tensorflow/core:test_main", + "//tensorflow/core:testlib", + ], +) + +tf_kernel_library( + name = "pooling_ops", + srcs = [ + "avgpooling_op.cc", + "maxpooling_op.cc", + "pooling_ops_common.cc", + ], + hdrs = [ + "avgpooling_op.h", + "maxpooling_op.h", + "pooling_ops_common.h", + ], + gpu_srcs = [ + "avgpooling_op.h", + "avgpooling_op_gpu.cu.cc", + "maxpooling_op.h", + "maxpooling_op_gpu.cu.cc", + "maxpooling_op_gpu.h", + "pooling_ops_common.h", + "pooling_ops_common_gpu.h", + ], + deps = [ + ":conv_2d", + ":ops_util", + "//tensorflow/core:core_cpu", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:nn_ops_op_lib", + "//third_party/eigen3", + ], +) + +tf_kernel_libraries( + name = "parsing", + prefixes = [ + "decode_csv_op", + "decode_raw_op", + "example_parsing_ops", + "string_to_number_op", + ], + deps = [ + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:parsing_ops_op_lib", + "//tensorflow/core:protos_all_cc", + ], +) + +tf_kernel_library( + name = "random_ops", + prefix = "random_op", + deps = [ + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:lib_internal", + "//tensorflow/core:random_ops_op_lib", + ], +) + +tf_cc_test( + name = "random_op_test", + deps = [ + ":random_ops", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:test", + "//tensorflow/core:test_main", + "//tensorflow/core:testlib", + ], +) + +tf_kernel_libraries( + name = "required", + prefixes = [ + "no_op", + "sendrecv_ops", + ], + deps = [ + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:no_op_op_lib", + "//tensorflow/core:sendrecv_ops_op_lib", + ], +) + +tf_kernel_libraries( + name = "sparse", + prefixes = [ + "sparse_concat_op", + "sparse_reorder_op", + "sparse_split_op", + "sparse_tensor_dense_matmul_op", + "sparse_to_dense_op", + "sparse_xent_op", + "serialize_sparse_op", + ], + deps = [ + ":fill_functor", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:sparse_ops_op_lib", + "//third_party/eigen3", + ], +) + +tf_cc_tests( + tests = [ + "sparse_tensor_dense_matmul_op_test", + "sparse_to_dense_op_test", + "sparse_xent_op_test", + ], + deps = [ + ":ops_testutil", + ":ops_util", + ":sparse", + ":xent_op", + "//tensorflow/core:core_cpu", + "//tensorflow/core:core_cpu_internal", + "//tensorflow/core:framework", + "//tensorflow/core:protos_all_cc", + "//tensorflow/core:test", + "//tensorflow/core:test_main", + "//tensorflow/core:testlib", + ], +) + +tf_kernel_libraries( + name = "state", + prefixes = [ + "count_up_to_op", + "dense_update_ops", + "scatter_op", + "variable_ops", + ], + deps = [ + ":assign_op", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:state_ops_op_lib", + "//third_party/eigen3", + ], +) + +tf_cc_test( + name = "scatter_op_test", + deps = [ + ":ops_testutil", + ":ops_util", + ":scatter_op", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:protos_all_cc", + "//tensorflow/core:test", + "//tensorflow/core:test_main", + "//tensorflow/core:testlib", + ], +) + +tf_kernel_libraries( + name = "string", + prefixes = [ + "string_to_hash_bucket_op", + ], + deps = [ + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:string_ops_op_lib", + ], +) + +tf_kernel_library( + name = "training_ops", + prefix = "training_ops", + deps = [ + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:training_ops_op_lib", + "//third_party/eigen3", + ], +) + +tf_cc_test( + name = "training_ops_test", + deps = [ + ":ops_util", + ":training_ops", + "//tensorflow/core:core_cpu", + "//tensorflow/core:framework", + "//tensorflow/core:test", + "//tensorflow/core:test_main", + "//tensorflow/core:testlib", + ], +) + +# Android libraries ----------------------------------------------------------- + +filegroup( + name = "android_srcs", + srcs = [ + "avgpooling_op.h", + "maxpooling_op.h", + "ops_util.cc", + "ops_util.h", + "pooling_ops_common.cc", + "pooling_ops_common.h", + ], +) + +filegroup( + name = "android_core_ops", + srcs = [ + "aggregate_ops.cc", + "aggregate_ops.h", + "aggregate_ops_cpu.h", + "assign_op.h", + "bias_op.cc", + "bias_op.h", + "cast_op.cc", + "cast_op.h", + "concat_lib.h", + "concat_lib_cpu.cc", + "concat_op.cc", + "constant_op.cc", + "constant_op.h", + "cwise_ops.h", + "cwise_ops_common.cc", + "cwise_ops_common.h", + "dense_update_ops.cc", + "dense_update_ops.h", + "example_parsing_ops.cc", + "fill_functor.h", + "gather_op.cc", + "identity_op.cc", + "identity_op.h", + "matmul_op.cc", + "matmul_op.h", + "no_op.cc", + "no_op.h", + "ops_util.h", + "pack_op.cc", + "pooling_ops_common.h", + "reshape_op.cc", + "reshape_op.h", + "reverse_sequence_op.cc", + "reverse_sequence_op.h", + "sendrecv_ops.cc", + "sendrecv_ops.h", + "sequence_ops.cc", + "shape_ops.cc", + "slice_op.cc", + "slice_op.h", + "softmax_op.cc", + "softmax_op.h", + "split_lib.h", + "split_lib_cpu.cc", + "split_op.cc", + "unpack_op.cc", + "variable_ops.cc", + "variable_ops.h", + ], +) + +filegroup( + name = "android_extended_ops_headers", + srcs = [ + "argmax_op.h", + "avgpooling_op.h", + "control_flow_ops.h", + "conv_2d.h", + "io.h", + "maxpooling_op.h", + "reduction_ops.h", + "reduction_ops_common.h", + "relu_op.h", + "softplus_op.h", + "softsign_op.h", + "tile_ops.h", + "training_ops.h", + "transpose_functor.h", + "transpose_op.h", + "where_op.h", + "xent_op.h", + ], +) + +filegroup( + name = "android_extended_ops_group1", + srcs = [ + "argmax_op.cc", + "avgpooling_op.cc", + "bcast_ops.cc", + "control_flow_ops.cc", + "conv_2d.h", + "conv_ops.cc", + "cwise_op_add.cc", + "cwise_op_div.cc", + "cwise_op_equal_to.cc", + "cwise_op_exp.cc", + "cwise_op_greater.cc", + "cwise_op_isfinite.cc", + "cwise_op_less.cc", + "cwise_op_log.cc", + "cwise_op_maximum.cc", + "cwise_op_minimum.cc", + "cwise_op_mul.cc", + "cwise_op_neg.cc", + "cwise_op_select.cc", + "cwise_op_sigmoid.cc", + "cwise_op_sqrt.cc", + "cwise_op_square.cc", + "cwise_op_sub.cc", + "cwise_op_tanh.cc", + "dynamic_partition_op.cc", + ], +) + +filegroup( + name = "android_extended_ops_group2", + srcs = [ + "dynamic_stitch_op.cc", + "in_topk_op.cc", + "io.cc", + "lrn_op.cc", + "maxpooling_op.cc", + "reduction_ops_max.cc", + "reduction_ops_mean.cc", + "reduction_ops_min.cc", + "reduction_ops_prod.cc", + "reduction_ops_sum.cc", + "relu_op.cc", + "restore_op.cc", + "save_op.cc", + "softplus_op.cc", + "softsign_op.cc", + "sparse_to_dense_op.cc", + "stack_ops.cc", + "tile_ops.cc", + "topk_op.cc", + "training_ops.cc", + "transpose_functor_cpu.cc", + "transpose_op.cc", + "where_op.cc", + "xent_op.cc", + ], +) + +# ----------------------------------------------------------------------------- +# Google-internal targets. These must be at the end for syncrepo. + +filegroup( + name = "all_files", + srcs = glob( + ["**/*"], + exclude = [ + "**/METADATA", + "**/OWNERS", + ], + ), + visibility = ["//tensorflow:__subpackages__"], +) diff --git a/tensorflow/core/kernels/LICENSE b/tensorflow/core/kernels/LICENSE new file mode 100644 index 00000000000..d3da228420e --- /dev/null +++ b/tensorflow/core/kernels/LICENSE @@ -0,0 +1,203 @@ +Copyright 2015 The TensorFlow Authors. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2015, The TensorFlow Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/tensorflow/core/kernels/concat_op.h b/tensorflow/core/kernels/concat_lib.h similarity index 91% rename from tensorflow/core/kernels/concat_op.h rename to tensorflow/core/kernels/concat_lib.h index 29fd86d18da..77f92f54285 100644 --- a/tensorflow/core/kernels/concat_op.h +++ b/tensorflow/core/kernels/concat_lib.h @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ -#ifndef TENSORFLOW_KERNELS_CONCAT_OP_H_ -#define TENSORFLOW_KERNELS_CONCAT_OP_H_ +#ifndef TENSORFLOW_KERNELS_CONCAT_LIB_H_ +#define TENSORFLOW_KERNELS_CONCAT_LIB_H_ #include @@ -39,4 +39,4 @@ void ConcatGPU(const Eigen::GpuDevice& d, } // namespace tensorflow -#endif // TENSORFLOW_KERNELS_CONCAT_OP_H_ +#endif // TENSORFLOW_KERNELS_CONCAT_LIB_H_ diff --git a/tensorflow/core/kernels/concat_op_cpu.cc b/tensorflow/core/kernels/concat_lib_cpu.cc similarity index 98% rename from tensorflow/core/kernels/concat_op_cpu.cc rename to tensorflow/core/kernels/concat_lib_cpu.cc index b95045fd308..f5431e6c0fc 100644 --- a/tensorflow/core/kernels/concat_op_cpu.cc +++ b/tensorflow/core/kernels/concat_lib_cpu.cc @@ -15,7 +15,7 @@ limitations under the License. #define EIGEN_USE_THREADS -#include "tensorflow/core/kernels/concat_op.h" +#include "tensorflow/core/kernels/concat_lib.h" #include #include "tensorflow/core/framework/register_types.h" #include "tensorflow/core/util/work_sharder.h" diff --git a/tensorflow/core/kernels/concat_op_gpu.cu.cc b/tensorflow/core/kernels/concat_lib_gpu.cu.cc similarity index 97% rename from tensorflow/core/kernels/concat_op_gpu.cu.cc rename to tensorflow/core/kernels/concat_lib_gpu.cu.cc index f832fd5b737..018d551eb78 100644 --- a/tensorflow/core/kernels/concat_op_gpu.cu.cc +++ b/tensorflow/core/kernels/concat_lib_gpu.cu.cc @@ -25,6 +25,7 @@ limitations under the License. #include "tensorflow/core/framework/bfloat16.h" #include "tensorflow/core/framework/register_types.h" #include "tensorflow/core/framework/tensor_types.h" +#include "tensorflow/core/kernels/concat_lib.h" namespace tensorflow { diff --git a/tensorflow/core/kernels/concat_op.cc b/tensorflow/core/kernels/concat_op.cc index d3f6b4e9068..b87caf78d0f 100644 --- a/tensorflow/core/kernels/concat_op.cc +++ b/tensorflow/core/kernels/concat_op.cc @@ -23,7 +23,7 @@ limitations under the License. #include "tensorflow/core/framework/tensor.h" #include "tensorflow/core/framework/tensor_types.h" #include "tensorflow/core/framework/types.h" -#include "tensorflow/core/kernels/concat_op.h" +#include "tensorflow/core/kernels/concat_lib.h" #include "tensorflow/core/lib/core/status.h" #include "tensorflow/core/platform/types.h" diff --git a/tensorflow/core/kernels/core_ops_test.cc b/tensorflow/core/kernels/nn_ops_test.cc similarity index 100% rename from tensorflow/core/kernels/core_ops_test.cc rename to tensorflow/core/kernels/nn_ops_test.cc diff --git a/tensorflow/core/kernels/ops_util.h b/tensorflow/core/kernels/ops_util.h index 1b8cf874f8f..35234766578 100644 --- a/tensorflow/core/kernels/ops_util.h +++ b/tensorflow/core/kernels/ops_util.h @@ -28,6 +28,7 @@ namespace tensorflow { // Call this function from a test if op kernels are not being // registered. This can happen if the test is linked in a shared // mode and has no direct references to any code from this directory. +// TODO(josh11b): Delete this, should no longer be needed. void RequireDefaultOps(); // Get2dOutputSize(): Given an input tensor, kernel, stride and padding diff --git a/tensorflow/core/kernels/pack_op.cc b/tensorflow/core/kernels/pack_op.cc index d42c4b146de..190063f2b8c 100644 --- a/tensorflow/core/kernels/pack_op.cc +++ b/tensorflow/core/kernels/pack_op.cc @@ -23,7 +23,7 @@ limitations under the License. #include "tensorflow/core/framework/tensor.h" #include "tensorflow/core/framework/tensor_types.h" #include "tensorflow/core/framework/types.h" -#include "tensorflow/core/kernels/concat_op.h" +#include "tensorflow/core/kernels/concat_lib.h" #include "tensorflow/core/lib/core/status.h" #include "tensorflow/core/platform/types.h" diff --git a/tensorflow/core/kernels/reduction_ops_common.h b/tensorflow/core/kernels/reduction_ops_common.h index d837c43f237..19cedb13324 100644 --- a/tensorflow/core/kernels/reduction_ops_common.h +++ b/tensorflow/core/kernels/reduction_ops_common.h @@ -31,7 +31,7 @@ limitations under the License. #include "tensorflow/core/framework/tensor.h" #include "tensorflow/core/framework/types.h" #include "tensorflow/core/kernels/reduction_ops.h" -#include "tensorflow/core/kernels/transpose_op_functor.h" +#include "tensorflow/core/kernels/transpose_functor.h" #include "tensorflow/core/lib/core/status.h" #include "tensorflow/core/lib/gtl/inlined_vector.h" #include "tensorflow/core/platform/logging.h" diff --git a/tensorflow/core/kernels/sparse_tensor_dense_matmul_op.cc b/tensorflow/core/kernels/sparse_tensor_dense_matmul_op.cc index e528baa6e91..d5b39f398e3 100644 --- a/tensorflow/core/kernels/sparse_tensor_dense_matmul_op.cc +++ b/tensorflow/core/kernels/sparse_tensor_dense_matmul_op.cc @@ -21,7 +21,6 @@ limitations under the License. #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/op_kernel.h" -#include "tensorflow/core/kernels/cwise_ops_common.h" #include "tensorflow/core/kernels/fill_functor.h" namespace tensorflow { diff --git a/tensorflow/core/kernels/split_op.h b/tensorflow/core/kernels/split_lib.h similarity index 93% rename from tensorflow/core/kernels/split_op.h rename to tensorflow/core/kernels/split_lib.h index 7fd0736a089..fdef47ad799 100644 --- a/tensorflow/core/kernels/split_op.h +++ b/tensorflow/core/kernels/split_lib.h @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ -#ifndef TENSORFLOW_KERNELS_SPLIT_OP_H_ -#define TENSORFLOW_KERNELS_SPLIT_OP_H_ +#ifndef TENSORFLOW_KERNELS_SPLIT_LIB_H_ +#define TENSORFLOW_KERNELS_SPLIT_LIB_H_ // Functor definition for SplitOp, must be compilable by nvcc. #include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor" @@ -43,4 +43,4 @@ struct Split { } // namespace functor } // namespace tensorflow -#endif // TENSORFLOW_KERNELS_SPLIT_OP_H_ +#endif // TENSORFLOW_KERNELS_SPLIT_LIB_H_ diff --git a/tensorflow/core/kernels/split_op_cpu.cc b/tensorflow/core/kernels/split_lib_cpu.cc similarity index 97% rename from tensorflow/core/kernels/split_op_cpu.cc rename to tensorflow/core/kernels/split_lib_cpu.cc index e3317cb0f4a..4fc09a7def7 100644 --- a/tensorflow/core/kernels/split_op_cpu.cc +++ b/tensorflow/core/kernels/split_lib_cpu.cc @@ -15,7 +15,7 @@ limitations under the License. #define EIGEN_USE_THREADS -#include "tensorflow/core/kernels/split_op.h" +#include "tensorflow/core/kernels/split_lib.h" #include "tensorflow/core/framework/numeric_types.h" #include "tensorflow/core/framework/register_types.h" diff --git a/tensorflow/core/kernels/split_op_gpu.cu.cc b/tensorflow/core/kernels/split_lib_gpu.cu.cc similarity index 98% rename from tensorflow/core/kernels/split_op_gpu.cu.cc rename to tensorflow/core/kernels/split_lib_gpu.cu.cc index 445e02e887c..05eed86e426 100644 --- a/tensorflow/core/kernels/split_op_gpu.cu.cc +++ b/tensorflow/core/kernels/split_lib_gpu.cu.cc @@ -19,7 +19,7 @@ limitations under the License. #include -#include "tensorflow/core/kernels/split_op.h" +#include "tensorflow/core/kernels/split_lib.h" #include "tensorflow/core/framework/register_types.h" #include "tensorflow/core/framework/tensor_types.h" diff --git a/tensorflow/core/kernels/split_op.cc b/tensorflow/core/kernels/split_op.cc index 37545ed3739..8fae41e7683 100644 --- a/tensorflow/core/kernels/split_op.cc +++ b/tensorflow/core/kernels/split_op.cc @@ -17,13 +17,12 @@ limitations under the License. #define EIGEN_USE_THREADS -#include "tensorflow/core/kernels/split_op.h" - #include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor" #include "tensorflow/core/framework/op_kernel.h" #include "tensorflow/core/framework/register_types.h" #include "tensorflow/core/framework/tensor.h" #include "tensorflow/core/kernels/ops_util.h" +#include "tensorflow/core/kernels/split_lib.h" #include "tensorflow/core/lib/core/status.h" #include "tensorflow/core/lib/gtl/array_slice.h" #if GOOGLE_CUDA diff --git a/tensorflow/core/kernels/tensor_array_ops.cc b/tensorflow/core/kernels/tensor_array_ops.cc index d7732c59762..044a93f5528 100644 --- a/tensorflow/core/kernels/tensor_array_ops.cc +++ b/tensorflow/core/kernels/tensor_array_ops.cc @@ -27,10 +27,8 @@ limitations under the License. #include "tensorflow/core/framework/tensor.h" #include "tensorflow/core/framework/tensor_shape.h" #include "tensorflow/core/framework/types.h" -#include "tensorflow/core/kernels/aggregate_ops.h" -#include "tensorflow/core/kernels/aggregate_ops_cpu.h" -#include "tensorflow/core/kernels/concat_op.h" -#include "tensorflow/core/kernels/split_op.h" +#include "tensorflow/core/kernels/concat_lib.h" +#include "tensorflow/core/kernels/split_lib.h" #include "tensorflow/core/kernels/tensor_array.h" #include "tensorflow/core/lib/core/errors.h" #include "tensorflow/core/lib/strings/strcat.h" diff --git a/tensorflow/core/kernels/transpose_op_functor.h b/tensorflow/core/kernels/transpose_functor.h similarity index 93% rename from tensorflow/core/kernels/transpose_op_functor.h rename to tensorflow/core/kernels/transpose_functor.h index b79c3c7f2fd..b3aa98d3bf0 100644 --- a/tensorflow/core/kernels/transpose_op_functor.h +++ b/tensorflow/core/kernels/transpose_functor.h @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ -#ifndef TENSORFLOW_CORE_KERNELS_TRANSPOSE_OP_FUNCTOR_H_ -#define TENSORFLOW_CORE_KERNELS_TRANSPOSE_OP_FUNCTOR_H_ +#ifndef TENSORFLOW_CORE_KERNELS_TRANSPOSE_FUNCTOR_H_ +#define TENSORFLOW_CORE_KERNELS_TRANSPOSE_FUNCTOR_H_ #include "tensorflow/core/framework/tensor.h" #include "tensorflow/core/framework/tensor_types.h" @@ -78,4 +78,4 @@ void Transpose(const Device& d, const Tensor& in, } // namespace internal } // namespace tensorflow -#endif // TENSORFLOW_CORE_KERNELS_TRANSPOSE_OP_FUNCTOR_H_ +#endif // TENSORFLOW_CORE_KERNELS_TRANSPOSE_FUNCTOR_H_ diff --git a/tensorflow/core/kernels/transpose_op_cpu.cc b/tensorflow/core/kernels/transpose_functor_cpu.cc similarity index 98% rename from tensorflow/core/kernels/transpose_op_cpu.cc rename to tensorflow/core/kernels/transpose_functor_cpu.cc index ea039bf471a..0997b3b2839 100644 --- a/tensorflow/core/kernels/transpose_op_cpu.cc +++ b/tensorflow/core/kernels/transpose_functor_cpu.cc @@ -15,7 +15,7 @@ limitations under the License. #define EIGEN_USE_THREADS -#include "tensorflow/core/kernels/transpose_op_functor.h" +#include "tensorflow/core/kernels/transpose_functor.h" namespace tensorflow { namespace internal { diff --git a/tensorflow/core/kernels/transpose_op_gpu.cu.cc b/tensorflow/core/kernels/transpose_functor_gpu.cu.cc similarity index 98% rename from tensorflow/core/kernels/transpose_op_gpu.cu.cc rename to tensorflow/core/kernels/transpose_functor_gpu.cu.cc index 238ee0a090c..18d675443e6 100644 --- a/tensorflow/core/kernels/transpose_op_gpu.cu.cc +++ b/tensorflow/core/kernels/transpose_functor_gpu.cu.cc @@ -18,7 +18,7 @@ limitations under the License. #define EIGEN_USE_GPU #include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor" -#include "tensorflow/core/kernels/transpose_op_functor.h" +#include "tensorflow/core/kernels/transpose_functor.h" #include "tensorflow/core/util/cuda_kernel_helper.h" namespace tensorflow { diff --git a/tensorflow/core/kernels/transpose_op.cc b/tensorflow/core/kernels/transpose_op.cc index 530e333bff8..88786ec774c 100644 --- a/tensorflow/core/kernels/transpose_op.cc +++ b/tensorflow/core/kernels/transpose_op.cc @@ -23,7 +23,7 @@ limitations under the License. #include "tensorflow/core/framework/register_types.h" #include "tensorflow/core/framework/tensor.h" #include "tensorflow/core/framework/tensor_shape.h" -#include "tensorflow/core/kernels/transpose_op_functor.h" +#include "tensorflow/core/kernels/transpose_functor.h" #include "tensorflow/core/lib/core/status.h" #include "tensorflow/core/lib/strings/str_util.h" #include "tensorflow/core/platform/logging.h" diff --git a/tensorflow/core/kernels/unpack_op.cc b/tensorflow/core/kernels/unpack_op.cc index f3a3b880f49..1fe886a8aef 100644 --- a/tensorflow/core/kernels/unpack_op.cc +++ b/tensorflow/core/kernels/unpack_op.cc @@ -22,7 +22,7 @@ limitations under the License. #include "tensorflow/core/framework/register_types.h" #include "tensorflow/core/framework/tensor.h" #include "tensorflow/core/kernels/ops_util.h" -#include "tensorflow/core/kernels/split_op.h" +#include "tensorflow/core/kernels/split_lib.h" #include "tensorflow/core/lib/core/status.h" #include "tensorflow/core/lib/gtl/array_slice.h" diff --git a/tensorflow/core/ops/function_ops.cc b/tensorflow/core/ops/function_ops.cc index 963e01e6456..276a1e2e18e 100644 --- a/tensorflow/core/ops/function_ops.cc +++ b/tensorflow/core/ops/function_ops.cc @@ -13,15 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ -#include "tensorflow/core/framework/function.h" - -#include - -#include "tensorflow/core/framework/node_def_util.h" #include "tensorflow/core/framework/op.h" -#include "tensorflow/core/lib/core/errors.h" -#include "tensorflow/core/lib/gtl/inlined_vector.h" -#include "tensorflow/core/lib/gtl/map_util.h" namespace tensorflow { diff --git a/tensorflow/models/embedding/BUILD b/tensorflow/models/embedding/BUILD index e4334356d3f..9cd2ab7d527 100644 --- a/tensorflow/models/embedding/BUILD +++ b/tensorflow/models/embedding/BUILD @@ -96,6 +96,7 @@ cc_library( ], visibility = ["//tensorflow:internal"], deps = [ + ":word2vec_ops", "//tensorflow/core", ], alwayslink = 1, diff --git a/tensorflow/python/BUILD b/tensorflow/python/BUILD index eec19daf3b8..2f45b074842 100644 --- a/tensorflow/python/BUILD +++ b/tensorflow/python/BUILD @@ -81,6 +81,7 @@ cc_library( deps = [ "//tensorflow/core:framework", "//tensorflow/core:lib", + "//tensorflow/core:script_ops_op_lib", "//third_party/py/numpy:headers", "//util/python:python_headers", ], diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl index a860d6ae2db..3bfbed993f2 100644 --- a/tensorflow/tensorflow.bzl +++ b/tensorflow/tensorflow.bzl @@ -185,12 +185,11 @@ def tf_cc_tests(tests, deps, linkstatic=0, tags=[]): # Build defs for TensorFlow kernels - # When this target is built using --config=cuda, a cc_library is built # that passes -DGOOGLE_CUDA=1 and '-x cuda', linking in additional # libraries needed by GPU kernels. def tf_gpu_kernel_library(srcs, copts=[], cuda_copts=[], deps=[], hdrs=[], - **kwargs): + **kwargs): cuda_copts = ["-x", "cuda", "-DGOOGLE_CUDA=1", "-nvcc_options=relaxed-constexpr", "-nvcc_options=ftz=true", "--gcudacc_flag=-ftz=true"] + cuda_copts @@ -204,7 +203,6 @@ def tf_gpu_kernel_library(srcs, copts=[], cuda_copts=[], deps=[], hdrs=[], alwayslink=1, **kwargs) - def tf_cuda_library(deps=None, cuda_deps=None, copts=None, **kwargs): """Generate a cc_library with a conditional set of CUDA dependencies. @@ -235,6 +233,73 @@ def tf_cuda_library(deps=None, cuda_deps=None, copts=None, **kwargs): **kwargs) +def tf_kernel_library(name, prefix=None, srcs=None, gpu_srcs=None, hdrs=None, + deps=None, alwayslink=1, **kwargs): + """A rule to build a TensorFlow OpKernel. + + May either specify srcs/hdrs or prefix. Similar to tf_cuda_library, + but with alwayslink=1 by default. If prefix is specified: + * prefix*.cc (except *.cu.cc) is added to srcs + * prefix*.h (except *.cu.h) is added to hdrs + * prefix*.cu.cc and prefix*.h (including *.cu.h) are added to gpu_srcs. + With the exception that test files are excluded. + For example, with prefix = "cast_op", + * srcs = ["cast_op.cc"] + * hdrs = ["cast_op.h"] + * gpu_srcs = ["cast_op_gpu.cu.cc", "cast_op.h"] + * "cast_op_test.cc" is excluded + With prefix = "cwise_op" + * srcs = ["cwise_op_abs.cc", ..., "cwise_op_tanh.cc"], + * hdrs = ["cwise_ops.h", "cwise_ops_common.h"], + * gpu_srcs = ["cwise_op_gpu_abs.cu.cc", ..., "cwise_op_gpu_tanh.cu.cc", + "cwise_ops.h", "cwise_ops_common.h", "cwise_ops_gpu_common.cu.h"] + * "cwise_ops_test.cc" is excluded + """ + if not srcs: + srcs = [] + if not hdrs: + hdrs = [] + if not deps: + deps = [] + gpu_deps = deps + ["//tensorflow/core:cuda"] + + if prefix: + if native.glob([prefix + "*.cu.cc"], exclude = ["*test*"]): + if not gpu_srcs: + gpu_srcs = [] + gpu_srcs = gpu_srcs + native.glob([prefix + "*.cu.cc", prefix + "*.h"], + exclude = ["*test*"]) + srcs = srcs + native.glob([prefix + "*.cc"], + exclude = ["*test*", "*.cu.cc"]) + hdrs = hdrs + native.glob([prefix + "*.h"], exclude = ["*test*", "*.cu.h"]) + if gpu_srcs: + tf_gpu_kernel_library( + name = name + "_gpu", + srcs = gpu_srcs, + deps = gpu_deps, + **kwargs) + cuda_deps = [":" + name + "_gpu"] + else: + cuda_deps = None + tf_cuda_library( + name = name, + srcs = srcs, + hdrs = hdrs, + copts = tf_copts(), + cuda_deps = cuda_deps, + linkstatic = 1, # Seems to be needed since alwayslink is broken in bazel + alwayslink = alwayslink, + deps = deps, + **kwargs) + + +def tf_kernel_libraries(name, prefixes, deps=None, **kwargs): + """Makes one target per prefix, and one target that includes them all.""" + for p in prefixes: + tf_kernel_library(name=p, prefix=p, deps=deps, **kwargs) + native.cc_library(name=name, deps=[":" + p for p in prefixes]) + + # Bazel rules for building swig files. def _py_wrap_cc_impl(ctx): srcs = ctx.files.srcs