syntax = "proto3";

package tensorflow;
option cc_enable_arenas = true;
option java_outer_classname = "ControlFlowProtos";
option java_multiple_files = true;
option java_package = "org.tensorflow.framework";

// Control flow context related protocol buffers.

// Protocol buffer representing the values in ControlFlowContext.
message ValuesDef {
  // Value names that have been seen in this context.
  repeated string values = 1;

  // Value names referenced by but external to this context.
  map<string, string> external_values = 2;
}

// Protocol buffer representing a CondContext object.
message CondContextDef {
  // Name of the context.
  string context_name = 1;

  // Name of the pred tensor.
  string pred_name = 2;

  // Name of the pivot tensor.
  string pivot_name = 3;

  // Branch prediction. 0 or 1.
  int32 branch = 4;

  // Values and external values in control flow context.
  ValuesDef values_def = 5;
}

// Protocol buffer representing a WhileContext object.
message WhileContextDef {
  // Name of the context.
  string context_name = 1;

  // The number of iterations allowed to run in parallel.
  int32 parallel_iterations = 2;

  // Whether backprop is enabled for this while loop.
  bool back_prop = 3;

  // Whether GPU-CPU memory swap is enabled for this loop.
  bool swap_memory = 4;

  // Name of the pivot tensor.
  string pivot_name = 5;

  // Name of the pivot_for_pred tensor.
  string pivot_for_pred_name = 6;

  // Name of the pivot_for_body tensor.
  string pivot_for_body_name = 7;

  // List of names for exit tensors.
  repeated string loop_exit_names = 8;

  // Values and external values in control flow context.
  ValuesDef values_def = 9;
}
