未验证 提交 943f2b08 编写于 作者: L lvmengsi 提交者: GitHub

fix 01en (#811)

上级 2a6af012
......@@ -175,14 +175,20 @@ offset = int(data.shape[0]\*ratio)
train_data = data[:offset]
test_data = data[offset:]
def reader_creator(train_data):
def reader():
for d in train_data:
yield d[:-1], d[-1:]
return reader
train_reader = paddle.batch(
paddle.reader.shuffle(
train_data, buf_size=500),
reader_creator(train_data), buf_size=500),
batch_size=BATCH_SIZE)
test_reader = paddle.batch(
paddle.reader.shuffle(
test_data, buf_size=500),
reader_creator(test_data), buf_size=500),
batch_size=BATCH_SIZE)
```
......
......@@ -217,14 +217,20 @@ offset = int(data.shape[0]\*ratio)
train_data = data[:offset]
test_data = data[offset:]
def reader_creator(train_data):
def reader():
for d in train_data:
yield d[:-1], d[-1:]
return reader
train_reader = paddle.batch(
paddle.reader.shuffle(
train_data, buf_size=500),
reader_creator(train_data), buf_size=500),
batch_size=BATCH_SIZE)
test_reader = paddle.batch(
paddle.reader.shuffle(
test_data, buf_size=500),
reader_creator(test_data), buf_size=500),
batch_size=BATCH_SIZE)
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册