Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
480a5446
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
480a5446
编写于
12月 15, 2017
作者:
Q
qingqing01
提交者:
GitHub
12月 15, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6659 from qingqing01/mobile_mem
Reduce memory usage in conv layer and RoI layer for mobile inference.
上级
c9076543
34960920
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
23 addition
and
9 deletion
+23
-9
paddle/function/GemmConvOp.cpp
paddle/function/GemmConvOp.cpp
+5
-0
paddle/gserver/layers/ROIPoolLayer.cpp
paddle/gserver/layers/ROIPoolLayer.cpp
+18
-9
未找到文件。
paddle/function/GemmConvOp.cpp
浏览文件 @
480a5446
...
@@ -126,6 +126,11 @@ public:
...
@@ -126,6 +126,11 @@ public:
inputData
+=
inputChannels
*
inputHeight
*
inputWidth
;
inputData
+=
inputChannels
*
inputHeight
*
inputWidth
;
outputData
+=
outputChannels
*
outputHeight
*
outputWidth
;
outputData
+=
outputChannels
*
outputHeight
*
outputWidth
;
}
}
#ifdef PADDLE_MOBILE_INFERENCE
if
(
Device
==
DEVICE_TYPE_CPU
)
{
delete
memory_
;
}
#endif
}
}
};
};
...
...
paddle/gserver/layers/ROIPoolLayer.cpp
浏览文件 @
480a5446
...
@@ -84,12 +84,15 @@ void ROIPoolLayer::forward(PassType passType) {
...
@@ -84,12 +84,15 @@ void ROIPoolLayer::forward(PassType passType) {
size_t
poolChannelOffset
=
pooledHeight_
*
pooledWidth_
;
size_t
poolChannelOffset
=
pooledHeight_
*
pooledWidth_
;
real
*
outputData
=
outputValue
->
getData
();
real
*
outputData
=
outputValue
->
getData
();
Matrix
::
resizeOrCreate
(
maxIdxs_
,
real
*
argmaxData
=
nullptr
;
numROIs
,
if
(
passType
!=
PASS_TEST
)
{
channels_
*
pooledHeight_
*
pooledWidth_
,
Matrix
::
resizeOrCreate
(
maxIdxs_
,
false
,
numROIs
,
false
);
channels_
*
pooledHeight_
*
pooledWidth_
,
real
*
argmaxData
=
maxIdxs_
->
getData
();
false
,
false
);
argmaxData
=
maxIdxs_
->
getData
();
}
for
(
size_t
n
=
0
;
n
<
numROIs
;
++
n
)
{
for
(
size_t
n
=
0
;
n
<
numROIs
;
++
n
)
{
// the first five elememts of each RoI should be:
// the first five elememts of each RoI should be:
...
@@ -128,14 +131,18 @@ void ROIPoolLayer::forward(PassType passType) {
...
@@ -128,14 +131,18 @@ void ROIPoolLayer::forward(PassType passType) {
bool
isEmpty
=
(
hend
<=
hstart
)
||
(
wend
<=
wstart
);
bool
isEmpty
=
(
hend
<=
hstart
)
||
(
wend
<=
wstart
);
size_t
poolIndex
=
ph
*
pooledWidth_
+
pw
;
size_t
poolIndex
=
ph
*
pooledWidth_
+
pw
;
outputData
[
poolIndex
]
=
isEmpty
?
0
:
-
FLT_MAX
;
outputData
[
poolIndex
]
=
isEmpty
?
0
:
-
FLT_MAX
;
argmaxData
[
poolIndex
]
=
-
1
;
if
(
argmaxData
)
{
argmaxData
[
poolIndex
]
=
-
1
;
}
for
(
size_t
h
=
hstart
;
h
<
hend
;
++
h
)
{
for
(
size_t
h
=
hstart
;
h
<
hend
;
++
h
)
{
for
(
size_t
w
=
wstart
;
w
<
wend
;
++
w
)
{
for
(
size_t
w
=
wstart
;
w
<
wend
;
++
w
)
{
size_t
index
=
h
*
width_
+
w
;
size_t
index
=
h
*
width_
+
w
;
if
(
batchData
[
index
]
>
outputData
[
poolIndex
])
{
if
(
batchData
[
index
]
>
outputData
[
poolIndex
])
{
outputData
[
poolIndex
]
=
batchData
[
index
];
outputData
[
poolIndex
]
=
batchData
[
index
];
argmaxData
[
poolIndex
]
=
index
;
if
(
argmaxData
)
{
argmaxData
[
poolIndex
]
=
index
;
}
}
}
}
}
}
}
...
@@ -143,7 +150,9 @@ void ROIPoolLayer::forward(PassType passType) {
...
@@ -143,7 +150,9 @@ void ROIPoolLayer::forward(PassType passType) {
}
}
batchData
+=
channelOffset
;
batchData
+=
channelOffset
;
outputData
+=
poolChannelOffset
;
outputData
+=
poolChannelOffset
;
argmaxData
+=
poolChannelOffset
;
if
(
argmaxData
)
{
argmaxData
+=
poolChannelOffset
;
}
}
}
bottomROIs
+=
roiOffset
;
bottomROIs
+=
roiOffset
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录