Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
ea00e8e2
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看板
提交
ea00e8e2
编写于
12月 13, 2016
作者:
Y
Yu Yang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of github.com:baidu/Paddle into feature/clean_sparse_row_matrix
上级
fa2c06fb
1c26ce2d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
12 deletion
+14
-12
python/paddle/trainer/PyDataProvider2.py
python/paddle/trainer/PyDataProvider2.py
+14
-12
未找到文件。
python/paddle/trainer/PyDataProvider2.py
浏览文件 @
ea00e8e2
...
@@ -202,24 +202,26 @@ class CheckWrapper(object):
...
@@ -202,24 +202,26 @@ class CheckWrapper(object):
for
each
in
item
:
for
each
in
item
:
callback
(
each
)
callback
(
each
)
class
CheckInputTypeWrapper
(
object
):
class
CheckInputTypeWrapper
(
object
):
def
__init__
(
self
,
generator
,
input_types
,
logger
):
def
__init__
(
self
,
generator
,
input_types
,
logger
):
self
.
generator
=
generator
self
.
generator
=
generator
self
.
input_types
=
input_types
self
.
input_types
=
input_types
self
.
logger
=
logger
self
.
logger
=
logger
def
__call__
(
self
,
obj
,
filename
):
def
__call__
(
self
,
obj
,
filename
):
for
items
in
self
.
generator
(
obj
,
filename
):
for
items
in
self
.
generator
(
obj
,
filename
):
try
:
try
:
# dict type is required for input_types when item is dict type
# dict type is required for input_types when item is dict type
assert
(
isinstance
(
items
,
dict
)
and
\
assert
(
isinstance
(
items
,
dict
)
and
\
not
isinstance
(
self
.
input_types
,
dict
))
==
False
not
isinstance
(
self
.
input_types
,
dict
))
==
False
yield
items
yield
items
except
AssertionError
as
e
:
except
AssertionError
as
e
:
self
.
logger
.
error
(
self
.
logger
.
error
(
"%s type is required for input type but got %s"
%
"%s type is required for input type but got %s"
%
(
repr
(
type
(
items
)),
repr
(
type
(
self
.
input_types
))))
(
repr
(
type
(
items
)),
repr
(
type
(
self
.
input_types
))))
raise
raise
def
provider
(
input_types
=
None
,
def
provider
(
input_types
=
None
,
should_shuffle
=
None
,
should_shuffle
=
None
,
...
@@ -374,8 +376,8 @@ def provider(input_types=None,
...
@@ -374,8 +376,8 @@ def provider(input_types=None,
self
.
generator
=
InputOrderWrapper
(
self
.
generator
,
self
.
generator
=
InputOrderWrapper
(
self
.
generator
,
self
.
input_order
)
self
.
input_order
)
else
:
else
:
self
.
generator
=
CheckInputTypeWrapper
(
self
.
generator
,
self
.
slots
,
self
.
generator
=
CheckInputTypeWrapper
(
self
.
logger
)
self
.
generator
,
self
.
slots
,
self
.
logger
)
if
self
.
check
:
if
self
.
check
:
self
.
generator
=
CheckWrapper
(
self
.
generator
,
self
.
slots
,
self
.
generator
=
CheckWrapper
(
self
.
generator
,
self
.
slots
,
check_fail_continue
,
check_fail_continue
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录