Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
3bd40887
MegEngine
项目概览
MegEngine 天元
/
MegEngine
接近 2 年 前同步成功
通知
414
Star
4708
Fork
583
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MegEngine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
3bd40887
编写于
2月 11, 2022
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(mgb/opr): add NHWC support for AdaptivePooling
GitOrigin-RevId: b23e37ac23764085568d4c303619eec10a0b4867
上级
e393d1cf
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
31 addition
and
9 deletion
+31
-9
dnn/src/common/adaptive_pooling.cpp
dnn/src/common/adaptive_pooling.cpp
+15
-2
src/opr/impl/dnn/adaptive_pooling.cpp
src/opr/impl/dnn/adaptive_pooling.cpp
+16
-7
未找到文件。
dnn/src/common/adaptive_pooling.cpp
浏览文件 @
3bd40887
...
@@ -6,8 +6,21 @@ namespace megdnn {
...
@@ -6,8 +6,21 @@ namespace megdnn {
param
::
Pooling
AdaptivePoolingBase
::
deduce_pooling_param
(
param
::
Pooling
AdaptivePoolingBase
::
deduce_pooling_param
(
const
TensorLayout
&
src
,
const
TensorLayout
&
dst
)
{
const
TensorLayout
&
src
,
const
TensorLayout
&
dst
)
{
megdnn_assert
(
param
().
format
==
param
::
AdaptivePooling
::
Format
::
NCHW
);
auto
param_format
=
param
().
format
;
size_t
IH
=
src
.
shape
[
2
],
IW
=
src
.
shape
[
3
],
OH
=
dst
.
shape
[
2
],
OW
=
dst
.
shape
[
3
];
size_t
IH
,
IW
,
OH
,
OW
;
if
(
param_format
==
param
::
AdaptivePooling
::
Format
::
NCHW
)
{
IH
=
src
.
shape
[
2
];
IW
=
src
.
shape
[
3
];
OH
=
dst
.
shape
[
2
];
OW
=
dst
.
shape
[
3
];
}
else
if
(
param_format
==
param
::
AdaptivePooling
::
Format
::
NHWC
)
{
IH
=
src
.
shape
[
1
];
IW
=
src
.
shape
[
2
];
OH
=
dst
.
shape
[
1
];
OW
=
dst
.
shape
[
2
];
}
else
{
megdnn_throw
(
"AdaptivePooling only support NCHW or NHWC format"
);
}
param
::
Pooling
ret
;
param
::
Pooling
ret
;
ret
.
mode
=
param
().
mode
;
ret
.
mode
=
param
().
mode
;
...
...
src/opr/impl/dnn/adaptive_pooling.cpp
浏览文件 @
3bd40887
...
@@ -43,13 +43,22 @@ void AdaptivePoolingForward::outshape_by_symvar_do_get_output_shape(
...
@@ -43,13 +43,22 @@ void AdaptivePoolingForward::outshape_by_symvar_do_get_output_shape(
"shape mismatch for AdaptivePooling: src=%s, out2d=%s"
,
"shape mismatch for AdaptivePooling: src=%s, out2d=%s"
,
src
.
to_string
().
c_str
(),
oshp2d
.
to_string
().
c_str
());
src
.
to_string
().
c_str
(),
oshp2d
.
to_string
().
c_str
());
mgb_assert
(
auto
param_format
=
param
().
format
;
param
().
format
==
Param
::
Format
::
NCHW
,
"AdaptivePooling only support NCHW"
);
if
(
param_format
==
Param
::
Format
::
NCHW
)
{
dest
.
ndim
=
4
;
dest
.
ndim
=
4
;
dest
.
shape
[
0
]
=
src
.
shape
[
0
];
dest
.
shape
[
0
]
=
src
.
shape
[
0
];
dest
.
shape
[
1
]
=
src
.
shape
[
1
];
dest
.
shape
[
1
]
=
src
.
shape
[
1
];
dest
.
shape
[
2
]
=
oshp2d
.
shape
[
0
];
dest
.
shape
[
2
]
=
oshp2d
.
shape
[
0
];
dest
.
shape
[
3
]
=
oshp2d
.
shape
[
1
];
dest
.
shape
[
3
]
=
oshp2d
.
shape
[
1
];
}
else
if
(
param_format
==
Param
::
Format
::
NHWC
)
{
dest
.
ndim
=
4
;
dest
.
shape
[
0
]
=
src
.
shape
[
0
];
dest
.
shape
[
1
]
=
oshp2d
.
shape
[
0
];
dest
.
shape
[
2
]
=
oshp2d
.
shape
[
1
];
dest
.
shape
[
3
]
=
src
.
shape
[
3
];
}
else
{
mgb_throw
(
MegBrainError
,
"AdaptivePooling only support NCHW or NHWC format"
);
}
}
}
size_t
AdaptivePoolingForward
::
get_workspace_size_bytes
(
size_t
AdaptivePoolingForward
::
get_workspace_size_bytes
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录