60
60
'''''''''
61
61
62
62
.. note ::
63
- 该 API 只在 `Dygraph <../../user_guides/howto/dygraph/DyGraph.html >`_ 模式下生效。
63
+ 该 API 只在 `Dygraph <../../user_guides/howto/dygraph/DyGraph.html >`_ 模式下生效。
64
64
65
65
执行一次优化器并进行参数更新。
66
66
74
74
COPY-FROM: paddle.optimizer.Adam.step
75
75
76
76
append_regularization_ops(parameters_and_grads, regularization=None)
77
- '''''''''
77
+ ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
78
78
创建并添加反向正则化算子,该操作将正则化函数的梯度添加到参数的梯度中并返回修改后的梯度。
79
79
80
80
**参数 **
@@ -91,7 +91,7 @@ append_regularization_ops(parameters_and_grads, regularization=None)
91
91
list[(Variable, Variable)]
92
92
93
93
minimize(loss, startup_program=None, parameters=None, no_grad_set=None)
94
- '''''''''
94
+ ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
95
95
96
96
为网络添加反向计算过程,并根据反向计算所得的梯度,更新 parameters 中的 Parameters,最小化网络损失值 loss。
97
97
@@ -112,10 +112,10 @@ minimize(loss, startup_program=None, parameters=None, no_grad_set=None)
112
112
COPY-FROM: paddle.optimizer.Adam.minimize
113
113
114
114
clear_grad()
115
- '''''''''
115
+ ''''''''''''''''''
116
116
117
117
.. note ::
118
- 该 API 只在 `Dygraph <../../user_guides/howto/dygraph/DyGraph.html >`_ 模式下生效。
118
+ 该 API 只在 `Dygraph <../../user_guides/howto/dygraph/DyGraph.html >`_ 模式下生效。
119
119
120
120
121
121
清除需要优化的参数的梯度。
@@ -125,11 +125,11 @@ clear_grad()
125
125
COPY-FROM: paddle.optimizer.Adam.clear_grad
126
126
127
127
set_lr(value)
128
- '''''''''
128
+ ''''''''''''''''''
129
129
130
130
.. note ::
131
131
132
- 该 API 只在 `Dygraph <../../user_guides/howto/dygraph/DyGraph.html >`_ 模式下生效。
132
+ 该 API 只在 `Dygraph <../../user_guides/howto/dygraph/DyGraph.html >`_ 模式下生效。
133
133
134
134
手动设置当前 ``optimizer `` 的学习率。当使用_LRScheduler 时,无法使用该 API 手动设置学习率,因为这将导致冲突。
135
135
@@ -146,11 +146,11 @@ set_lr(value)
146
146
COPY-FROM: paddle.optimizer.Adam.set_lr
147
147
148
148
set_lr_scheduler(scheduler)
149
- '''''''''
149
+ ''''''''''''''''''''''''''''''''''''
150
150
151
151
.. note ::
152
152
153
- 该 API 只在 `Dygraph <../../user_guides/howto/dygraph/DyGraph.html >`_ 模式下生效。
153
+ 该 API 只在 `Dygraph <../../user_guides/howto/dygraph/DyGraph.html >`_ 模式下生效。
154
154
155
155
手动设置当前 ``optimizer `` 的学习率为 LRScheduler 类。
156
156
@@ -170,7 +170,7 @@ get_lr()
170
170
'''''''''
171
171
172
172
.. note ::
173
- 该 API 只在 `Dygraph <../../user_guides/howto/dygraph/DyGraph.html >`_ 模式下生效。
173
+ 该 API 只在 `Dygraph <../../user_guides/howto/dygraph/DyGraph.html >`_ 模式下生效。
174
174
175
175
获取当前步骤的学习率。当不使用_LRScheduler 时,每次调用的返回值都相同,否则返回当前步骤的学习率。
176
176
@@ -184,7 +184,7 @@ float,当前步骤的学习率。
184
184
COPY-FROM: paddle.optimizer.Adam.get_lr
185
185
186
186
set_state_dict(state_dict)
187
- '''''''''
187
+ ''''''''''''''''''''''''''''''''''''
188
188
189
189
加载优化器状态词典,对于 Adam 优化器,包含 beta1,beta2,momentum 等。如果使用 LRScheduler,global_step 将会改变。
190
190
@@ -201,7 +201,7 @@ set_state_dict(state_dict)
201
201
COPY-FROM: paddle.optimizer.Adam.set_state_dict
202
202
203
203
state_dict(state_dict)
204
- '''''''''
204
+ '''''''''''''''''''''''''''
205
205
206
206
从优化器中获取 state_dict 信息,其中包含所有优化器所需的值,对于 Adam 优化器,包含 beta1,beta2,momentum 等。
207
207
如果使用 LRScheduler,global_step 将被包含在 state_dict 内。如果优化器未被调用 minimize 函数,state_dict 将为空。
0 commit comments