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