// Defines the text format for adding per-op overrides for client
// language op code generators.

syntax = "proto3";

package tensorflow;
import "tensorflow/core/framework/attr_value.proto";

// Used to override the default API & behavior in the generated code
// for client languages, from what you would get from the OpDef alone.
// This is so we can evolve the API while remaining backwards
// compatible when interpretting old graphs.  Overrides go in an
// "op_gen_overrides.pbtxt" file with a text-format OpGenOverrides
// message.  Right now these only apply to the C++ API.
// TODO(josh11b): In the future there will be a common set of overrides
// and per-client-language overrides.
//
// WARNING: Be *very* careful using these features -- these overrides
// can change the semantics of existing code.  These changes may need
// to wait until a major release of TensorFlow to avoid breaking our
// compatibility promises.
message OpGenOverride {
  // Name of the op to apply overrides to.
  string name = 1;

  // Do not include this op in the generated API.
  // If `skip` is true, all other overrides are ignored for this op.
  bool skip = 2;

  // Hide this op by putting it into an internal namespace (or whatever
  // is appropriate in the target language).
  bool hide = 3;

  // Use a different name in the API than the op's name. Note that
  // the op's name in `backticks` will also be replaced in the docs.
  string rename_to = 4;

  // Create *additional* API endpoints with different names (contrast
  // with rename_to, which affects the original name).
  repeated string alias = 5;

  // Map the name of an attr to a new default value to use.  This
  // default will be used when creating new graphs, as opposed to the
  // default in the OpDef, which will be used when interpreting old
  // GraphDefs.  If this attr is also renamed (using attr_rename
  // below), use the original name of the attr.
  message AttrDefault {
    string name = 1;
    AttrValue value = 2;
  }
  repeated AttrDefault attr_default = 6;

  // Change the name used to access attrs/inputs/outputs in the API
  // from what is used in the GraphDef.  Note that these names in
  // `backticks` will also be replaced in the docs.
  message Rename {
    string from = 1;
    string to = 2;
  }
  repeated Rename attr_rename = 7;
  repeated Rename input_rename = 8;
  repeated Rename output_rename = 9;
}

message OpGenOverrides {
  repeated OpGenOverride op = 1;
}
