Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
项目经理老王
Mace
提交
3fc71987
Mace
项目概览
项目经理老王
/
Mace
与 Fork 源项目一致
Fork自
Xiaomi / Mace
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mace
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3fc71987
编写于
9月 30, 2018
作者:
李
李寅
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'optimize_deconv_cpu' into 'master'
refactor deconv code See merge request !819
上级
35ae3573
c6d648ea
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
9 addition
and
15 deletion
+9
-15
mace/kernels/deconv_2d.h
mace/kernels/deconv_2d.h
+9
-15
未找到文件。
mace/kernels/deconv_2d.h
浏览文件 @
3fc71987
...
@@ -191,20 +191,6 @@ struct Deconv2dFunctor<DeviceType::CPU, float>: Deconv2dFunctorBase {
...
@@ -191,20 +191,6 @@ struct Deconv2dFunctor<DeviceType::CPU, float>: Deconv2dFunctorBase {
const
index_t
*
in_shape
,
const
index_t
*
in_shape
,
const
index_t
*
out_shape
,
const
index_t
*
out_shape
,
float
*
output
)
{
float
*
output
)
{
const
index_t
kernel_size
=
kernel_h
*
kernel_w
;
std
::
vector
<
int
>
out_map
(
kernel_size
);
int
p0
=
0
;
int
p1
=
0
;
index_t
gap
=
out_shape
[
3
]
-
kernel_w
;
for
(
int
i
=
0
;
i
<
kernel_h
;
++
i
)
{
for
(
int
j
=
0
;
j
<
kernel_w
;
++
j
)
{
out_map
[
p0
]
=
p1
;
p0
++
;
p1
++
;
}
p1
+=
gap
;
}
const
index_t
out_height
=
out_shape
[
2
];
const
index_t
out_height
=
out_shape
[
2
];
const
index_t
out_width
=
out_shape
[
3
];
const
index_t
out_width
=
out_shape
[
3
];
const
index_t
in_height
=
in_shape
[
2
];
const
index_t
in_height
=
in_shape
[
2
];
...
@@ -212,6 +198,14 @@ struct Deconv2dFunctor<DeviceType::CPU, float>: Deconv2dFunctorBase {
...
@@ -212,6 +198,14 @@ struct Deconv2dFunctor<DeviceType::CPU, float>: Deconv2dFunctorBase {
const
index_t
out_img_size
=
out_height
*
out_width
;
const
index_t
out_img_size
=
out_height
*
out_width
;
const
index_t
in_img_size
=
in_height
*
in_width
;
const
index_t
in_img_size
=
in_height
*
in_width
;
const
int
kernel_size
=
static_cast
<
int
>
(
kernel_h
*
kernel_w
);
std
::
vector
<
index_t
>
index_map
(
kernel_size
,
0
);
for
(
index_t
i
=
0
;
i
<
kernel_h
;
++
i
)
{
for
(
index_t
j
=
0
;
j
<
kernel_w
;
++
j
)
{
index_map
[
i
*
kernel_w
+
j
]
=
i
*
out_width
+
j
;
}
}
#pragma omp parallel for
#pragma omp parallel for
for
(
int
b
=
0
;
b
<
in_shape
[
0
];
++
b
)
{
for
(
int
b
=
0
;
b
<
in_shape
[
0
];
++
b
)
{
for
(
int
oc
=
0
;
oc
<
out_shape
[
1
];
++
oc
)
{
for
(
int
oc
=
0
;
oc
<
out_shape
[
1
];
++
oc
)
{
...
@@ -230,7 +224,7 @@ struct Deconv2dFunctor<DeviceType::CPU, float>: Deconv2dFunctorBase {
...
@@ -230,7 +224,7 @@ struct Deconv2dFunctor<DeviceType::CPU, float>: Deconv2dFunctorBase {
const
index_t
kernel_offset
=
const
index_t
kernel_offset
=
(
oc
*
in_shape
[
1
]
+
ic
)
*
kernel_size
;
(
oc
*
in_shape
[
1
]
+
ic
)
*
kernel_size
;
for
(
int
k
=
0
;
k
<
kernel_size
;
++
k
)
{
for
(
int
k
=
0
;
k
<
kernel_size
;
++
k
)
{
const
index_t
out_idx
=
out_offset
+
out
_map
[
k
];
const
index_t
out_idx
=
out_offset
+
index
_map
[
k
];
const
index_t
kernel_idx
=
kernel_offset
+
k
;
const
index_t
kernel_idx
=
kernel_offset
+
k
;
out_base
[
out_idx
]
+=
val
*
filter
[
kernel_idx
];
out_base
[
out_idx
]
+=
val
*
filter
[
kernel_idx
];
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录