未验证 提交 95de28df 编写于 作者: C ceci3 提交者: GitHub

sync to 1.8 (#2088)

上级 211dac1b
......@@ -312,8 +312,8 @@ batch是一个特殊的decorator,它的输入是一个reader,输出是一个
```python
batch_size = 128 # Minibatch size
train_reader = paddle.batch(
paddle.reader.shuffle(
train_reader = fluid.io.batch(
fluid.io.shuffle(
paddle.dataset.mnist.train(), buf_size=60000),
batch_size=batch_size)
```
......
......@@ -311,8 +311,8 @@ Batch is a special decorator. Its input is a reader and its output is a batched
```python
batch_size = 128 # Minibatch size
train_reader = paddle.batch(
paddle.reader.shuffle(
train_reader = fluid.io.batch(
fluid.io.shuffle(
paddle.dataset.mnist.train(), buf_size=60000),
batch_size=batch_size)
```
......
......@@ -93,13 +93,12 @@ def train(args):
exe = fluid.Executor(fluid.CUDAPlace(0))
exe.run(fluid.default_startup_program())
if args.enable_ce:
train_reader = paddle.batch(
train_reader = fluid.io.batch(
paddle.dataset.mnist.train(), batch_size=args.batch_size)
else:
train_reader = paddle.batch(
paddle.reader.shuffle(
paddle.dataset.mnist.train(), buf_size=60000),
train_reader = fluid.io.batch(
fluid.io.shuffle(paddle.dataset.mnist.train(), buf_size=60000),
batch_size=args.batch_size)
NUM_TRAIN_TIMES_OF_DG = 2
......
......@@ -354,8 +354,8 @@ batch是一个特殊的decorator,它的输入是一个reader,输出是一个
```python
batch_size = 128 # Minibatch size
train_reader = paddle.batch(
paddle.reader.shuffle(
train_reader = fluid.io.batch(
fluid.io.shuffle(
paddle.dataset.mnist.train(), buf_size=60000),
batch_size=batch_size)
```
......
......@@ -353,8 +353,8 @@ Batch is a special decorator. Its input is a reader and its output is a batched
```python
batch_size = 128 # Minibatch size
train_reader = paddle.batch(
paddle.reader.shuffle(
train_reader = fluid.io.batch(
fluid.io.shuffle(
paddle.dataset.mnist.train(), buf_size=60000),
batch_size=batch_size)
```
......
......@@ -143,13 +143,13 @@ import sys
```python
BATCH_SIZE = 20
train_reader = paddle.batch(
paddle.reader.shuffle(
train_reader = fluid.io.batch(
fluid.io.shuffle(
paddle.dataset.uci_housing.train(), buf_size=500),
batch_size=BATCH_SIZE)
test_reader = paddle.batch(
paddle.reader.shuffle(
test_reader = fluid.io.batch(
fluid.io.shuffle(
paddle.dataset.uci_housing.test(), buf_size=500),
batch_size=BATCH_SIZE)
```
......@@ -179,13 +179,13 @@ def reader_creator(train_data):
yield d[:-1], d[-1:]
return reader
train_reader = paddle.batch(
paddle.reader.shuffle(
train_reader = fluid.io.batch(
fluid.io.shuffle(
reader_creator(train_data), buf_size=500),
batch_size=BATCH_SIZE)
test_reader = paddle.batch(
paddle.reader.shuffle(
test_reader = fluid.io.batch(
fluid.io.shuffle(
reader_creator(test_data), buf_size=500),
batch_size=BATCH_SIZE)
```
......@@ -349,7 +349,7 @@ with fluid.scope_guard(inference_scope):
fetch_targets] = fluid.io.load_inference_model(params_dirname, infer_exe) # 载入预训练模型
batch_size = 10
infer_reader = paddle.batch(
infer_reader = fluid.io.batch(
paddle.dataset.uci_housing.test(), batch_size=batch_size) # 准备测试集
infer_data = next(infer_reader())
......
......@@ -145,13 +145,13 @@ Next we define the data feeder for training. The data feeder reads a batch of da
```python
BATCH_SIZE = 20
train_reader = paddle.batch(
paddle.reader.shuffle(
train_reader = fluid.io.batch(
fluid.io.shuffle(
paddle.dataset.uci_housing.train(), buf_size=500),
batch_size=BATCH_SIZE)
test_reader = paddle.batch(
paddle.reader.shuffle(
test_reader = fluid.io.batch(
fluid.io.shuffle(
paddle.dataset.uci_housing.test(), buf_size=500),
batch_size=BATCH_SIZE)
```
......@@ -181,13 +181,13 @@ def reader_creator(train_data):
yield d[:-1], d[-1:]
return reader
train_reader = paddle.batch(
paddle.reader.shuffle(
train_reader = fluid.io.batch(
fluid.io.shuffle(
reader_creator(train_data), buf_size=500),
batch_size=BATCH_SIZE)
test_reader = paddle.batch(
paddle.reader.shuffle(
test_reader = fluid.io.batch(
fluid.io.shuffle(
reader_creator(test_data), buf_size=500),
batch_size=BATCH_SIZE)
```
......@@ -351,7 +351,7 @@ with fluid.scope_guard(inference_scope):
fetch_targets] = fluid.io.load_inference_model(params_dirname, infer_exe) # load pre-predict model
batch_size = 10
infer_reader = paddle.batch(
infer_reader = fluid.io.batch(
paddle.dataset.uci_housing.test(), batch_size=batch_size) # prepare test dataset
infer_data = next(infer_reader())
......
......@@ -185,13 +185,13 @@ import sys
```python
BATCH_SIZE = 20
train_reader = paddle.batch(
paddle.reader.shuffle(
train_reader = fluid.io.batch(
fluid.io.shuffle(
paddle.dataset.uci_housing.train(), buf_size=500),
batch_size=BATCH_SIZE)
test_reader = paddle.batch(
paddle.reader.shuffle(
test_reader = fluid.io.batch(
fluid.io.shuffle(
paddle.dataset.uci_housing.test(), buf_size=500),
batch_size=BATCH_SIZE)
```
......@@ -221,13 +221,13 @@ def reader_creator(train_data):
yield d[:-1], d[-1:]
return reader
train_reader = paddle.batch(
paddle.reader.shuffle(
train_reader = fluid.io.batch(
fluid.io.shuffle(
reader_creator(train_data), buf_size=500),
batch_size=BATCH_SIZE)
test_reader = paddle.batch(
paddle.reader.shuffle(
test_reader = fluid.io.batch(
fluid.io.shuffle(
reader_creator(test_data), buf_size=500),
batch_size=BATCH_SIZE)
```
......@@ -391,7 +391,7 @@ with fluid.scope_guard(inference_scope):
fetch_targets] = fluid.io.load_inference_model(params_dirname, infer_exe) # 载入预训练模型
batch_size = 10
infer_reader = paddle.batch(
infer_reader = fluid.io.batch(
paddle.dataset.uci_housing.test(), batch_size=batch_size) # 准备测试集
infer_data = next(infer_reader())
......
......@@ -187,13 +187,13 @@ Next we define the data feeder for training. The data feeder reads a batch of da
```python
BATCH_SIZE = 20
train_reader = paddle.batch(
paddle.reader.shuffle(
train_reader = fluid.io.batch(
fluid.io.shuffle(
paddle.dataset.uci_housing.train(), buf_size=500),
batch_size=BATCH_SIZE)
test_reader = paddle.batch(
paddle.reader.shuffle(
test_reader = fluid.io.batch(
fluid.io.shuffle(
paddle.dataset.uci_housing.test(), buf_size=500),
batch_size=BATCH_SIZE)
```
......@@ -223,13 +223,13 @@ def reader_creator(train_data):
yield d[:-1], d[-1:]
return reader
train_reader = paddle.batch(
paddle.reader.shuffle(
train_reader = fluid.io.batch(
fluid.io.shuffle(
reader_creator(train_data), buf_size=500),
batch_size=BATCH_SIZE)
test_reader = paddle.batch(
paddle.reader.shuffle(
test_reader = fluid.io.batch(
fluid.io.shuffle(
reader_creator(test_data), buf_size=500),
batch_size=BATCH_SIZE)
```
......@@ -393,7 +393,7 @@ with fluid.scope_guard(inference_scope):
fetch_targets] = fluid.io.load_inference_model(params_dirname, infer_exe) # load pre-predict model
batch_size = 10
infer_reader = paddle.batch(
infer_reader = fluid.io.batch(
paddle.dataset.uci_housing.test(), batch_size=batch_size) # prepare test dataset
infer_data = next(infer_reader())
......
......@@ -74,18 +74,16 @@ def main():
batch_size = 20
if args.enable_ce:
train_reader = paddle.batch(
train_reader = fluid.io.batch(
paddle.dataset.uci_housing.train(), batch_size=batch_size)
test_reader = paddle.batch(
test_reader = fluid.io.batch(
paddle.dataset.uci_housing.test(), batch_size=batch_size)
else:
train_reader = paddle.batch(
paddle.reader.shuffle(
paddle.dataset.uci_housing.train(), buf_size=500),
train_reader = fluid.io.batch(
fluid.io.shuffle(paddle.dataset.uci_housing.train(), buf_size=500),
batch_size=batch_size)
test_reader = paddle.batch(
paddle.reader.shuffle(
paddle.dataset.uci_housing.test(), buf_size=500),
test_reader = fluid.io.batch(
fluid.io.shuffle(paddle.dataset.uci_housing.test(), buf_size=500),
batch_size=batch_size)
# feature vector of length 13
......@@ -172,7 +170,7 @@ def main():
] = fluid.io.load_inference_model(params_dirname, infer_exe)
batch_size = 10
infer_reader = paddle.batch(
infer_reader = fluid.io.batch(
paddle.dataset.uci_housing.test(), batch_size=batch_size)
infer_data = next(infer_reader())
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册