提交 272071ba 编写于 作者: S Shanqing Cai 提交者: TensorFlower Gardener

tfdbg: migrate debug_ops out of all_kernels

* Creates standalone BUILD target to register tfdbg's Copy* and Debug* ops: tensorflow/core:debug_ops_op_lib
* Makes the public cc BUILD target of tfdbg (tensorflow/core:debug) depend on it
* Through the new dependency path above, the public py BUILD target of tfdbg also obatins the registration of the Copy* and Debug* ops.
* Adds the new debug_ops_op_lib as a dependency of backwards_compatibility_test, so we can continue to track changes to the Copy* and Debug* ops.
* Removes the debug ops from the C and Java JNI library builds. These ops have always been listed as Experimental and were not documented. So this removal should be fine.
* In core/debug/BUILD, add check_deps to assert that tensorflow/core:tensorflow has no dependency on grpc.
Change: 149826469
上级 eb281da2
......@@ -504,6 +504,19 @@ tf_gen_op_libs(
],
)
cc_library(
name = "debug_ops_op_lib",
srcs = ["ops/debug_ops.cc"],
copts = tf_copts(),
linkstatic = 1,
visibility = ["//tensorflow:internal"],
deps = [
":framework",
"//tensorflow/core/kernels:debug_ops",
],
alwayslink = 1,
)
# And one for all user ops
cc_library(
name = "user_ops_op_lib",
......@@ -666,7 +679,6 @@ cc_library(
"//tensorflow/core/kernels:control_flow_ops",
"//tensorflow/core/kernels:ctc_ops",
"//tensorflow/core/kernels:data_flow",
"//tensorflow/core/kernels:debug_ops",
"//tensorflow/core/kernels:fake_quant_ops",
"//tensorflow/core/kernels:function_ops",
"//tensorflow/core/kernels:image",
......
......@@ -17,6 +17,7 @@ licenses(["notice"]) # Apache 2.0
load(
"//tensorflow:tensorflow.bzl",
"check_deps",
"tf_copts",
"tf_cc_test",
"tf_cuda_library",
......@@ -34,6 +35,13 @@ load(
"tf_cuda_tests_tags",
)
# Check that tensorflow/core:tensorflow does not depend on grpc.
check_deps(
name = "core_tensorflow_check_deps",
disallowed_deps = ["@grpc//:grpc++_unsecure"],
deps = ["//tensorflow/core:tensorflow"],
)
tf_proto_library_cc(
name = "debug_service_proto",
srcs = ["debug_service.proto"],
......@@ -52,6 +60,7 @@ cc_library(
deps = [
":debug_graph_utils",
"//tensorflow/core:core_cpu_internal",
"//tensorflow/core:debug_ops_op_lib",
],
alwayslink = 1,
)
......
......@@ -971,6 +971,7 @@ tf_cc_test(
":ops_testutil",
":ops_util",
"//tensorflow/core:core_cpu",
"//tensorflow/core:debug_ops_op_lib",
"//tensorflow/core:framework",
"//tensorflow/core:lib",
"//tensorflow/core:protos_all_cc",
......
......@@ -4373,120 +4373,6 @@ input_max: If range_given, this is the max of the range, otherwise this input
will be ignored.
)doc");
// EXPERIMENTAL: tfdbg debugger-inserted ops.
REGISTER_OP("Copy")
.Input("input: T")
.Output("output: T")
.Attr("T: type")
.Attr("tensor_name: string = ''")
.SetAllowsUninitializedInput()
.Doc(R"doc(
Copy Op.
Performs CPU-to-CPU or GPU-to-GPU deep-copying of tensor, depending on the
device on which the tensor is allocated.
Unlike the CopyHost Op, this op does not have HostMemory constraint on its
input or output.
input: Input tensor.
output: Output tensor, deep-copied from input.
tensor_name: The name of the input tensor.
)doc");
REGISTER_OP("CopyHost")
.Input("input: T")
.Output("output: T")
.Attr("T: type")
.Attr("tensor_name: string = ''")
.SetAllowsUninitializedInput()
.Doc(R"doc(
Copy Host Op.
Performs CPU-to-CPU deep-copying of tensor.
Unlike the Copy Op, this op has HostMemory constraint on its input or output.
input: Input tensor.
output: Output tensor, deep-copied from input.
tensor_name: The name of the input tensor.
)doc");
REGISTER_OP("DebugIdentity")
.Input("input: T")
.Output("output: T")
.Attr("T: type")
.Attr("tensor_name: string = ''")
.Attr("debug_urls: list(string) = []")
.SetAllowsUninitializedInput()
.Doc(R"doc(
Debug Identity Op.
Provides an identity mapping of the non-Ref type input tensor for debugging.
input: Input tensor, non-Reference type.
output: Output tensor that equals the input tensor.
tensor_name: Name of the input tensor.
debug_urls: List of URLs to debug targets, e.g.,
file:///foo/tfdbg_dump, grpc:://localhost:11011
)doc");
REGISTER_OP("DebugNanCount")
.Input("input: T")
.Output("output: int64") // The debug signal (nan count) is int64
.Attr("T: type")
.Attr("tensor_name: string = ''")
.Attr("debug_urls: list(string) = []")
.SetAllowsUninitializedInput()
.Doc(R"doc(
Debug NaN Value Counter Op
Counts number of NaNs in the input tensor, for debugging.
input: Input tensor, non-Reference type.
output: An integer output tensor that is the number of NaNs in the input.
tensor_name: Name of the input tensor.
debug_urls: List of URLs to debug targets, e.g.,
file:///foo/tfdbg_dump, grpc:://localhost:11011
)doc");
REGISTER_OP("DebugNumericSummary")
.Input("input: T")
.Output("output: double")
.Attr("T: type")
.Attr("tensor_name: string = ''")
.Attr("debug_urls: list(string) = []")
.SetAllowsUninitializedInput()
.Doc(R"doc(
Debug Numeric Summary Op.
Provide a basic summary of numeric value types, range and distribution.
input: Input tensor, non-Reference type, float or double.
output: A double tensor of shape [12], the elements of which are:
[0]: is initialized (1.0) or not (0.0).
[1]: total number of elements
[2]: -inf count
[3]: negative element count (excluding -inf)
[4]: zero element count
[5]: positive element count (excluding +inf)
[6]: +inf element count
[7]: NaN element count
Output elements [1:8] are all zero, if the tensor is uninitialized.
[8]: minimum of all non-inf and non-NaN elements.
If uninitialized or no such element exists: +inf.
[9]: maximum of all non-inf and non-NaN elements.
If uninitialized or no such element exists: -inf.
[10]: mean of all non-inf and non-NaN elements.
If uninitialized or no such element exists: NaN.
[11]: variance of all non-inf and non-NaN elements.
If uninitialized or no such element exists: NaN.
tensor_name: Name of the input tensor.
debug_urls: List of URLs to debug targets, e.g.,
file:///foo/tfdbg_dump, grpc:://localhost:11011
)doc");
REGISTER_OP("QuantizeV2")
.Input("input: float")
.Input("min_range: float")
......
......@@ -18,6 +18,7 @@ cc_library(
hdrs = ["op_compatibility_lib.h"],
visibility = ["//visibility:public"],
deps = [
"//tensorflow/core:debug_ops_op_lib",
"//tensorflow/core:framework",
"//tensorflow/core:lib",
"//tensorflow/core:ops",
......
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
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.
==============================================================================*/
// This file registers all TensorFlow Debugger (tfdbg) ops.
#include "tensorflow/core/framework/op.h"
namespace tensorflow {
// EXPERIMENTAL: tfdbg debugger-inserted ops.
REGISTER_OP("Copy")
.Input("input: T")
.Output("output: T")
.Attr("T: type")
.Attr("tensor_name: string = ''")
.SetAllowsUninitializedInput()
.Doc(R"doc(
Copy Op.
Performs CPU-to-CPU or GPU-to-GPU deep-copying of tensor, depending on the
device on which the tensor is allocated.
Unlike the CopyHost Op, this op does not have HostMemory constraint on its
input or output.
input: Input tensor.
output: Output tensor, deep-copied from input.
tensor_name: The name of the input tensor.
)doc");
REGISTER_OP("CopyHost")
.Input("input: T")
.Output("output: T")
.Attr("T: type")
.Attr("tensor_name: string = ''")
.SetAllowsUninitializedInput()
.Doc(R"doc(
Copy Host Op.
Performs CPU-to-CPU deep-copying of tensor.
Unlike the Copy Op, this op has HostMemory constraint on its input or output.
input: Input tensor.
output: Output tensor, deep-copied from input.
tensor_name: The name of the input tensor.
)doc");
REGISTER_OP("DebugIdentity")
.Input("input: T")
.Output("output: T")
.Attr("T: type")
.Attr("tensor_name: string = ''")
.Attr("debug_urls: list(string) = []")
.SetAllowsUninitializedInput()
.Doc(R"doc(
Debug Identity Op.
Provides an identity mapping of the non-Ref type input tensor for debugging.
input: Input tensor, non-Reference type.
output: Output tensor that equals the input tensor.
tensor_name: Name of the input tensor.
debug_urls: List of URLs to debug targets, e.g.,
file:///foo/tfdbg_dump, grpc:://localhost:11011
)doc");
REGISTER_OP("DebugNanCount")
.Input("input: T")
.Output("output: int64") // The debug signal (nan count) is int64
.Attr("T: type")
.Attr("tensor_name: string = ''")
.Attr("debug_urls: list(string) = []")
.SetAllowsUninitializedInput()
.Doc(R"doc(
Debug NaN Value Counter Op
Counts number of NaNs in the input tensor, for debugging.
input: Input tensor, non-Reference type.
output: An integer output tensor that is the number of NaNs in the input.
tensor_name: Name of the input tensor.
debug_urls: List of URLs to debug targets, e.g.,
file:///foo/tfdbg_dump, grpc:://localhost:11011
)doc");
REGISTER_OP("DebugNumericSummary")
.Input("input: T")
.Output("output: double")
.Attr("T: type")
.Attr("tensor_name: string = ''")
.Attr("debug_urls: list(string) = []")
.SetAllowsUninitializedInput()
.Doc(R"doc(
Debug Numeric Summary Op.
Provide a basic summary of numeric value types, range and distribution.
input: Input tensor, non-Reference type, float or double.
output: A double tensor of shape [12], the elements of which are:
[0]: is initialized (1.0) or not (0.0).
[1]: total number of elements
[2]: -inf count
[3]: negative element count (excluding -inf)
[4]: zero element count
[5]: positive element count (excluding +inf)
[6]: +inf element count
[7]: NaN element count
Output elements [1:8] are all zero, if the tensor is uninitialized.
[8]: minimum of all non-inf and non-NaN elements.
If uninitialized or no such element exists: +inf.
[9]: maximum of all non-inf and non-NaN elements.
If uninitialized or no such element exists: -inf.
[10]: mean of all non-inf and non-NaN elements.
If uninitialized or no such element exists: NaN.
[11]: variance of all non-inf and non-NaN elements.
If uninitialized or no such element exists: NaN.
tensor_name: Name of the input tensor.
debug_urls: List of URLs to debug targets, e.g.,
file:///foo/tfdbg_dump, grpc:://localhost:11011
)doc");
} // namespace tensorflow
\ No newline at end of file
......@@ -86,13 +86,11 @@ genrule(
"@farmhash_archive//:COPYING",
"@gemmlowp//:LICENSE",
"@gif_archive//:COPYING",
"@grpc//:LICENSE",
"@highwayhash//:LICENSE",
"@jemalloc//:COPYING",
"@jpeg//:LICENSE.md",
"@libxsmm_archive//:LICENSE",
"@local_config_sycl//sycl:LICENSE.text",
"@nanopb_git//:LICENSE.txt",
"@png_archive//:LICENSE",
"@protobuf//:LICENSE",
"@zlib_archive//:zlib.h",
......@@ -114,13 +112,11 @@ genrule(
"@farmhash_archive//:COPYING",
"@gemmlowp//:LICENSE",
"@gif_archive//:COPYING",
"@grpc//:LICENSE",
"@highwayhash//:LICENSE",
"@jemalloc//:COPYING",
"@jpeg//:LICENSE.md",
"@libxsmm_archive//:LICENSE",
"@local_config_sycl//sycl:LICENSE.text",
"@nanopb_git//:LICENSE.txt",
"@png_archive//:LICENSE",
"@protobuf//:LICENSE",
"@zlib_archive//:zlib.h",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册