From 369ac0c4035791772433b8c966b2ab45aa8d4b3d Mon Sep 17 00:00:00 2001 From: Tink_Y <31891223+tink2123@users.noreply.github.com> Date: Sat, 29 Dec 2018 15:45:06 +0800 Subject: [PATCH] add missed lines for programming guide (#517) * fixed missed lines for programming guide * Update programming_guide.md --- .../beginners_guide/programming_guide/programming_guide.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/fluid/beginners_guide/programming_guide/programming_guide.md b/doc/fluid/beginners_guide/programming_guide/programming_guide.md index b17414a6f..14fbe554e 100644 --- a/doc/fluid/beginners_guide/programming_guide/programming_guide.md +++ b/doc/fluid/beginners_guide/programming_guide/programming_guide.md @@ -384,6 +384,9 @@ outs = exe.run( #定义损失函数 cost = fluid.layers.square_error_cost(input=y_predict,label=y) avg_cost = fluid.layers.mean(cost) + #定义优化方法 + sgd_optimizer = fluid.optimizer.SGD(learning_rate=0.01) + sgd_optimizer.minimize(avg_cost) #参数初始化 cpu = fluid.core.CPUPlace() exe = fluid.Executor(cpu) -- GitLab