OptimizerConfig.proto 3.6 KB
Newer Older
D
dzhwinter 已提交
1 2 3 4 5 6 7
syntax = "proto2";
 
option optimize_for = LITE_RUNTIME;

package paddle;

message SGDConfig {
D
dzhwinter 已提交
8
  // SGD
D
dzhwinter 已提交
9 10 11 12 13 14
  // momentum: float >= 0. Parameter updates momentum.
  // decay: float >= 0. Learning rate decay over each update.
  // nesterov: boolean. Whether to apply Nesterov momentum.
  optional double momentum = 21 [default = 0.0];
  optional double decay = 23 [default = 0.0];
  optional bool nesterov =24 [default = false];
D
dzhwinter 已提交
15

16
}
D
dzhwinter 已提交
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55


message AdadeltaConfig {
  // Adadelta
  // It is recommended to leave it at the default value.
  // rho: float >= 0.
  // epsilon: float >= 0. Fuzz factor.
  // decay: float >= 0. Learning rate decay over each update.

  // reference : [Adadelta - an adaptive learning rate method](http://arxiv.org/abs/1212.5701)
  optional double rho = 33 [default = 0.90];
  optional double epsilon = 31 [default = 1e-5];
  optional double decay = 32 [default = 0.0];

}

message AdagradConfig {
// Adagrad
// epsilon: float >= 0.
// decay: float >= 0. Learning rate decay over each update.

// reference : [Adaptive Subgradient Methods for Online Learning and Stochastic Optimization](http://www.jmlr.org/papers/volume12/duchi11a/duchi11a.pdf)
  optional double epsilon = 41 [default = 1e-5];
  optional double decay = 42 [default = 0.0];
}

message AdamConfig {
  // Adaj
  // beta_1: float, 0 < beta < 1. Generally close to 1.
  // beta_2: float, 0 < beta < 1. Generally close to 1.
  // epsilon: float >= 0. Fuzz factor.
  // decay: float >= 0. Learning rate decay over each update.
  // reference : [Adam - A Method for Stochastic Optimization](http://arxiv.org/abs/1412.6980v8)
  optional double beta_1 = 41;
  optional double beta_2 = 42;
  optional double epsilon = 43;
  optional double decay = 44;
}

D
dzhwinter 已提交
56 57
message ConstLr {
  // learninRate Policy
D
dzhwinter 已提交
58
  required double learning_rate = 1 [default = 1.0];
D
dzhwinter 已提交
59 60 61
}

message LinearLr {
D
dzhwinter 已提交
62
  // learninRate Policy
D
dzhwinter 已提交
63 64 65
  required double learning_rate = 1 [default = 1.0];
  optional double lr_decay_a = 2;
  optional double lr_decay_b = 3;
D
dzhwinter 已提交
66 67
}

68 69 70 71 72 73 74 75 76 77 78 79 80 81
message TensorProto {
enum DataType {
  PADDLE_ELEMENT_TYPE_INT32 = 0;
  PADDLE_ELEMENT_TYPE_UINT32 = 1;
  PADDLE_ELEMENT_TYPE_INT64 = 2;
  PADDLE_ELEMENT_TYPE_UINT64 = 3;
  PADDLE_ELEMENT_TYPE_FLOAT32 = 4;
  PADDLE_ELEMENT_TYPE_FLOAT64 = 5;
}
  required DataType data_type = 1;
  repeated bytes content = 2;
}

message OptimizerState {
D
dzhwinter 已提交
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
  optional double learning_rate = 101;
  optional double lr_decay_a = 102;
  optional double lr_decay_b = 103;
  optional double num_sample_passed = 104;
  // momentum
  optional TensorProto parameter = 105;
  optional TensorProto momentums = 1;

  // adadelta
  optional TensorProto accum_gradient = 2;
  optional TensorProto accum_delta = 3;
  optional TensorProto update_delta = 4;

  // adam
  optional TensorProto velocitys = 5;

  // momentum
  optional double momentum = 6;
  optional double decay = 7;
  optional bool nesterov = 8;

  // adadelta
  optional double rho = 9;
  optional double epsilon = 10;

  // adam
  optional double beta_1 = 11;
  optional double beta_2 = 12;

111
}
D
dzhwinter 已提交
112 113

message OptimizerConfig {
D
dzhwinter 已提交
114 115 116 117 118 119 120
  enum Optimizer {
   SGD = 1;
   Adadelta = 2;
   Adagrad = 3;
   Adam = 4;
  }
  required Optimizer optimizer = 1;
D
dzhwinter 已提交
121 122 123 124 125
  optional SGDConfig sgd = 3;
  optional AdadeltaConfig adadelta = 4;
  optional AdagradConfig adagrad = 5;
  optional AdamConfig adam = 6;

D
dzhwinter 已提交
126 127 128 129 130
  enum LrPolicy {
   ConstLr = 0;
   LinearLr = 1;
  }
  required LrPolicy lr_policy = 11;
D
dzhwinter 已提交
131
  optional ConstLr const_lr = 12;
D
dzhwinter 已提交
132
  optional LinearLr linear_lr = 13;
D
dzhwinter 已提交
133 134

  // common config of optimizer
D
dzhwinter 已提交
135 136 137 138
  // gradient clip when L2 exceeding value
  optional double clip_norm = 101;
  // gradient clip when L1 exceeding value
  optional double clip_value = 102;
D
dzhwinter 已提交
139
}