Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
455ad5b5
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
455ad5b5
编写于
8月 06, 2017
作者:
Q
qingqing01
提交者:
GitHub
8月 06, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3141 from hedaoyuan/nnpack
Support groups in NNPACKFunction.
上级
d911b1b5
74f8ede9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
49 deletion
+54
-49
paddle/function/nnpack/NNPACKConvOp.cpp
paddle/function/nnpack/NNPACKConvOp.cpp
+53
-47
paddle/gserver/layers/ExpandConvLayer.cpp
paddle/gserver/layers/ExpandConvLayer.cpp
+1
-2
未找到文件。
paddle/function/nnpack/NNPACKConvOp.cpp
浏览文件 @
455ad5b5
...
@@ -49,9 +49,7 @@ class NNPACKConvFunction : public ConvFunctionBase {
...
@@ -49,9 +49,7 @@ class NNPACKConvFunction : public ConvFunctionBase {
public:
public:
void
init
(
const
FuncConfig
&
config
)
override
{
void
init
(
const
FuncConfig
&
config
)
override
{
ConvFunctionBase
::
init
(
config
);
ConvFunctionBase
::
init
(
config
);
CHECK_EQ
(
groups_
,
(
size_t
)
1
);
algorithm_
=
get_nnp_convolution_algorithm
(
config
.
get
<
std
::
string
>
(
"algo"
));
algorithm_
=
get_nnp_convolution_algorithm
(
config
.
get
<
std
::
string
>
(
"algo"
));
// algorithm_ = nnp_convolution_algorithm_auto;
transform_strategy_
=
nnp_convolution_transform_strategy_compute
;
transform_strategy_
=
nnp_convolution_transform_strategy_compute
;
nnp_status
status
=
nnp_initialize
();
nnp_status
status
=
nnp_initialize
();
CHECK_EQ
(
status
,
nnp_status_success
);
CHECK_EQ
(
status
,
nnp_status_success
);
...
@@ -67,8 +65,7 @@ public:
...
@@ -67,8 +65,7 @@ public:
}
}
}
}
virtual
void
check
(
const
BufferArgs
&
inputs
,
void
check
(
const
BufferArgs
&
inputs
,
const
BufferArgs
&
outputs
)
override
{
const
BufferArgs
&
outputs
)
override
{
const
TensorShape
&
input
=
inputs
[
0
].
shape
();
const
TensorShape
&
input
=
inputs
[
0
].
shape
();
const
TensorShape
&
filter
=
inputs
[
1
].
shape
();
const
TensorShape
&
filter
=
inputs
[
1
].
shape
();
const
TensorShape
&
output
=
outputs
[
0
].
shape
();
const
TensorShape
&
output
=
outputs
[
0
].
shape
();
...
@@ -91,8 +88,8 @@ public:
...
@@ -91,8 +88,8 @@ public:
size_t
filterHeight
=
getFilterHeight
(
filter
);
size_t
filterHeight
=
getFilterHeight
(
filter
);
size_t
filterWidth
=
getFilterWidth
(
filter
);
size_t
filterWidth
=
getFilterWidth
(
filter
);
size_t
outputChannels
=
output
[
1
];
size_t
outputChannels
=
output
[
1
];
//
size_t outputHeight = output[2];
size_t
outputHeight
=
output
[
2
];
//
size_t outputWidth = output[3];
size_t
outputWidth
=
output
[
3
];
nnp_size
inputSize
=
{.
width
=
inputWidth
,
.
height
=
inputHeight
};
nnp_size
inputSize
=
{.
width
=
inputWidth
,
.
height
=
inputHeight
};
nnp_padding
padding
=
{.
top
=
(
size_t
)
paddingH
(),
nnp_padding
padding
=
{.
top
=
(
size_t
)
paddingH
(),
...
@@ -171,49 +168,58 @@ public:
...
@@ -171,49 +168,58 @@ public:
}
}
}
}
size_t
inputOffset
=
inputChannels
/
groups_
*
inputHeight
*
inputWidth
;
size_t
outputOffset
=
outputChannels
/
groups_
*
outputHeight
*
outputWidth
;
size_t
filterOffset
=
filter
.
getElements
()
/
groups_
;
if
(
batchSize
==
1
)
{
if
(
batchSize
==
1
)
{
nnp_status
status
=
for
(
size_t
g
=
0
;
g
<
groups_
;
g
++
)
{
nnp_convolution_inference
(
algorithm_
,
nnp_status
status
=
transform_strategy_
,
nnp_convolution_inference
(
algorithm_
,
inputChannels
,
transform_strategy_
,
outputChannels
,
inputChannels
/
groups_
,
inputSize
,
outputChannels
/
groups_
,
padding
,
inputSize
,
kernelSize
,
padding
,
outputSubsampling
,
kernelSize
,
inputData
,
outputSubsampling
,
filterData
,
inputData
+
inputOffset
*
g
,
nullptr
,
/* bias */
filterData
+
filterOffset
*
g
,
outputData
,
nullptr
,
/* bias */
bufferPtr
,
outputData
+
outputOffset
*
g
,
sizePtr
,
bufferPtr
,
nnp_activation_identity
,
sizePtr
,
nullptr
,
nnp_activation_identity
,
threadpool_
,
/* threadpool */
nullptr
,
nullptr
);
threadpool_
,
/* threadpool */
CHECK_EQ
(
status
,
nnp_status_success
);
nullptr
);
CHECK_EQ
(
status
,
nnp_status_success
);
}
}
else
{
}
else
{
// only supports stride = 1
for
(
size_t
g
=
0
;
g
<
groups_
;
g
++
)
{
CHECK_EQ
(
strideH
(),
1
);
// only supports stride = 1
CHECK_EQ
(
strideW
(),
1
);
CHECK_EQ
(
strideH
(),
1
);
nnp_status
status
=
nnp_convolution_output
(
algorithm_
,
CHECK_EQ
(
strideW
(),
1
);
batchSize
,
nnp_status
status
=
inputChannels
,
nnp_convolution_output
(
algorithm_
,
outputChannels
,
batchSize
,
inputSize
,
inputChannels
/
groups_
,
padding
,
outputChannels
/
groups_
,
kernelSize
,
inputSize
,
inputData
,
padding
,
filterData
,
kernelSize
,
nullptr
,
/* bias */
inputData
+
inputOffset
*
g
,
outputData
,
filterData
+
filterOffset
*
g
,
bufferPtr
,
nullptr
,
/* bias */
sizePtr
,
outputData
+
outputOffset
*
g
,
nnp_activation_identity
,
bufferPtr
,
nullptr
,
sizePtr
,
threadpool_
,
/* threadpool */
nnp_activation_identity
,
nullptr
);
nullptr
,
CHECK_EQ
(
status
,
nnp_status_success
);
threadpool_
,
/* threadpool */
nullptr
);
CHECK_EQ
(
status
,
nnp_status_success
);
}
}
}
}
}
...
...
paddle/gserver/layers/ExpandConvLayer.cpp
浏览文件 @
455ad5b5
...
@@ -57,8 +57,7 @@ bool ExpandConvLayer::init(const LayerMap &layerMap,
...
@@ -57,8 +57,7 @@ bool ExpandConvLayer::init(const LayerMap &layerMap,
convGradFilterType
=
"GemmConvGradFilter"
;
convGradFilterType
=
"GemmConvGradFilter"
;
}
}
if
(
FLAGS_use_nnpack
)
{
if
(
FLAGS_use_nnpack
&&
!
isDeconv_
)
{
CHECK_EQ
(
isDeconv_
,
false
);
createFunction
(
forward_
,
createFunction
(
forward_
,
"NNPACKConv"
,
"NNPACKConv"
,
FuncConfig
()
FuncConfig
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录