Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
b9ee846e
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看板
未验证
提交
b9ee846e
编写于
4月 05, 2022
作者:
Z
zyfncg
提交者:
GitHub
4月 05, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add roi_align yaml and unittest (#41402)
* add roi_align yaml * fix bug
上级
1f829f6e
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
39 addition
and
7 deletion
+39
-7
python/paddle/fluid/tests/unittests/test_roi_align_op.py
python/paddle/fluid/tests/unittests/test_roi_align_op.py
+7
-2
python/paddle/utils/code_gen/api.yaml
python/paddle/utils/code_gen/api.yaml
+11
-1
python/paddle/utils/code_gen/backward.yaml
python/paddle/utils/code_gen/backward.yaml
+12
-1
python/paddle/utils/code_gen/backward_api_gen.py
python/paddle/utils/code_gen/backward_api_gen.py
+1
-0
python/paddle/vision/ops.py
python/paddle/vision/ops.py
+7
-2
tools/infrt/skipped_phi_api.json
tools/infrt/skipped_phi_api.json
+1
-1
未找到文件。
python/paddle/fluid/tests/unittests/test_roi_align_op.py
浏览文件 @
b9ee846e
...
...
@@ -14,6 +14,7 @@
from
__future__
import
print_function
import
paddle
import
unittest
import
numpy
as
np
import
math
...
...
@@ -30,6 +31,7 @@ class TestROIAlignOp(OpTest):
self
.
inputs
=
{
'X'
:
self
.
x
,
'ROIs'
:
(
self
.
rois
[:,
1
:
5
],
self
.
rois_lod
),
'RoisNum'
:
self
.
boxes_num
}
self
.
attrs
=
{
'spatial_scale'
:
self
.
spatial_scale
,
...
...
@@ -170,16 +172,19 @@ class TestROIAlignOp(OpTest):
rois
.
append
(
roi
)
self
.
rois_num
=
len
(
rois
)
self
.
rois
=
np
.
array
(
rois
).
astype
(
"float64"
)
self
.
boxes_num
=
np
.
array
(
[
bno
+
1
for
bno
in
range
(
self
.
batch_size
)]).
astype
(
'int32'
)
def
setUp
(
self
):
self
.
op_type
=
"roi_align"
self
.
python_api
=
lambda
x
,
boxes
,
boxes_num
,
pooled_height
,
pooled_width
,
spatial_scale
,
sampling_ratio
,
aligned
:
paddle
.
vision
.
ops
.
roi_align
(
x
,
boxes
,
boxes_num
,
(
pooled_height
,
pooled_width
),
spatial_scale
,
sampling_ratio
,
aligned
)
self
.
set_data
()
def
test_check_output
(
self
):
self
.
check_output
()
self
.
check_output
(
check_eager
=
True
)
def
test_check_grad
(
self
):
self
.
check_grad
([
'X'
],
'Out'
)
self
.
check_grad
([
'X'
],
'Out'
,
check_eager
=
True
)
class
TestROIAlignInLodOp
(
TestROIAlignOp
):
...
...
python/paddle/utils/code_gen/api.yaml
浏览文件 @
b9ee846e
...
...
@@ -1386,6 +1386,16 @@
intermediate
:
xshape
backward
:
reshape_grad
-
api
:
roi_align
args
:
(Tensor x, Tensor boxes, Tensor boxes_num, int pooled_height, int pooled_width, float spatial_scale, int sampling_ratio, bool aligned)
output
:
Tensor
infer_meta
:
func
:
RoiAlignInferMeta
kernel
:
func
:
roi_align
optional
:
boxes_num
backward
:
roi_align_grad
-
api
:
roll
args
:
(Tensor x, IntArray shifts, int64_t[] axis)
output
:
Tensor(out)
...
...
python/paddle/utils/code_gen/backward.yaml
浏览文件 @
b9ee846e
...
...
@@ -994,6 +994,17 @@
backend
:
out_grad
layout
:
out_grad
-
backward_api
:
roi_align_grad
forward
:
roi_align (Tensor x, Tensor boxes, Tensor boxes_num, int pooled_height, int pooled_width, float spatial_scale, int sampling_ratio, bool aligned) -> Tensor(out)
args
:
(Tensor x, Tensor boxes, Tensor boxes_num, Tensor out_grad, int pooled_height, int pooled_width, float spatial_scale, int sampling_ratio, bool aligned)
output
:
Tensor(x_grad)
infer_meta
:
func
:
UnchangedInferMeta
param
:
[
x
]
kernel
:
func
:
roi_align_grad
optional
:
boxes_num
-
backward_api
:
roll_grad
forward
:
roll(Tensor x, IntArray shifts, int64_t[] axis) -> Tensor(out)
args
:
(Tensor x, Tensor out_grad, IntArray shifts, int64_t[] axis)
...
...
python/paddle/utils/code_gen/backward_api_gen.py
浏览文件 @
b9ee846e
...
...
@@ -176,6 +176,7 @@ def source_include(header_file_path):
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/api/include/api.h"
#include "paddle/phi/infermeta/backward.h"
#include "paddle/phi/infermeta/unary.h"
#include "paddle/fluid/eager/api/utils/global_utils.h"
#include "paddle/fluid/platform/profiler/event_tracing.h"
...
...
python/paddle/vision/ops.py
浏览文件 @
b9ee846e
...
...
@@ -19,7 +19,7 @@ from ..fluid import core, layers
from
..fluid.layers
import
nn
,
utils
from
..nn
import
Layer
,
Conv2D
,
Sequential
,
ReLU
,
BatchNorm2D
from
..fluid.initializer
import
Normal
from
..fluid.framework
import
_non_static_mode
,
in_dygraph_mode
from
..fluid.framework
import
_non_static_mode
,
in_dygraph_mode
,
_in_legacy_dygraph
from
paddle.common_ops_import
import
*
from
paddle
import
_C_ops
...
...
@@ -1224,7 +1224,12 @@ def roi_align(x,
output_size
=
(
output_size
,
output_size
)
pooled_height
,
pooled_width
=
output_size
if
_non_static_mode
():
if
in_dygraph_mode
():
assert
boxes_num
is
not
None
,
"boxes_num should not be None in dygraph mode."
return
_C_ops
.
final_state_roi_align
(
x
,
boxes
,
boxes_num
,
pooled_height
,
pooled_width
,
spatial_scale
,
sampling_ratio
,
aligned
)
if
_in_legacy_dygraph
():
assert
boxes_num
is
not
None
,
"boxes_num should not be None in dygraph mode."
align_out
=
_C_ops
.
roi_align
(
x
,
boxes
,
boxes_num
,
"pooled_height"
,
pooled_height
,
"pooled_width"
,
...
...
tools/infrt/skipped_phi_api.json
浏览文件 @
b9ee846e
{
"phi_apis"
:[
"conj"
,
"nll_loss"
,
"flatten"
,
"expand_as"
,
"dropout"
],
"phi_apis"
:[
"conj"
,
"nll_loss"
,
"flatten"
,
"expand_as"
,
"dropout"
,
"roi_align"
],
"phi_kernels"
:[
"equal_all"
]
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录