• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Defines the text format for including per-op API definition and
2// overrides for client language op code generators.
3
4syntax = "proto3";
5
6package tensorflow;
7option cc_enable_arenas = true;
8option java_outer_classname = "ApiDefProtos";
9option java_multiple_files = true;
10option java_package = "org.tensorflow.framework";
11option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/api_def_go_proto";
12import "tensorflow/core/framework/attr_value.proto";
13
14// Used to specify and override the default API & behavior in the
15// generated code for client languages, from what you would get from
16// the OpDef alone. There will be a set of ApiDefs that are common
17// to all client languages, and another set per client language.
18// The per-client-language ApiDefs will inherit values from the
19// common ApiDefs which it can either replace or modify.
20//
21// We separate the API definition from the OpDef so we can evolve the
22// API while remaining backwards compatible when interpretting old
23// graphs.  Overrides go in an "api_def.pbtxt" file with a text-format
24// ApiDefs message.
25//
26// WARNING: Be *very* careful changing the API for any existing op --
27// you can change the semantics of existing code.  These changes may
28// need to wait until a major release of TensorFlow to avoid breaking
29// our compatibility promises.
30message ApiDef {
31  // Name of the op (in the OpDef) to specify the API for.
32  string graph_op_name = 1;
33  // If this op is deprecated, set deprecation message to the message
34  // that should be logged when this op is used.
35  // The message should indicate alternative op to use, if any.
36  string deprecation_message = 12;
37  // Major version when the op will be deleted. For e.g. set this
38  // value to 2 if op API should be removed in TensorFlow 2.0 and
39  // deprecated in versions before that.
40  int32 deprecation_version = 13;
41
42  enum Visibility {
43    // Normally this is "VISIBLE" unless you are inheriting a
44    // different value from another ApiDef.
45    DEFAULT_VISIBILITY = 0;
46    // Publicly visible in the API.
47    VISIBLE = 1;
48    // Do not include this op in the generated API. If visibility is
49    // set to 'SKIP', other fields are ignored for this op.
50    SKIP = 2;
51    // Hide this op by putting it into an internal namespace (or whatever
52    // is appropriate in the target language).
53    HIDDEN = 3;
54  }
55  Visibility visibility = 2;
56
57  // If you specify any endpoint, this will replace all of the
58  // inherited endpoints.  The first endpoint should be the
59  // "canonical" endpoint, and should not be deprecated (unless all
60  // endpoints are deprecated).
61  message Endpoint {
62    // Name should be either like "CamelCaseName" or
63    // "Package.CamelCaseName". Client-language-specific ApiDefs may
64    // use a snake_case convention instead of CamelCase.
65    string name = 1;
66
67    // Set if this endpoint is deprecated. If set to true, a message suggesting
68    // to use a non-deprecated endpoint instead will be printed. If all
69    // endpoints are deprecated, set deprecation_message in ApiDef instead.
70    bool deprecated = 3;
71
72    // Major version when an endpoint will be deleted. For e.g. set this
73    // value to 2 if endpoint should be removed in TensorFlow 2.0 and
74    // deprecated in versions before that.
75    int32 deprecation_version = 4;
76  }
77  repeated Endpoint endpoint = 3;
78
79  message Arg {
80    string name = 1;
81
82    // Change the name used to access this arg in the API from what
83    // is used in the GraphDef.  Note that these names in `backticks`
84    // will also be replaced in the summary & description fields.
85    string rename_to = 2;
86
87    // Note: this will replace any inherited arg doc. There is no
88    // current way of modifying arg descriptions (other than replacing
89    // them entirely) as can be done with op descriptions.
90    string description = 3;
91  }
92  repeated Arg in_arg = 4;
93  repeated Arg out_arg = 5;
94  // List of original in_arg names to specify new argument order.
95  // Length of arg_order should be either empty to keep current order
96  // or match size of in_arg.
97  repeated string arg_order = 11;
98
99  // Description of the graph-construction-time configuration of this
100  // Op.  That is to say, this describes the attr fields that will
101  // be specified in the NodeDef.
102  message Attr {
103    string name = 1;
104
105    // Change the name used to access this attr in the API from what
106    // is used in the GraphDef.  Note that these names in `backticks`
107    // will also be replaced in the summary & description fields.
108    string rename_to = 2;
109
110    // Specify a new default value to use for this attr.  This default
111    // will be used when creating new graphs, as opposed to the
112    // default in the OpDef, which will be used when interpreting old
113    // GraphDefs.
114    AttrValue default_value = 3;
115
116    // Note: this will replace any inherited attr doc, there is no current
117    // way of modifying attr descriptions as can be done with op descriptions.
118    string description = 4;
119  }
120  repeated Attr attr = 6;
121
122  // One-line human-readable description of what the Op does.
123  string summary = 7;
124
125  // Additional, longer human-readable description of what the Op does.
126  string description = 8;
127
128  // Modify an existing/inherited description by adding text to the beginning
129  // or end.
130  string description_prefix = 9;
131  string description_suffix = 10;
132}
133
134message ApiDefs {
135  repeated ApiDef op = 1;
136}
137