Give tensorflow/core/kernels/ its own BUILD file.

Change: 115379524
This commit is contained in:
Josh Levenberg 2016-02-23 13:53:22 -08:00 committed by TensorFlower Gardener
parent e7c6ffde2e
commit 2408e359cc
26 changed files with 1561 additions and 249 deletions

View File

@ -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",

File diff suppressed because it is too large Load Diff

View File

@ -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.

View File

@ -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 <vector>
@ -39,4 +39,4 @@ void ConcatGPU(const Eigen::GpuDevice& d,
} // namespace tensorflow
#endif // TENSORFLOW_KERNELS_CONCAT_OP_H_
#endif // TENSORFLOW_KERNELS_CONCAT_LIB_H_

View File

@ -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 <vector>
#include "tensorflow/core/framework/register_types.h"
#include "tensorflow/core/util/work_sharder.h"

View File

@ -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 {

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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 {

View File

@ -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<Eigen::ThreadPoolDevice, T> {
} // namespace functor
} // namespace tensorflow
#endif // TENSORFLOW_KERNELS_SPLIT_OP_H_
#endif // TENSORFLOW_KERNELS_SPLIT_LIB_H_

View File

@ -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"

View File

@ -19,7 +19,7 @@ limitations under the License.
#include <stdio.h>
#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"

View File

@ -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

View File

@ -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"

View File

@ -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_

View File

@ -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 {

View File

@ -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 {

View File

@ -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"

View File

@ -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"

View File

@ -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 <unordered_set>
#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 {

View File

@ -96,6 +96,7 @@ cc_library(
],
visibility = ["//tensorflow:internal"],
deps = [
":word2vec_ops",
"//tensorflow/core",
],
alwayslink = 1,

View File

@ -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",
],

View File

@ -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