Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
e7b3a5f1
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
提交
e7b3a5f1
编写于
4月 05, 2017
作者:
Y
Yu Yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Follow comments
上级
a125ef1a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
8 deletion
+15
-8
python/paddle/v2/__init__.py
python/paddle/v2/__init__.py
+2
-2
python/paddle/v2/evaluator.py
python/paddle/v2/evaluator.py
+11
-4
python/paddle/v2/tests/test_layer.py
python/paddle/v2/tests/test_layer.py
+2
-2
未找到文件。
python/paddle/v2/__init__.py
浏览文件 @
e7b3a5f1
...
@@ -21,7 +21,7 @@ import data_type
...
@@ -21,7 +21,7 @@ import data_type
import
topology
import
topology
import
data_feeder
import
data_feeder
import
networks
import
networks
import
evaluator
s
import
evaluator
from
.
import
dataset
from
.
import
dataset
from
.
import
reader
from
.
import
reader
from
.
import
plot
from
.
import
plot
...
@@ -36,7 +36,7 @@ import plot
...
@@ -36,7 +36,7 @@ import plot
__all__
=
[
__all__
=
[
'optimizer'
,
'layer'
,
'activation'
,
'parameters'
,
'init'
,
'trainer'
,
'optimizer'
,
'layer'
,
'activation'
,
'parameters'
,
'init'
,
'trainer'
,
'event'
,
'data_type'
,
'attr'
,
'pooling'
,
'data_feeder'
,
'dataset'
,
'reader'
,
'event'
,
'data_type'
,
'attr'
,
'pooling'
,
'data_feeder'
,
'dataset'
,
'reader'
,
'topology'
,
'networks'
,
'infer'
,
'plot'
,
'evaluator
s
'
'topology'
,
'networks'
,
'infer'
,
'plot'
,
'evaluator'
]
]
...
...
python/paddle/v2/evaluator
s
.py
→
python/paddle/v2/evaluator.py
浏览文件 @
e7b3a5f1
...
@@ -20,21 +20,28 @@ __all__ = []
...
@@ -20,21 +20,28 @@ __all__ = []
def
initialize
():
def
initialize
():
def
convert_to_new_name
(
nm
):
return
nm
[:
-
len
(
"_evaluator"
)]
for
__ev_name__
in
filter
(
lambda
x
:
x
.
endswith
(
'_evaluator'
),
evs
.
__all__
):
for
__ev_name__
in
filter
(
lambda
x
:
x
.
endswith
(
'_evaluator'
),
evs
.
__all__
):
__ev__
=
getattr
(
evs
,
__ev_name__
)
__ev__
=
getattr
(
evs
,
__ev_name__
)
if
hasattr
(
__ev__
,
'argspec'
):
if
hasattr
(
__ev__
,
'argspec'
):
argspec
=
__ev__
.
argspec
argspec
=
__ev__
.
argspec
else
:
else
:
argspec
=
inspect
.
getargspec
(
__ev__
)
argspec
=
inspect
.
getargspec
(
__ev__
)
parent_names
=
filter
(
lambda
x
:
x
in
[
'input'
,
'label'
],
argspec
.
args
)
parent_names
=
filter
(
lambda
x
:
x
in
[
'input'
,
'label'
,
'weight'
],
argspec
.
args
)
v2_ev
=
__convert_to_v2__
(
v2_ev
=
__convert_to_v2__
(
__ev_name__
,
__ev_name__
,
parent_names
=
parent_names
,
parent_names
=
parent_names
,
is_default_name
=
'name'
in
argspec
.
args
,
is_default_name
=
'name'
in
argspec
.
args
,
attach_parent
=
True
)
attach_parent
=
True
)
globals
()[
__ev_name__
]
=
v2_ev
globals
()[
__ev_name__
].
__name__
=
__ev_name__
__new_name__
=
convert_to_new_name
(
__ev_name__
)
__all__
.
append
(
__ev_name__
)
globals
()[
__new_name__
]
=
v2_ev
globals
()[
__new_name__
].
__name__
=
__new_name__
__all__
.
append
(
__new_name__
)
initialize
()
initialize
()
python/paddle/v2/tests/test_layer.py
浏览文件 @
e7b3a5f1
...
@@ -19,7 +19,7 @@ import paddle.v2.data_type as data_type
...
@@ -19,7 +19,7 @@ import paddle.v2.data_type as data_type
import
paddle.v2.layer
as
layer
import
paddle.v2.layer
as
layer
import
paddle.v2.pooling
as
pooling
import
paddle.v2.pooling
as
pooling
import
paddle.v2.networks
as
networks
import
paddle.v2.networks
as
networks
import
paddle.v2.evaluator
s
as
evaluators
import
paddle.v2.evaluator
as
evaluator
pixel
=
layer
.
data
(
name
=
'pixel'
,
type
=
data_type
.
dense_vector
(
128
))
pixel
=
layer
.
data
(
name
=
'pixel'
,
type
=
data_type
.
dense_vector
(
128
))
label
=
layer
.
data
(
name
=
'label'
,
type
=
data_type
.
integer_value
(
10
))
label
=
layer
.
data
(
name
=
'label'
,
type
=
data_type
.
integer_value
(
10
))
...
@@ -273,7 +273,7 @@ class EvaluatorTest(unittest.TestCase):
...
@@ -273,7 +273,7 @@ class EvaluatorTest(unittest.TestCase):
lbl
=
layer
.
data
(
name
=
'label'
,
type
=
data_type
.
integer_value
(
10
))
lbl
=
layer
.
data
(
name
=
'label'
,
type
=
data_type
.
integer_value
(
10
))
cost
=
layer
.
cross_entropy_cost
(
input
=
output
,
label
=
lbl
)
cost
=
layer
.
cross_entropy_cost
(
input
=
output
,
label
=
lbl
)
evaluator
s
.
classification_error_evaluat
or
(
input
=
output
,
label
=
lbl
)
evaluator
.
classification_err
or
(
input
=
output
,
label
=
lbl
)
print
layer
.
parse_network
(
cost
)
print
layer
.
parse_network
(
cost
)
print
layer
.
parse_network
(
output
)
print
layer
.
parse_network
(
output
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录