Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
Mace
提交
b028e4de
Mace
项目概览
慢慢CG
/
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看板
提交
b028e4de
编写于
11月 30, 2017
作者:
L
liuqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove unused padding for conv 1x1.
上级
92e3e526
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
19 deletion
+14
-19
mace/kernels/opencl/cl/conv_2d_1x1.cl
mace/kernels/opencl/cl/conv_2d_1x1.cl
+12
-14
mace/kernels/opencl/conv_2d_opencl_1x1.cc
mace/kernels/opencl/conv_2d_opencl_1x1.cc
+2
-5
未找到文件。
mace/kernels/opencl/cl/conv_2d_1x1.cl
浏览文件 @
b028e4de
...
@@ -14,9 +14,7 @@ __kernel void conv_2d_1x1(__read_only image2d_t input, /* [c%4 * w * c/4, h * b]
...
@@ -14,9 +14,7 @@ __kernel void conv_2d_1x1(__read_only image2d_t input, /* [c%4 * w * c/4, h * b]
__private
const
int
in_width,
__private
const
int
in_width,
__private
const
int
in_ch_blks,
__private
const
int
in_ch_blks,
__private
const
int
height,
__private
const
int
height,
__private
const
int
width,
__private
const
int
width
)
{
__private
const
int
padding_top,
__private
const
int
padding_left
)
{
const
int
out_ch_blk
=
get_global_id
(
0
)
;
const
int
out_ch_blk
=
get_global_id
(
0
)
;
const
int
out_w_blk
=
get_global_id
(
1
)
;
const
int
out_w_blk
=
get_global_id
(
1
)
;
const
int
out_w_blks
=
get_global_size
(
1
)
;
const
int
out_w_blks
=
get_global_size
(
1
)
;
...
@@ -38,23 +36,23 @@ __kernel void conv_2d_1x1(__read_only image2d_t input, /* [c%4 * w * c/4, h * b]
...
@@ -38,23 +36,23 @@ __kernel void conv_2d_1x1(__read_only image2d_t input, /* [c%4 * w * c/4, h * b]
int4
w
;
int4
w
;
#
if
STRIDE
==
1
#
if
STRIDE
==
1
w.x
=
out_w_blk
-
padding_left
;
w.x
=
out_w_blk
;
w.y
=
w.x
+
out_w_blks
;
w.y
=
w.x
+
out_w_blks
;
w.z
=
w.y
+
out_w_blks
;
w.z
=
w.y
+
out_w_blks
;
w.w
=
w.z
+
out_w_blks
;
w.w
=
w.z
+
out_w_blks
;
int
out_hb_idx
=
(
out_hb
%
height
)
-
padding_top
;
int
out_hb_idx
=
(
out_hb
%
height
)
;
#
else
#
else
w.x
=
out_w_blk
*
2
-
padding_left
;
w.x
=
out_w_blk
*
2
;
w.y
=
(
out_w_blk
+
out_w_blks
)
*
2
-
padding_left
;
w.y
=
(
out_w_blk
+
out_w_blks
)
*
2
;
w.z
=
(
out_w_blk
+
2
*
out_w_blks
)
*
2
-
padding_left
;
w.z
=
(
out_w_blk
+
2
*
out_w_blks
)
*
2
;
w.w
=
(
out_w_blk
+
3
*
out_w_blks
)
*
2
-
padding_left
;
w.w
=
(
out_w_blk
+
3
*
out_w_blks
)
*
2
;
int
out_hb_idx
=
(
out_hb
%
height
)
*
2
-
padding_top
;
int
out_hb_idx
=
(
out_hb
%
height
)
*
2
;
#
endif
#
endif
w.x
=
select
(
w.x,
INT_MIN,
(
w.x
<
0
|
| w.x >= in_width)
);
w.x
=
select
(
w.x,
INT_MIN,
w.x
>=
in_width
)
;
w.y = select(w.y, INT_MIN,
(w.y < 0 || w.y >= in_width)
);
w.y
=
select
(
w.y,
INT_MIN,
w.y
>=
in_width
)
;
w.z = select(w.z, INT_MIN,
(w.z < 0 || w.z >= in_width)
);
w.z
=
select
(
w.z,
INT_MIN,
w.z
>=
in_width
)
;
w.w = select(w.w, INT_MIN,
(w.w < 0 |
|
w.w
>=
in_width
)
)
;
w.w
=
select
(
w.w,
INT_MIN,
w.w
>=
in_width
)
;
out_hb_idx
=
select
(
out_hb_idx
+
(
out_hb
/
height
)
*
in_height,
out_hb_idx
=
select
(
out_hb_idx
+
(
out_hb
/
height
)
*
in_height,
-1
,
-1
,
...
...
mace/kernels/opencl/conv_2d_opencl_1x1.cc
浏览文件 @
b028e4de
...
@@ -15,7 +15,6 @@ void Conv1x1(const Tensor *input,
...
@@ -15,7 +15,6 @@ void Conv1x1(const Tensor *input,
const
Tensor
*
filter
,
const
Tensor
*
filter
,
const
Tensor
*
bias
,
const
Tensor
*
bias
,
const
int
stride
,
const
int
stride
,
const
int
*
padding
,
Tensor
*
output
)
{
Tensor
*
output
)
{
const
index_t
batch
=
output
->
dim
(
0
);
const
index_t
batch
=
output
->
dim
(
0
);
const
index_t
height
=
output
->
dim
(
1
);
const
index_t
height
=
output
->
dim
(
1
);
...
@@ -58,8 +57,6 @@ void Conv1x1(const Tensor *input,
...
@@ -58,8 +57,6 @@ void Conv1x1(const Tensor *input,
conv_2d_kernel
.
setArg
(
idx
++
,
static_cast
<
int
>
(
input_channel_blocks
));
conv_2d_kernel
.
setArg
(
idx
++
,
static_cast
<
int
>
(
input_channel_blocks
));
conv_2d_kernel
.
setArg
(
idx
++
,
static_cast
<
int
>
(
height
));
conv_2d_kernel
.
setArg
(
idx
++
,
static_cast
<
int
>
(
height
));
conv_2d_kernel
.
setArg
(
idx
++
,
static_cast
<
int
>
(
width
));
conv_2d_kernel
.
setArg
(
idx
++
,
static_cast
<
int
>
(
width
));
conv_2d_kernel
.
setArg
(
idx
++
,
padding
[
0
]
/
2
);
conv_2d_kernel
.
setArg
(
idx
++
,
padding
[
1
]
/
2
);
auto
command_queue
=
runtime
->
command_queue
();
auto
command_queue
=
runtime
->
command_queue
();
cl_int
error
;
cl_int
error
;
...
@@ -78,7 +75,7 @@ extern void Conv2dOpenclK1x1S1(const Tensor *input,
...
@@ -78,7 +75,7 @@ extern void Conv2dOpenclK1x1S1(const Tensor *input,
const
Tensor
*
bias
,
const
Tensor
*
bias
,
const
int
*
padding
,
const
int
*
padding
,
Tensor
*
output
)
{
Tensor
*
output
)
{
Conv1x1
(
input
,
filter
,
bias
,
1
,
padding
,
output
);
Conv1x1
(
input
,
filter
,
bias
,
1
,
output
);
};
};
extern
void
Conv2dOpenclK1x1S2
(
const
Tensor
*
input
,
extern
void
Conv2dOpenclK1x1S2
(
const
Tensor
*
input
,
...
@@ -86,7 +83,7 @@ extern void Conv2dOpenclK1x1S2(const Tensor *input,
...
@@ -86,7 +83,7 @@ extern void Conv2dOpenclK1x1S2(const Tensor *input,
const
Tensor
*
bias
,
const
Tensor
*
bias
,
const
int
*
padding
,
const
int
*
padding
,
Tensor
*
output
)
{
Tensor
*
output
)
{
Conv1x1
(
input
,
filter
,
bias
,
2
,
padding
,
output
);
Conv1x1
(
input
,
filter
,
bias
,
2
,
output
);
};
};
}
// namespace kernels
}
// namespace kernels
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录