Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
477b23c3
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
接近 2 年 前同步成功
通知
707
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
477b23c3
编写于
9月 11, 2017
作者:
Q
qijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
follow comments
上级
436fbb0d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
8 addition
and
10 deletion
+8
-10
python/paddle/v2/framework/tests/op_test.py
python/paddle/v2/framework/tests/op_test.py
+8
-10
未找到文件。
python/paddle/v2/framework/tests/op_test.py
浏览文件 @
477b23c3
...
@@ -17,7 +17,7 @@ def create_op(scope, op_type, inputs, outputs, attrs):
...
@@ -17,7 +17,7 @@ def create_op(scope, op_type, inputs, outputs, attrs):
kwargs
[
in_name
]
=
[]
kwargs
[
in_name
]
=
[]
if
in_dup
:
if
in_dup
:
sub_in
=
inputs
[
in_name
]
sub_in
=
inputs
[
in_name
]
for
sub_in_name
,
arr
in
sub_in
:
for
sub_in_name
,
_
in
sub_in
:
var
=
scope
.
new_var
(
sub_in_name
)
var
=
scope
.
new_var
(
sub_in_name
)
kwargs
[
in_name
].
append
(
sub_in_name
)
kwargs
[
in_name
].
append
(
sub_in_name
)
else
:
else
:
...
@@ -29,7 +29,7 @@ def create_op(scope, op_type, inputs, outputs, attrs):
...
@@ -29,7 +29,7 @@ def create_op(scope, op_type, inputs, outputs, attrs):
kwargs
[
out_name
]
=
[]
kwargs
[
out_name
]
=
[]
if
out_dup
:
if
out_dup
:
sub_in
=
outputs
[
out_name
]
sub_in
=
outputs
[
out_name
]
for
sub_in_name
,
arr
in
sub_in
:
for
sub_in_name
,
_
in
sub_in
:
var
=
scope
.
new_var
(
sub_in_name
)
var
=
scope
.
new_var
(
sub_in_name
)
kwargs
[
out_name
].
append
(
sub_in_name
)
kwargs
[
out_name
].
append
(
sub_in_name
)
else
:
else
:
...
@@ -47,11 +47,11 @@ def set_input(scope, op, inputs, place):
...
@@ -47,11 +47,11 @@ def set_input(scope, op, inputs, place):
if
in_name
in
inputs
:
if
in_name
in
inputs
:
if
in_dup
:
if
in_dup
:
sub_in
=
inputs
[
in_name
]
sub_in
=
inputs
[
in_name
]
for
sub_in_name
,
arr
in
sub_in
:
for
sub_in_name
,
sub_in_array
in
sub_in
:
var
=
scope
.
find_var
(
sub_in_name
)
var
=
scope
.
find_var
(
sub_in_name
)
tensor
=
var
.
get_tensor
()
tensor
=
var
.
get_tensor
()
tensor
.
set_dims
(
arr
.
shape
)
tensor
.
set_dims
(
sub_in_array
.
shape
)
tensor
.
set
(
arr
,
place
)
tensor
.
set
(
sub_in_array
,
place
)
else
:
else
:
var
=
scope
.
find_var
(
in_name
)
var
=
scope
.
find_var
(
in_name
)
tensor
=
var
.
get_tensor
()
tensor
=
var
.
get_tensor
()
...
@@ -65,7 +65,7 @@ def set_output_grad(scope, op, outputs, place):
...
@@ -65,7 +65,7 @@ def set_output_grad(scope, op, outputs, place):
if
out_name
in
outputs
:
if
out_name
in
outputs
:
if
out_dup
:
if
out_dup
:
sub_out
=
outputs
[
out_name
]
sub_out
=
outputs
[
out_name
]
for
sub_out_name
,
arr
in
sub_out
:
for
sub_out_name
,
sub_out_grad
in
sub_out
:
out_tensor
=
scope
.
find_var
(
sub_out_name
).
get_tensor
()
out_tensor
=
scope
.
find_var
(
sub_out_name
).
get_tensor
()
grad_tensor
=
scope
.
new_var
(
grad_var_name
(
grad_tensor
=
scope
.
new_var
(
grad_var_name
(
sub_out_name
)).
get_tensor
()
sub_out_name
)).
get_tensor
()
...
@@ -169,9 +169,8 @@ class OpTest(unittest.TestCase):
...
@@ -169,9 +169,8 @@ class OpTest(unittest.TestCase):
def
check_output_with_place
(
self
,
place
):
def
check_output_with_place
(
self
,
place
):
self
.
scope
=
core
.
Scope
()
self
.
scope
=
core
.
Scope
()
op_inputs
=
self
.
inputs
if
hasattr
(
self
,
"inputs"
)
else
dict
()
op_inputs
=
self
.
inputs
if
hasattr
(
self
,
"inputs"
)
else
dict
()
op_outputs
=
self
.
outputs
if
hasattr
(
self
,
"outputs"
)
else
dict
()
op_attrs
=
self
.
attrs
if
hasattr
(
self
,
"attrs"
)
else
dict
()
op_attrs
=
self
.
attrs
if
hasattr
(
self
,
"attrs"
)
else
dict
()
self
.
op
=
create_op
(
self
.
scope
,
self
.
op_type
,
op_inputs
,
op_
outputs
,
self
.
op
=
create_op
(
self
.
scope
,
self
.
op_type
,
op_inputs
,
self
.
outputs
,
op_attrs
)
op_attrs
)
if
isinstance
(
place
,
core
.
GPUPlace
)
and
not
self
.
op
.
support_gpu
():
if
isinstance
(
place
,
core
.
GPUPlace
)
and
not
self
.
op
.
support_gpu
():
return
return
...
@@ -232,9 +231,8 @@ class OpTest(unittest.TestCase):
...
@@ -232,9 +231,8 @@ class OpTest(unittest.TestCase):
max_relative_error
=
0.005
):
max_relative_error
=
0.005
):
self
.
scope
=
core
.
Scope
()
self
.
scope
=
core
.
Scope
()
op_inputs
=
self
.
inputs
if
hasattr
(
self
,
"inputs"
)
else
dict
()
op_inputs
=
self
.
inputs
if
hasattr
(
self
,
"inputs"
)
else
dict
()
op_outputs
=
self
.
outputs
if
hasattr
(
self
,
"outputs"
)
else
dict
()
op_attrs
=
self
.
attrs
if
hasattr
(
self
,
"attrs"
)
else
dict
()
op_attrs
=
self
.
attrs
if
hasattr
(
self
,
"attrs"
)
else
dict
()
self
.
op
=
create_op
(
self
.
scope
,
self
.
op_type
,
op_inputs
,
op_
outputs
,
self
.
op
=
create_op
(
self
.
scope
,
self
.
op_type
,
op_inputs
,
self
.
outputs
,
op_attrs
)
op_attrs
)
if
no_grad_set
is
None
:
if
no_grad_set
is
None
:
no_grad_set
=
set
()
no_grad_set
=
set
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录