未验证 提交 d0c40c0f 编写于 作者: N Nicky Chan 提交者: GitHub

Merge pull request #563 from nickyfantasy/fix-readme-optimizer

Fix trainer error in readme due to optimizer function
......@@ -142,6 +142,15 @@ def train_program():
return avg_loss
```
### Optimizer Function 配置
在下面的 `SGD optimizer``learning_rate` 是训练的速度,与网络的训练收敛速度有关系。
```python
def optimizer_program():
return fluid.optimizer.SGD(learning_rate=0.001)
```
### 定义运算场所
我们可以定义运算是发生在CPU还是GPU
......@@ -157,7 +166,7 @@ place = fluid.CUDAPlace(0) if use_cuda else fluid.CPUPlace()
trainer = fluid.Trainer(
train_func=train_program,
place=place,
optimizer_func=fluid.optimizer.SGD(learning_rate=0.001))
optimizer_func=optimizer_program)
```
### 开始提供数据
......
......@@ -149,6 +149,14 @@ def train_program():
return avg_loss
```
### Optimizer Function Configuration
In the following `SGD` optimizer, `learning_rate` specifies the learning rate in the optimization procedure.
```python
def optimizer_program():
return fluid.optimizer.SGD(learning_rate=0.001)
```
### Specify Place
Specify your training environment, you should specify if the training is on CPU or GPU.
......@@ -165,7 +173,7 @@ The trainer will take the `train_program` as input.
trainer = fluid.Trainer(
train_func=train_program,
place=place,
optimizer_func=fluid.optimizer.SGD(learning_rate=0.001))
optimizer_func=optimizer_program)
```
### Feeding Data
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册