1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. |
---|---|
2 | |
3 | Licensed under the Apache License, Version 2.0 (the "License"); |
4 | you may not use this file except in compliance with the License. |
5 | You may obtain a copy of the License at |
6 | |
7 | http://www.apache.org/licenses/LICENSE-2.0 |
8 | |
9 | Unless required by applicable law or agreed to in writing, software |
10 | distributed under the License is distributed on an "AS IS" BASIS, |
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | See the License for the specific language governing permissions and |
13 | limitations under the License. |
14 | ==============================================================================*/ |
15 | // This file registers all TensorFlow Debugger (tfdbg) ops. |
16 | |
17 | #include "tensorflow/core/framework/common_shape_fns.h" |
18 | #include "tensorflow/core/framework/op.h" |
19 | #include "tensorflow/core/framework/shape_inference.h" |
20 | |
21 | namespace tensorflow { |
22 | |
23 | // TensorFlow Debugger-inserted ops. |
24 | // These ops are used only internally by tfdbg. There is no API for users to |
25 | // direct create them. Users can create them indirectly by using |
26 | // RunOptions.debug_options during Session::Run() call. See tfdbg documentation |
27 | // for more details. |
28 | REGISTER_OP("Copy") |
29 | .Input("input: T") |
30 | .Output("output: T") |
31 | .Attr("T: type") |
32 | .Attr("tensor_name: string = ''") |
33 | .Attr("debug_ops_spec: list(string) = []") |
34 | .SetAllowsUninitializedInput() |
35 | .SetShapeFn(shape_inference::UnchangedShape); |
36 | |
37 | REGISTER_OP("CopyHost") |
38 | .Input("input: T") |
39 | .Output("output: T") |
40 | .Attr("T: type") |
41 | .Attr("tensor_name: string = ''") |
42 | .Attr("debug_ops_spec: list(string) = []") |
43 | .SetAllowsUninitializedInput() |
44 | .SetShapeFn(shape_inference::UnchangedShape); |
45 | |
46 | REGISTER_OP("DebugIdentity") |
47 | .Input("input: T") |
48 | .Output("output: T") |
49 | .Attr("T: type") |
50 | .Attr("device_name: string = ''") |
51 | .Attr("tensor_name: string = ''") |
52 | .Attr("debug_urls: list(string) = []") |
53 | .Attr("gated_grpc: bool = false") |
54 | .SetAllowsUninitializedInput() |
55 | .SetShapeFn(shape_inference::UnchangedShape); |
56 | |
57 | REGISTER_OP("DebugNanCount") |
58 | .Input("input: T") |
59 | .Output("output: int64") // The debug signal (nan count) is int64 |
60 | .Attr("T: type") |
61 | .Attr("device_name: string = ''") |
62 | .Attr("tensor_name: string = ''") |
63 | .Attr("debug_urls: list(string) = []") |
64 | .Attr("gated_grpc: bool = false") |
65 | .SetAllowsUninitializedInput() |
66 | .SetShapeFn(shape_inference::ScalarShape); |
67 | |
68 | REGISTER_OP("DebugNumericSummary") |
69 | .Input("input: T") |
70 | .Output("output: double") |
71 | .Attr("T: type") |
72 | .Attr("device_name: string = ''") |
73 | .Attr("tensor_name: string = ''") |
74 | .Attr("debug_urls: list(string) = []") |
75 | .Attr("lower_bound: float = -inf") |
76 | .Attr("upper_bound: float = inf") |
77 | .Attr("mute_if_healthy: bool = false") |
78 | .Attr("gated_grpc: bool = false") |
79 | .SetAllowsUninitializedInput() |
80 | // Note: this could return a more specific shape if needed in future. |
81 | .SetShapeFn(shape_inference::UnknownShape); |
82 | |
83 | // tfdbg v2. |
84 | REGISTER_OP("DebugIdentityV2") |
85 | .Input("input: T") |
86 | .Output("output: T") |
87 | .Attr("T: type") |
88 | .Attr("tfdbg_context_id: string = ''") |
89 | .Attr("op_name: string = ''") |
90 | .Attr("output_slot: int = -1") |
91 | .Attr("tensor_debug_mode: int = -1") |
92 | .Attr("debug_urls: list(string) = []") |
93 | .Attr("circular_buffer_size: int = 1000") |
94 | .Attr("tfdbg_run_id: string = ''") |
95 | .SetIsStateful() |
96 | .SetShapeFn(shape_inference::UnchangedShape); |
97 | |
98 | REGISTER_OP("DebugNumericSummaryV2") |
99 | .Input("input: T") |
100 | .Output("output: output_dtype") |
101 | .Attr("output_dtype: {float32, float64} = DT_FLOAT") |
102 | .Attr("T: type") |
103 | .Attr("tensor_debug_mode: int = -1") |
104 | .Attr("tensor_id: int = -1") |
105 | .SetShapeFn(shape_inference::UnknownShape); |
106 | } // namespace tensorflow |
107 |