Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
8eb98cb3
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8eb98cb3
编写于
7月 13, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
7月 13, 2020
浏览文件
操作
浏览文件
下载
差异文件
!2988 Add attr “roi_end_mode" in ROIAlign for both GE and VM backends.
Merge pull request !2988 from liuxiao93/ROIAlign
上级
da9452ee
d74d2608
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
8 addition
and
3 deletion
+8
-3
mindspore/ccsrc/transform/op_declare.cc
mindspore/ccsrc/transform/op_declare.cc
+2
-1
mindspore/ops/_op_impl/tbe/roi_align.py
mindspore/ops/_op_impl/tbe/roi_align.py
+1
-1
mindspore/ops/operations/nn_ops.py
mindspore/ops/operations/nn_ops.py
+5
-1
未找到文件。
mindspore/ccsrc/transform/op_declare.cc
浏览文件 @
8eb98cb3
...
...
@@ -610,7 +610,8 @@ OUTPUT_MAP(ROIAlign) = {{0, OUTPUT_DESC(y)}};
ATTR_MAP
(
ROIAlign
)
=
{{
"pooled_height"
,
ATTR_DESC
(
pooled_height
,
AnyTraits
<
int
>
())},
{
"pooled_width"
,
ATTR_DESC
(
pooled_width
,
AnyTraits
<
int
>
())},
{
"spatial_scale"
,
ATTR_DESC
(
spatial_scale
,
AnyTraits
<
float
>
())},
{
"sample_num"
,
ATTR_DESC
(
sample_num
,
AnyTraits
<
int
>
())}};
{
"sample_num"
,
ATTR_DESC
(
sample_num
,
AnyTraits
<
int
>
())},
{
"roi_end_mode"
,
ATTR_DESC
(
roi_end_mode
,
AnyTraits
<
int
>
())}};
// ROIAlignGrad
INPUT_MAP
(
ROIAlignGrad
)
=
{{
1
,
INPUT_DESC
(
ydiff
)},
{
2
,
INPUT_DESC
(
rois
)}};
...
...
mindspore/ops/_op_impl/tbe/roi_align.py
浏览文件 @
8eb98cb3
...
...
@@ -27,7 +27,7 @@ roi_align_op_info = TBERegOp("ROIAlign") \
.
attr
(
"pooled_height"
,
"required"
,
"int"
,
"all"
)
\
.
attr
(
"pooled_width"
,
"required"
,
"int"
,
"all"
)
\
.
attr
(
"sample_num"
,
"optional"
,
"int"
,
"all"
,
"2"
)
\
.
attr
(
"roi_end_mode"
,
"optional"
,
"0,1"
,
"1"
)
\
.
attr
(
"roi_end_mode"
,
"optional"
,
"
int"
,
"
0,1"
,
"1"
)
\
.
input
(
0
,
"features"
,
False
,
"required"
,
"all"
)
\
.
input
(
1
,
"rois"
,
False
,
"required"
,
"all"
)
\
.
input
(
2
,
"rois_n"
,
False
,
"optional"
,
"all"
)
\
...
...
mindspore/ops/operations/nn_ops.py
浏览文件 @
8eb98cb3
...
...
@@ -2695,6 +2695,7 @@ class ROIAlign(PrimitiveWithInfer):
feature map coordinates. Suppose the height of a RoI is `ori_h` in the raw image and `fea_h` in the
input feature map, the `spatial_scale` should be `fea_h / ori_h`.
sample_num (int): Number of sampling points. Default: 2.
roi_end_mode (int): Number must be 0 or 1. Default: 1.
Inputs:
- **features** (Tensor) - The input features, whose shape should be `(N, C, H, W)`.
...
...
@@ -2717,16 +2718,19 @@ class ROIAlign(PrimitiveWithInfer):
"""
@
prim_attr_register
def
__init__
(
self
,
pooled_height
,
pooled_width
,
spatial_scale
,
sample_num
=
2
):
def
__init__
(
self
,
pooled_height
,
pooled_width
,
spatial_scale
,
sample_num
=
2
,
roi_end_mode
=
1
):
"""init ROIAlign"""
validator
.
check_value_type
(
"pooled_height"
,
pooled_height
,
[
int
],
self
.
name
)
validator
.
check_value_type
(
"pooled_width"
,
pooled_width
,
[
int
],
self
.
name
)
validator
.
check_value_type
(
"spatial_scale"
,
spatial_scale
,
[
float
],
self
.
name
)
validator
.
check_value_type
(
"sample_num"
,
sample_num
,
[
int
],
self
.
name
)
validator
.
check_value_type
(
"roi_end_mode"
,
roi_end_mode
,
[
int
],
self
.
name
)
validator
.
check_int_range
(
"roi_end_mode"
,
roi_end_mode
,
0
,
1
,
Rel
.
INC_BOTH
,
self
.
name
)
self
.
pooled_height
=
pooled_height
self
.
pooled_width
=
pooled_width
self
.
spatial_scale
=
spatial_scale
self
.
sample_num
=
sample_num
self
.
roi_end_mode
=
roi_end_mode
def
infer_shape
(
self
,
inputs_shape
,
rois_shape
):
return
[
rois_shape
[
0
],
inputs_shape
[
1
],
self
.
pooled_height
,
self
.
pooled_width
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录