提交 374867d1 编写于 作者: L liaogang

Fix python code

上级 d728c29f
...@@ -368,7 +368,7 @@ where $n$ is the number of processed samples, $lr_{0}$ is the learning_rate. ...@@ -368,7 +368,7 @@ where $n$ is the number of processed samples, $lr_{0}$ is the learning_rate.
`cifar.train10()` will yield records during each pass, after shuffling, a batch input is generated for training. `cifar.train10()` will yield records during each pass, after shuffling, a batch input is generated for training.
```python ```python
reader=paddle.reader.batch( reader=paddle.batch(
paddle.reader.shuffle( paddle.reader.shuffle(
paddle.dataset.cifar.train10(), buf_size=50000), paddle.dataset.cifar.train10(), buf_size=50000),
batch_size=128) batch_size=128)
...@@ -397,10 +397,9 @@ def event_handler(event): ...@@ -397,10 +397,9 @@ def event_handler(event):
sys.stdout.flush() sys.stdout.flush()
if isinstance(event, paddle.event.EndPass): if isinstance(event, paddle.event.EndPass):
result = trainer.test( result = trainer.test(
reader=paddle.reader.batch( reader=paddle.batch(
paddle.dataset.cifar.test10(), batch_size=128), paddle.dataset.cifar.test10(), batch_size=128),
reader_dict={'image': 0, feeding=feeding)
'label': 1})
print "\nTest with Pass %d, %s" % (event.pass_id, result.metrics) print "\nTest with Pass %d, %s" % (event.pass_id, result.metrics)
``` ```
......
...@@ -375,7 +375,7 @@ $$ lr = lr_{0} * a^ {\lfloor \frac{n}{ b}\rfloor} $$ ...@@ -375,7 +375,7 @@ $$ lr = lr_{0} * a^ {\lfloor \frac{n}{ b}\rfloor} $$
cifar.train10()每次产生一条样本,在完成shuffle和batch之后,作为训练的输入。 cifar.train10()每次产生一条样本,在完成shuffle和batch之后,作为训练的输入。
```python ```python
reader=paddle.reader.batch( reader=paddle.batch(
paddle.reader.shuffle( paddle.reader.shuffle(
paddle.dataset.cifar.train10(), buf_size=50000), paddle.dataset.cifar.train10(), buf_size=50000),
batch_size=128) batch_size=128)
...@@ -402,10 +402,9 @@ def event_handler(event): ...@@ -402,10 +402,9 @@ def event_handler(event):
sys.stdout.flush() sys.stdout.flush()
if isinstance(event, paddle.event.EndPass): if isinstance(event, paddle.event.EndPass):
result = trainer.test( result = trainer.test(
reader=paddle.reader.batch( reader=paddle.batch(
paddle.dataset.cifar.test10(), batch_size=128), paddle.dataset.cifar.test10(), batch_size=128),
reader_dict={'image': 0, feeding=feeding)
'label': 1})
print "\nTest with Pass %d, %s" % (event.pass_id, result.metrics) print "\nTest with Pass %d, %s" % (event.pass_id, result.metrics)
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册