提交 915a08af 编写于 作者: 开心的小妮's avatar 开心的小妮

fix GradientClipByGlobalNorm. test=develop

上级 c1abc349
...@@ -58,8 +58,8 @@ GradientClipByGlobalNorm ...@@ -58,8 +58,8 @@ GradientClipByGlobalNorm
# return Parameter.name=="fc_0.w_0" # return Parameter.name=="fc_0.w_0"
# clip = fluid.clip.GradientClipByGlobalNorm(clip_norm=1.0, need_clip=fileter_func) # clip = fluid.clip.GradientClipByGlobalNorm(clip_norm=1.0, need_clip=fileter_func)
sgd_optimizer = fluid.optimizer.SGDOptimizer(learning_rate=0.1) sgd_optimizer = fluid.optimizer.SGDOptimizer(learning_rate=0.1, grad_clip=clip)
sgd_optimizer.minimize(loss, grad_clip=clip) sgd_optimizer.minimize(loss)
place = fluid.CPUPlace() place = fluid.CPUPlace()
exe = fluid.Executor(place) exe = fluid.Executor(place)
...@@ -95,5 +95,5 @@ GradientClipByGlobalNorm ...@@ -95,5 +95,5 @@ GradientClipByGlobalNorm
# clip = fluid.clip.GradientClipByGlobalNorm(clip_norm=1.0, need_clip=fileter_func) # clip = fluid.clip.GradientClipByGlobalNorm(clip_norm=1.0, need_clip=fileter_func)
sgd_optimizer = fluid.optimizer.SGD( sgd_optimizer = fluid.optimizer.SGD(
learning_rate=0.1, parameter_list=linear.parameters()) learning_rate=0.1, parameter_list=linear.parameters(), grad_clip=clip)
sgd_optimizer.minimize(loss, grad_clip=clip) sgd_optimizer.minimize(loss)
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册