Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
2e783663
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
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看板
提交
2e783663
编写于
10月 24, 2017
作者:
D
dangqingqing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable to output LoD in fetch_op and check output LoD in the op unit test.
上级
fa72e544
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
21 addition
and
5 deletion
+21
-5
paddle/operators/fetch_op.cc
paddle/operators/fetch_op.cc
+1
-0
python/paddle/v2/framework/tests/op_test.py
python/paddle/v2/framework/tests/op_test.py
+15
-4
python/paddle/v2/framework/tests/test_lstm_op.py
python/paddle/v2/framework/tests/test_lstm_op.py
+5
-1
未找到文件。
paddle/operators/fetch_op.cc
浏览文件 @
2e783663
...
@@ -52,6 +52,7 @@ class FetchOp : public framework::OperatorBase {
...
@@ -52,6 +52,7 @@ class FetchOp : public framework::OperatorBase {
// FIXME(yuyang18): Should we assume the fetch operator always generate
// FIXME(yuyang18): Should we assume the fetch operator always generate
// CPU outputs?
// CPU outputs?
dst_item
.
CopyFrom
(
src_item
,
platform
::
CPUPlace
(),
dev_ctx
);
dst_item
.
CopyFrom
(
src_item
,
platform
::
CPUPlace
(),
dev_ctx
);
dst_item
.
set_lod
(
src_item
.
lod
());
VLOG
(
3
)
<<
"Fetch variable "
<<
fetch_var_name
<<
" to "
<<
out_name
;
VLOG
(
3
)
<<
"Fetch variable "
<<
fetch_var_name
<<
" to "
<<
out_name
;
}
}
...
...
python/paddle/v2/framework/tests/op_test.py
浏览文件 @
2e783663
...
@@ -333,20 +333,31 @@ class OpTest(unittest.TestCase):
...
@@ -333,20 +333,31 @@ class OpTest(unittest.TestCase):
type
(
sub_out
))
type
(
sub_out
))
for
sub_out_name
,
expect
in
sub_out
:
for
sub_out_name
,
expect
in
sub_out
:
idx
=
find_actual
(
sub_out_name
,
fetch_list
)
idx
=
find_actual
(
sub_out_name
,
fetch_list
)
actual
=
outs
[
idx
]
actual_t
=
np
.
array
(
outs
[
idx
])
expect_t
=
expect
[
0
]
\
if
isinstance
(
expect
,
tuple
)
else
expect
self
.
assertTrue
(
self
.
assertTrue
(
np
.
allclose
(
np
.
allclose
(
actual
,
expec
t
,
atol
=
atol
),
actual
_t
,
expect_
t
,
atol
=
atol
),
"Output ("
+
sub_out_name
+
") has diff at "
+
"Output ("
+
sub_out_name
+
") has diff at "
+
str
(
place
))
str
(
place
))
if
isinstance
(
expect
,
tuple
):
self
.
assertListEqual
(
actual_t
.
lod
(),
expect
[
1
],
"Output ("
+
sub_out_name
+
") has different lod at "
+
str
(
place
))
else
:
else
:
idx
=
find_actual
(
out_name
,
fetch_list
)
idx
=
find_actual
(
out_name
,
fetch_list
)
actual
=
outs
[
idx
]
actual
_t
=
outs
[
idx
]
expect
=
self
.
outputs
[
out_name
]
expect
=
self
.
outputs
[
out_name
]
expect_t
=
expect
[
0
]
if
isinstance
(
expect
,
tuple
)
else
expect
self
.
assertTrue
(
self
.
assertTrue
(
np
.
allclose
(
np
.
allclose
(
actual
,
expec
t
,
atol
=
atol
),
actual
_t
,
expect_
t
,
atol
=
atol
),
"Output ("
+
out_name
+
") has diff at "
+
str
(
place
))
"Output ("
+
out_name
+
") has diff at "
+
str
(
place
))
if
isinstance
(
expect
,
tuple
):
self
.
assertListEqual
(
actual_t
.
lod
(),
expect
[
1
],
"Output ("
+
out_name
+
") has different lod at "
+
str
(
place
))
def
check_output
(
self
,
atol
=
1e-5
):
def
check_output
(
self
,
atol
=
1e-5
):
places
=
[
core
.
CPUPlace
()]
places
=
[
core
.
CPUPlace
()]
...
...
python/paddle/v2/framework/tests/test_lstm_op.py
浏览文件 @
2e783663
...
@@ -155,7 +155,11 @@ class TestLstmOp(OpTest):
...
@@ -155,7 +155,11 @@ class TestLstmOp(OpTest):
'Weight'
:
w
,
'Weight'
:
w
,
'Bias'
:
b
'Bias'
:
b
}
}
self
.
outputs
=
{
'Hidden'
:
h
,
'Cell'
:
c
,
'BatchGate'
:
g_sort
}
self
.
outputs
=
{
'Hidden'
:
(
h
,
self
.
lod
),
'Cell'
:
(
c
,
self
.
lod
),
'BatchGate'
:
g_sort
}
self
.
attrs
=
{
self
.
attrs
=
{
'usePeepholes'
:
True
,
'usePeepholes'
:
True
,
'isReverse'
:
self
.
is_reverse
,
'isReverse'
:
self
.
is_reverse
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录