Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
Mace
提交
2389d3f1
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看板
提交
2389d3f1
编写于
3月 01, 2018
作者:
L
liuqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename fc to fully_connected to keep consistency.
上级
07927d5a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
20 addition
and
21 deletion
+20
-21
mace/kernels/fully_connected.h
mace/kernels/fully_connected.h
+8
-9
mace/kernels/opencl/cl/fully_connected.cl
mace/kernels/opencl/cl/fully_connected.cl
+9
-9
mace/kernels/opencl/fully_connected_opencl.cc
mace/kernels/opencl/fully_connected_opencl.cc
+3
-3
未找到文件。
mace/kernels/fully_connected.h
浏览文件 @
2389d3f1
...
...
@@ -26,12 +26,12 @@ struct FullyConnectedBase {
const
float
prelu_alpha_
;
};
template
<
DeviceType
D
,
typename
T
>
struct
FullyConnectedFunctor
:
FullyConnectedBase
{
template
<
DeviceType
D
,
typename
T
>
struct
FullyConnectedFunctor
:
FullyConnectedBase
{
FullyConnectedFunctor
(
const
ActivationType
activation
,
const
float
relux_max_limit
,
const
float
prelu_alpha
)
:
FullyConnectedBase
(
activation
,
relux_max_limit
,
prelu_alpha
){}
const
float
relux_max_limit
,
const
float
prelu_alpha
)
:
FullyConnectedBase
(
activation
,
relux_max_limit
,
prelu_alpha
)
{}
void
operator
()(
const
Tensor
*
input
,
const
Tensor
*
weight
,
...
...
@@ -74,13 +74,12 @@ struct FullyConnectedFunctor : FullyConnectedBase{
}
};
template
<
typename
T
>
struct
FullyConnectedFunctor
<
DeviceType
::
OPENCL
,
T
>
:
FullyConnectedBase
{
template
<
typename
T
>
struct
FullyConnectedFunctor
<
DeviceType
::
OPENCL
,
T
>
:
FullyConnectedBase
{
FullyConnectedFunctor
(
const
ActivationType
activation
,
const
float
relux_max_limit
,
const
float
prelu_alpha
)
:
FullyConnectedBase
(
activation
,
relux_max_limit
,
prelu_alpha
){}
FullyConnectedBase
(
activation
,
relux_max_limit
,
prelu_alpha
)
{}
void
operator
()(
const
Tensor
*
input
,
const
Tensor
*
weight
,
...
...
mace/kernels/opencl/cl/f
c
.cl
→
mace/kernels/opencl/cl/f
ully_connected
.cl
浏览文件 @
2389d3f1
#
include
<common.h>
//
output
=
weight
*
input
+
bias
__kernel
void
f
c
(
__read_only
image2d_t
input,
__read_only
image2d_t
weight,
__kernel
void
f
ully_connected
(
__read_only
image2d_t
input,
__read_only
image2d_t
weight,
#
ifdef
BIAS
__read_only
image2d_t
bias,
__read_only
image2d_t
bias,
#
endif
__write_only
image2d_t
output,
__private
const
int
input_height,
__private
const
int
input_width,
__private
const
int
input_channel,
__private
const
float
relux_max_limit,
__private
const
float
prelu_alpha
)
{
__write_only
image2d_t
output,
__private
const
int
input_height,
__private
const
int
input_width,
__private
const
int
input_channel,
__private
const
float
relux_max_limit,
__private
const
float
prelu_alpha
)
{
const
int
batch_idx
=
get_global_id
(
0
)
;
const
int
out_blk_idx
=
get_global_id
(
1
)
;
const
int
input_chan_blk
=
(
input_channel
+
3
)
>>
2
;
...
...
mace/kernels/opencl/fully_connected_opencl.cc
浏览文件 @
2389d3f1
...
...
@@ -32,8 +32,8 @@ void FullyConnectedFunctor<DeviceType::OPENCL, T>::operator()(
auto
runtime
=
OpenCLRuntime
::
Global
();
std
::
set
<
std
::
string
>
built_options
;
auto
dt
=
DataTypeToEnum
<
T
>::
value
;
std
::
string
kernel_name
=
MACE_OBFUSCATE_SYMBOL
(
"f
c
"
);
built_options
.
emplace
(
"-Df
c
="
+
kernel_name
);
std
::
string
kernel_name
=
MACE_OBFUSCATE_SYMBOL
(
"f
ully_connected
"
);
built_options
.
emplace
(
"-Df
ully_connected
="
+
kernel_name
);
built_options
.
emplace
(
"-DDATA_TYPE="
+
DtToUpstreamCLDt
(
dt
));
built_options
.
emplace
(
"-DCMD_DATA_TYPE="
+
DtToUpstreamCLCMDDt
(
dt
));
if
(
bias
!=
nullptr
)
{
...
...
@@ -60,7 +60,7 @@ void FullyConnectedFunctor<DeviceType::OPENCL, T>::operator()(
default:
LOG
(
FATAL
)
<<
"Unknown activation type: "
<<
activation_
;
}
kernel_
=
runtime
->
BuildKernel
(
"f
c
"
,
kernel_name
,
built_options
);
kernel_
=
runtime
->
BuildKernel
(
"f
ully_connected
"
,
kernel_name
,
built_options
);
uint32_t
idx
=
0
;
kernel_
.
setArg
(
idx
++
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录