Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
TonyTonyFun
Paddle
提交
cfb0c12e
P
Paddle
项目概览
TonyTonyFun
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cfb0c12e
编写于
1月 08, 2020
作者:
D
Double_V
提交者:
Zeng Jinle
1月 08, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix grad diff over limit when the data type of input is double,test=develop (#22161)
上级
ccac636d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
14 deletion
+14
-14
python/paddle/fluid/tests/unittests/test_prroi_pool_op.py
python/paddle/fluid/tests/unittests/test_prroi_pool_op.py
+14
-14
未找到文件。
python/paddle/fluid/tests/unittests/test_prroi_pool_op.py
浏览文件 @
cfb0c12e
...
...
@@ -30,7 +30,7 @@ class TestPRROIPoolOp(OpTest):
self
.
prRoIPool
=
PyPrRoIPool
()
self
.
outs
=
self
.
prRoIPool
.
compute
(
self
.
x
,
self
.
rois
,
self
.
output_channels
,
self
.
spatial_scale
,
self
.
pooled_height
,
self
.
pooled_width
).
astype
(
'float
64
'
)
self
.
pooled_height
,
self
.
pooled_width
).
astype
(
'float
32
'
)
self
.
inputs
=
{
'X'
:
self
.
x
,
'ROIs'
:
(
self
.
rois
[:,
1
:
5
],
self
.
rois_lod
)}
self
.
attrs
=
{
'output_channels'
:
self
.
output_channels
,
...
...
@@ -53,7 +53,7 @@ class TestPRROIPoolOp(OpTest):
self
.
pooled_height
=
4
self
.
pooled_width
=
4
self
.
x
=
np
.
random
.
random
(
self
.
x_dim
).
astype
(
'float
64
'
)
self
.
x
=
np
.
random
.
random
(
self
.
x_dim
).
astype
(
'float
32
'
)
def
make_rois
(
self
):
rois
=
[]
...
...
@@ -73,7 +73,7 @@ class TestPRROIPoolOp(OpTest):
roi
=
[
bno
,
x1
,
y1
,
x2
,
y2
]
rois
.
append
(
roi
)
self
.
rois_num
=
len
(
rois
)
self
.
rois
=
np
.
array
(
rois
).
astype
(
'float
64
'
)
self
.
rois
=
np
.
array
(
rois
).
astype
(
'float
32
'
)
def
setUp
(
self
):
self
.
op_type
=
'prroi_pool'
...
...
@@ -94,9 +94,9 @@ class TestPRROIPoolOp(OpTest):
x
=
fluid
.
layers
.
data
(
name
=
"X"
,
shape
=
[
self
.
channels
,
self
.
height
,
self
.
width
],
dtype
=
"float
64
"
)
dtype
=
"float
32
"
)
rois
=
fluid
.
layers
.
data
(
name
=
"ROIs"
,
shape
=
[
4
],
dtype
=
"float
64
"
,
lod_level
=
1
)
name
=
"ROIs"
,
shape
=
[
4
],
dtype
=
"float
32
"
,
lod_level
=
1
)
output
=
fluid
.
layers
.
prroi_pool
(
x
,
rois
,
0.25
,
2
,
2
)
loss
=
fluid
.
layers
.
mean
(
output
)
optimizer
=
fluid
.
optimizer
.
SGD
(
learning_rate
=
1e-3
)
...
...
@@ -120,9 +120,9 @@ class TestPRROIPoolOp(OpTest):
def
test_errors
(
self
):
with
program_guard
(
Program
(),
Program
()):
x
=
fluid
.
layers
.
data
(
name
=
"x"
,
shape
=
[
245
,
30
,
30
],
dtype
=
"float
64
"
)
name
=
"x"
,
shape
=
[
245
,
30
,
30
],
dtype
=
"float
32
"
)
rois
=
fluid
.
layers
.
data
(
name
=
"rois"
,
shape
=
[
4
],
dtype
=
"float
64
"
,
lod_level
=
1
)
name
=
"rois"
,
shape
=
[
4
],
dtype
=
"float
32
"
,
lod_level
=
1
)
# spatial_scale must be float type
self
.
assertRaises
(
TypeError
,
fluid
.
layers
.
prroi_pool
,
x
,
rois
,
2
,
7
,
7
)
...
...
@@ -141,7 +141,7 @@ class TestPRROIPoolOpTensorRoIs(OpTest):
self
.
prRoIPool
=
PyPrRoIPool
()
self
.
outs
=
self
.
prRoIPool
.
compute
(
self
.
x
,
self
.
rois
,
self
.
output_channels
,
self
.
spatial_scale
,
self
.
pooled_height
,
self
.
pooled_width
).
astype
(
'float
64
'
)
self
.
pooled_height
,
self
.
pooled_width
).
astype
(
'float
32
'
)
self
.
rois_index
=
np
.
array
(
self
.
rois_lod
).
reshape
([
-
1
]).
astype
(
np
.
int64
)
self
.
inputs
=
{
...
...
@@ -170,7 +170,7 @@ class TestPRROIPoolOpTensorRoIs(OpTest):
self
.
pooled_height
=
4
self
.
pooled_width
=
4
self
.
x
=
np
.
random
.
random
(
self
.
x_dim
).
astype
(
'float
64
'
)
self
.
x
=
np
.
random
.
random
(
self
.
x_dim
).
astype
(
'float
32
'
)
def
make_rois
(
self
):
rois
=
[]
...
...
@@ -190,7 +190,7 @@ class TestPRROIPoolOpTensorRoIs(OpTest):
roi
=
[
bno
,
x1
,
y1
,
x2
,
y2
]
rois
.
append
(
roi
)
self
.
rois_num
=
len
(
rois
)
self
.
rois
=
np
.
array
(
rois
).
astype
(
'float
64
'
)
self
.
rois
=
np
.
array
(
rois
).
astype
(
'float
32
'
)
def
setUp
(
self
):
self
.
op_type
=
'prroi_pool'
...
...
@@ -211,8 +211,8 @@ class TestPRROIPoolOpTensorRoIs(OpTest):
x
=
fluid
.
layers
.
data
(
name
=
"X"
,
shape
=
[
self
.
channels
,
self
.
height
,
self
.
width
],
dtype
=
"float
64
"
)
rois
=
fluid
.
layers
.
data
(
name
=
"ROIs"
,
shape
=
[
4
],
dtype
=
"float
64
"
)
dtype
=
"float
32
"
)
rois
=
fluid
.
layers
.
data
(
name
=
"ROIs"
,
shape
=
[
4
],
dtype
=
"float
32
"
)
rois_index
=
fluid
.
layers
.
data
(
name
=
'rois_idx'
,
shape
=
[],
dtype
=
"int64"
)
output
=
fluid
.
layers
.
prroi_pool
(
...
...
@@ -238,9 +238,9 @@ class TestPRROIPoolOpTensorRoIs(OpTest):
def
test_errors
(
self
):
with
program_guard
(
Program
(),
Program
()):
x
=
fluid
.
layers
.
data
(
name
=
"x"
,
shape
=
[
245
,
30
,
30
],
dtype
=
"float
64
"
)
name
=
"x"
,
shape
=
[
245
,
30
,
30
],
dtype
=
"float
32
"
)
rois
=
fluid
.
layers
.
data
(
name
=
"rois"
,
shape
=
[
4
],
dtype
=
"float
64
"
,
lod_level
=
1
)
name
=
"rois"
,
shape
=
[
4
],
dtype
=
"float
32
"
,
lod_level
=
1
)
# spatial_scale must be float type
self
.
assertRaises
(
TypeError
,
fluid
.
layers
.
prroi_pool
,
x
,
rois
,
2
,
7
,
7
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录