Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
963de16b
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
963de16b
编写于
2月 22, 2017
作者:
H
Helin Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change from google python style to pep 287
上级
59ca13a3
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
24 addition
and
31 deletion
+24
-31
python/paddle/reader/decorator.py
python/paddle/reader/decorator.py
+24
-31
未找到文件。
python/paddle/reader/decorator.py
浏览文件 @
963de16b
...
@@ -21,19 +21,17 @@ import random
...
@@ -21,19 +21,17 @@ import random
def
shuffle
(
reader
,
buf_size
):
def
shuffle
(
reader
,
buf_size
):
"""Creates a data reader whose data output is suffled.
"""
Creates a data reader whose data output is suffled.
Output from the iterator that created by original reader will be
Output from the iterator that created by original reader will be
buffered into shuffle buffer, and then shuffled. The size of shuffle buffer
buffered into shuffle buffer, and then shuffled. The size of shuffle buffer
is determined by argument buf_size.
is determined by argument buf_size.
Args:
:param reader: the original reader whose output will be shuffled.
reader: the original reader whose output will be
:param buf_size: shuffle buffer size.
shuffled.
buf_size: shuffle buffer size.
Returns:
:returns:the new reader whose output is shuffled.
the new reader whose output is shuffled.
"""
"""
def
data_reader
():
def
data_reader
():
...
@@ -55,7 +53,8 @@ def shuffle(reader, buf_size):
...
@@ -55,7 +53,8 @@ def shuffle(reader, buf_size):
def
chain
(
*
readers
):
def
chain
(
*
readers
):
"""Creates a data reader whose output is the outputs of input data
"""
Creates a data reader whose output is the outputs of input data
readers chained together.
readers chained together.
If input readers output following data entries:
If input readers output following data entries:
...
@@ -65,11 +64,8 @@ def chain(*readers):
...
@@ -65,11 +64,8 @@ def chain(*readers):
The chained reader will output:
The chained reader will output:
[0, 0, 0, 1, 1, 1, 2, 2, 2]
[0, 0, 0, 1, 1, 1, 2, 2, 2]
Args:
:param readers: input readers.
readers: input readers.
:returns: the new data reader.
Returns:
the new data reader.
"""
"""
def
reader
():
def
reader
():
...
@@ -88,24 +84,22 @@ class ComposeNotAligned(ValueError):
...
@@ -88,24 +84,22 @@ class ComposeNotAligned(ValueError):
def
compose
(
*
readers
,
**
kwargs
):
def
compose
(
*
readers
,
**
kwargs
):
"""Creates a data reader whose output is the combination of input readers.
"""
Creates a data reader whose output is the combination of input readers.
If input readers output following data entries:
If input readers output following data entries:
(1, 2) 3 (4, 5)
(1, 2) 3 (4, 5)
The composed reader will output:
The composed reader will output:
(1, 2, 3, 4, 5)
(1, 2, 3, 4, 5)
Args:
:*readers: readers that will be composed together.
*readers: readers that will be composed together.
:check_alignment: if True, will check if input readers are aligned
check_alignment: If True, will check if input readers are aligned
correctly. If False, will not check alignment and trailing outputs
correctly. If False, will not check alignment and trailing outputs
will be discarded. Defaults to True.
will be discarded. Defaults to True.
Returns:
:returns: the new data reader.
the new data reader.
Raises:
:raises ComposeNotAligned: outputs of readers are not aligned.
ComposeNotAligned: outputs of readers are not aligned.
Will not raise when check_alignment is set to False.
Will not raise when check_alignment is set to False.
"""
"""
check_alignment
=
kwargs
.
pop
(
'check_alignment'
,
True
)
check_alignment
=
kwargs
.
pop
(
'check_alignment'
,
True
)
...
@@ -136,18 +130,17 @@ def compose(*readers, **kwargs):
...
@@ -136,18 +130,17 @@ def compose(*readers, **kwargs):
def
buffered
(
reader
,
size
):
def
buffered
(
reader
,
size
):
"""Creates a buffered data reader.
"""
Creates a buffered data reader.
The buffered data reader will read and save data entries into a
The buffered data reader will read and save data entries into a
buffer. Reading from the buffered data reader will proceed as long
buffer. Reading from the buffered data reader will proceed as long
as the buffer is not empty.
as the buffer is not empty.
Args:
:param reader: the data reader to read from.
reader: the data reader to read from.
:param size: max buffer size.
size: max buffer size.
Returns:
:returns: the buffered data reader.
The buffered data reader.
"""
"""
class
EndSignal
():
class
EndSignal
():
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录