Home | History | Annotate | Download | only in debug
      1 /* Copyright 2016 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 
     16 syntax = "proto3";
     17 
     18 package tensorflow;
     19 
     20 import "tensorflow/core/framework/tensor.proto";
     21 import "tensorflow/core/profiler/tfprof_log.proto";
     22 import "tensorflow/core/protobuf/debug.proto";
     23 import "tensorflow/core/util/event.proto";
     24 
     25 // Reply message from EventListener to the client, i.e., to the source of the
     26 // Event protocol buffers, e.g., debug ops inserted by a debugged runtime to a
     27 // TensorFlow graph being executed.
     28 message EventReply {
     29   message DebugOpStateChange {
     30     enum State {
     31       STATE_UNSPECIFIED = 0;
     32       DISABLED = 1;
     33       READ_ONLY = 2;
     34       READ_WRITE = 3;
     35     }
     36 
     37     State state = 1;
     38     string node_name = 2;
     39     int32 output_slot = 3;
     40     string debug_op = 4;
     41   }
     42 
     43   repeated DebugOpStateChange debug_op_state_changes = 1;
     44 
     45   // New tensor value to override the current tensor value with.
     46   TensorProto tensor = 2;
     47   // TODO(cais): Make use of this field to implement overriding of tensor value
     48   // during debugging.
     49 }
     50 
     51 // Data on the traceback of a debugged call, e.g., a Session.run() call, or the
     52 // execution of an eager operation.
     53 message CallTraceback {
     54   enum CallType {
     55     UNSPECIFIED = 0;
     56     GRAPH_EXECUTION = 1;
     57     EAGER_EXECUTION = 2;
     58   }
     59 
     60   CallType call_type = 1;
     61 
     62   // A key for the call. For example, for graph execution, this is a key
     63   // consisting of the names of the fed and fetched tensors.
     64   string call_key = 2;
     65 
     66   // Traceback stack for the origin of the call event.
     67   // For graph execution, this is the stack of the Session.run() call.
     68   // For eager execution, this is the stack of the Python line that invokes
     69   // the execution of the eager op.
     70   tfprof.CodeDef origin_stack = 3;
     71 
     72   // Keeps track of the mapping from integer IDs in `origin_stack` to actual
     73   // string values (e.g., file paths, function names).
     74   map<int64, string> origin_id_to_string = 4;
     75 
     76   // Traceback for the graph (if any) involved in the call.
     77   tfprof.OpLogProto graph_traceback = 5;
     78 
     79   // Version of the graph in `graph_traceback` (if any).
     80   int64 graph_version = 6;
     81 }
     82 
     83 // EventListener: Receives Event protos, e.g., from debugged TensorFlow
     84 // runtime(s).
     85 service EventListener {
     86   // Client(s) can use this RPC method to send the EventListener Event protos.
     87   // The Event protos can hold information such as:
     88   //   1) intermediate tensors from a debugged graph being executed, which can
     89   //      be sent from DebugIdentity ops configured with grpc URLs.
     90   //   2) GraphDefs of partition graphs, which can be sent from special debug
     91   //      ops that get executed immediately after the beginning of the graph
     92   //      execution.
     93   rpc SendEvents(stream Event) returns (stream EventReply);
     94 
     95   // Send the tracebacks of a TensorFlow execution call.
     96   rpc SendTracebacks(CallTraceback) returns (EventReply);
     97 
     98   // Send a collection of source code files being debugged.
     99   rpc SendSourceFiles(DebuggedSourceFiles) returns (EventReply);
    100 }
    101