1syntax = "proto3"; 2 3package tensorflow; 4 5option cc_enable_arenas = true; 6option java_outer_classname = "VariableProtos"; 7option java_multiple_files = true; 8option java_package = "org.tensorflow.framework"; 9option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/variable_go_proto"; 10 11// Indicates when a distributed variable will be synced. 12enum VariableSynchronization { 13 // `AUTO`: Indicates that the synchronization will be determined by the 14 // current `DistributionStrategy` (eg. With `MirroredStrategy` this would be 15 // `ON_WRITE`). 16 VARIABLE_SYNCHRONIZATION_AUTO = 0; 17 // `NONE`: Indicates that there will only be one copy of the variable, so 18 // there is no need to sync. 19 VARIABLE_SYNCHRONIZATION_NONE = 1; 20 // `ON_WRITE`: Indicates that the variable will be updated across devices 21 // every time it is written. 22 VARIABLE_SYNCHRONIZATION_ON_WRITE = 2; 23 // `ON_READ`: Indicates that the variable will be aggregated across devices 24 // when it is read (eg. when checkpointing or when evaluating an op that uses 25 // the variable). 26 VARIABLE_SYNCHRONIZATION_ON_READ = 3; 27} 28 29// Indicates how a distributed variable will be aggregated. 30enum VariableAggregation { 31 // `NONE`: This is the default, giving an error if you use a 32 // variable-update operation with multiple replicas. 33 VARIABLE_AGGREGATION_NONE = 0; 34 // `SUM`: Add the updates across replicas. 35 VARIABLE_AGGREGATION_SUM = 1; 36 // `MEAN`: Take the arithmetic mean ("average") of the updates across 37 // replicas. 38 VARIABLE_AGGREGATION_MEAN = 2; 39 // `ONLY_FIRST_REPLICA`: This is for when every replica is performing the same 40 // update, but we only want to perform the update once. Used, e.g., for the 41 // global step counter. 42 VARIABLE_AGGREGATION_ONLY_FIRST_REPLICA = 3; 43} 44 45// Protocol buffer representing a Variable. 46message VariableDef { 47 // Name of the variable tensor. 48 string variable_name = 1; 49 50 // Name of the tensor holding the variable's initial value. 51 string initial_value_name = 6; 52 53 // Name of the initializer op. 54 string initializer_name = 2; 55 56 // Name of the snapshot tensor. 57 string snapshot_name = 3; 58 59 // Support for saving variables as slices of a larger variable. 60 SaveSliceInfoDef save_slice_info_def = 4; 61 62 // Whether to represent this as a ResourceVariable. 63 bool is_resource = 5; 64 65 // Whether this variable should be trained. 66 bool trainable = 7; 67 68 // Indicates when a distributed variable will be synced. 69 VariableSynchronization synchronization = 8; 70 71 // Indicates how a distributed variable will be aggregated. 72 VariableAggregation aggregation = 9; 73} 74 75message SaveSliceInfoDef { 76 // Name of the full variable of which this is a slice. 77 string full_name = 1; 78 // Shape of the full variable. 79 repeated int64 full_shape = 2; 80 // Offset of this variable into the full variable. 81 repeated int64 var_offset = 3; 82 // Shape of this variable. 83 repeated int64 var_shape = 4; 84} 85