OptimizerConfig.proto 4.1 KB
Newer Older
D
dzhwinter 已提交
1
syntax = "proto2";
L
liaogang 已提交
2

D
dzhwinter 已提交
3 4 5 6 7
option optimize_for = LITE_RUNTIME;

package paddle;

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

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.

L
liaogang 已提交
24 25 26 27 28
  // 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 ];
D
dzhwinter 已提交
29 30 31
}

message AdagradConfig {
L
liaogang 已提交
32 33 34
  // Adagrad
  // epsilon: float >= 0.
  // decay: float >= 0. Learning rate decay over each update.
D
dzhwinter 已提交
35

L
liaogang 已提交
36 37 38 39 40
  // 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 ];
D
dzhwinter 已提交
41 42 43 44 45 46 47 48
}

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.
L
liaogang 已提交
49 50
  // reference : [Adam - A Method for Stochastic
  // Optimization](http://arxiv.org/abs/1412.6980v8)
D
dzhwinter 已提交
51 52 53 54 55 56
  optional double beta_1 = 41;
  optional double beta_2 = 42;
  optional double epsilon = 43;
  optional double decay = 44;
}

D
dzhwinter 已提交
57
message ConstLrConfig {
D
dzhwinter 已提交
58
  // learninRate Policy
L
liaogang 已提交
59
  optional double learning_rate = 1 [ default = 1.0 ];
D
dzhwinter 已提交
60 61
}

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

69
message TensorProto {
L
liaogang 已提交
70 71 72 73 74 75 76 77
  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;
  }
D
dzhwinter 已提交
78
  optional DataType data_type = 1;
79 80 81
  repeated bytes content = 2;
}

D
dongzhihong 已提交
82 83
message LrPolicyState {
  // learninRate Policy
L
liaogang 已提交
84
  optional double learning_rate = 1 [ default = 1.0 ];
D
dongzhihong 已提交
85 86 87 88
  optional double lr_decay_a = 2;
  optional double lr_decay_b = 3;
}

D
dzhwinter 已提交
89
message SGDOptimizerState {
D
dongzhihong 已提交
90
  optional LrPolicyState lr_state = 101;
D
dzhwinter 已提交
91
  optional double num_sample_passed = 104;
D
dzhwinter 已提交
92 93 94 95
  // state
  optional TensorProto parameter = 1;
  optional TensorProto momentums = 2;
}
D
dzhwinter 已提交
96

D
dzhwinter 已提交
97 98
message AdadeltaOptimizerState {
  // learning rate policy
D
dongzhihong 已提交
99
  optional LrPolicyState lr_state = 101;
D
dzhwinter 已提交
100 101 102
  optional double num_sample_passed = 104;
  // state
  optional TensorProto parameter = 1;
D
dzhwinter 已提交
103 104 105
  optional TensorProto accum_gradient = 2;
  optional TensorProto accum_delta = 3;
  optional TensorProto update_delta = 4;
D
dzhwinter 已提交
106
}
D
dzhwinter 已提交
107

D
dzhwinter 已提交
108
message AdagradOptimizerState {
D
dongzhihong 已提交
109
  optional LrPolicyState lr_state = 101;
D
dzhwinter 已提交
110 111 112 113 114
  optional double num_sample_passed = 104;
  // state
  optional TensorProto parameter = 1;
  optional TensorProto accum_gradient = 2;
}
D
dzhwinter 已提交
115

D
dzhwinter 已提交
116
message AdamOptimizerState {
D
dongzhihong 已提交
117
  optional LrPolicyState lr_state = 101;
D
dzhwinter 已提交
118 119 120 121 122
  optional double num_sample_passed = 104;
  // state
  optional TensorProto parameter = 1;
  optional TensorProto momentums = 2;
  optional TensorProto velocitys = 3;
123
}
D
dzhwinter 已提交
124 125

message OptimizerConfig {
D
dzhwinter 已提交
126
  enum Optimizer {
L
liaogang 已提交
127 128 129 130
    SGD = 1;
    Adadelta = 2;
    Adagrad = 3;
    Adam = 4;
D
dzhwinter 已提交
131
  }
D
dzhwinter 已提交
132
  optional Optimizer optimizer = 1;
D
dzhwinter 已提交
133 134 135 136 137
  optional SGDConfig sgd = 3;
  optional AdadeltaConfig adadelta = 4;
  optional AdagradConfig adagrad = 5;
  optional AdamConfig adam = 6;

D
dzhwinter 已提交
138
  enum LrPolicy {
L
liaogang 已提交
139 140
    Const = 0;
    Linear = 1;
D
dzhwinter 已提交
141
  }
D
dzhwinter 已提交
142
  optional LrPolicy lr_policy = 11;
D
dzhwinter 已提交
143 144
  optional ConstLrConfig const_lr = 12;
  optional LinearLrConfig linear_lr = 13;
D
dzhwinter 已提交
145 146

  // common config of optimizer
D
dzhwinter 已提交
147 148 149 150
  // gradient clip when L2 exceeding value
  optional double clip_norm = 101;
  // gradient clip when L1 exceeding value
  optional double clip_value = 102;
D
dzhwinter 已提交
151
}