Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
86bb150b
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
332
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
86bb150b
编写于
4月 03, 2020
作者:
D
dingminghui
提交者:
jackzhang235
4月 08, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(mlu): fix memory leak
destroy base op after fuse
上级
5930a75d
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
16 addition
and
7 deletion
+16
-7
lite/kernels/mlu/bridges/act_op.cc
lite/kernels/mlu/bridges/act_op.cc
+1
-0
lite/kernels/mlu/bridges/batch_norm_op.cc
lite/kernels/mlu/bridges/batch_norm_op.cc
+2
-0
lite/kernels/mlu/bridges/concat_op.cc
lite/kernels/mlu/bridges/concat_op.cc
+1
-0
lite/kernels/mlu/bridges/conv_op.cc
lite/kernels/mlu/bridges/conv_op.cc
+1
-0
lite/kernels/mlu/bridges/elementwise_ops.cc
lite/kernels/mlu/bridges/elementwise_ops.cc
+2
-0
lite/kernels/mlu/bridges/fc_op.cc
lite/kernels/mlu/bridges/fc_op.cc
+1
-0
lite/kernels/mlu/bridges/graph.h
lite/kernels/mlu/bridges/graph.h
+0
-4
lite/kernels/mlu/bridges/interpolate_op.cc
lite/kernels/mlu/bridges/interpolate_op.cc
+1
-0
lite/kernels/mlu/bridges/pool_op.cc
lite/kernels/mlu/bridges/pool_op.cc
+1
-0
lite/kernels/mlu/bridges/scale_op.cc
lite/kernels/mlu/bridges/scale_op.cc
+1
-0
lite/kernels/mlu/bridges/softmax_op.cc
lite/kernels/mlu/bridges/softmax_op.cc
+1
-0
lite/kernels/mlu/bridges/transpose_op.cc
lite/kernels/mlu/bridges/transpose_op.cc
+4
-3
未找到文件。
lite/kernels/mlu/bridges/act_op.cc
浏览文件 @
86bb150b
...
...
@@ -60,6 +60,7 @@ int ActConverter(void* ctx, OpLite* op, KernelBase* kernel) {
output_tensor
->
mlu_tensor
()));
}
graph
->
FuseOp
(
activation_op
);
CNML_CALL
(
cnmlDestroyBaseOp
(
&
activation_op
));
return
SUCCESS
;
}
...
...
lite/kernels/mlu/bridges/batch_norm_op.cc
浏览文件 @
86bb150b
...
...
@@ -81,6 +81,8 @@ int BatchNormConverter(void* ctx, OpLite* op, KernelBase* kernel) {
graph
->
BindConstData
(
mean_var_name
,
mean
);
graph
->
FuseOp
(
bn_op
);
CNML_CALL
(
cnmlDestroyBaseOp
(
&
bn_op
));
return
SUCCESS
;
}
...
...
lite/kernels/mlu/bridges/concat_op.cc
浏览文件 @
86bb150b
...
...
@@ -60,6 +60,7 @@ int ConcatConverter(void* ctx, OpLite* op, KernelBase* kernel) {
&
outputs
,
1
));
graph
->
FuseOp
(
concat_op
);
CNML_CALL
(
cnmlDestroyBaseOp
(
&
concat_op
));
return
SUCCESS
;
}
...
...
lite/kernels/mlu/bridges/conv_op.cc
浏览文件 @
86bb150b
...
...
@@ -278,6 +278,7 @@ int ConvConverter(void* ctx, OpLite* op, KernelBase* kernel) {
}
graph
->
BindConstData
(
filter_var_name
,
filter
);
graph
->
FuseOp
(
conv_op
);
CNML_CALL
(
cnmlDestroyBaseOp
(
&
conv_op
));
return
REBUILD_WHEN_SHAPE_CHANGED
;
}
...
...
lite/kernels/mlu/bridges/elementwise_ops.cc
浏览文件 @
86bb150b
...
...
@@ -117,6 +117,7 @@ int ElementwiseConverter(void* ctx, OpLite* op, KernelBase* kernel) {
}
graph
->
FuseOp
(
elementwise_op
);
CNML_CALL
(
cnmlDestroyBaseOp
(
&
elementwise_op
));
cnmlBaseOp_t
act_op
;
if
(
op_type
==
"fusion_elementwise_add_activation"
)
{
auto
mid_tensor
=
graph
->
GetNode
(
out_var_name
+
"_mid"
);
...
...
@@ -127,6 +128,7 @@ int ElementwiseConverter(void* ctx, OpLite* op, KernelBase* kernel) {
mid_tensor
->
mlu_tensor
(),
output_tensor
->
mlu_tensor
()));
graph
->
FuseOp
(
act_op
);
CNML_CALL
(
cnmlDestroyBaseOp
(
&
act_op
));
}
return
REBUILD_WHEN_SHAPE_CHANGED
;
}
...
...
lite/kernels/mlu/bridges/fc_op.cc
浏览文件 @
86bb150b
...
...
@@ -160,6 +160,7 @@ int FCConverter(void* ctx, OpLite* op, KernelBase* kernel) {
1
/
*
min_element
(
weight_scale
.
begin
(),
weight_scale
.
end
()));
graph
->
FuseOp
(
fc_op
);
CNML_CALL
(
cnmlDestroyBaseOp
(
&
fc_op
));
return
REBUILD_WHEN_SHAPE_CHANGED
;
}
...
...
lite/kernels/mlu/bridges/graph.h
浏览文件 @
86bb150b
...
...
@@ -49,9 +49,6 @@ class Graph {
~
Graph
()
{
FreeConstData
();
CNML_CALL
(
cnmlDestroyFusionOp
(
&
fusion_op_
));
for
(
auto
op
:
ops_
)
{
CNML_CALL
(
cnmlDestroyBaseOp
(
&
op
));
}
#if PRINT_HW_TIME
CNRT_CALL
(
cnrtDestroyNotifier
(
&
notifier_start_
));
CNRT_CALL
(
cnrtDestroyNotifier
(
&
notifier_end_
));
...
...
@@ -234,7 +231,6 @@ class Graph {
std
::
vector
<
void
*>
output_addrs_
;
std
::
vector
<
std
::
shared_ptr
<
MLUTensor
>>
input_tensors_
;
std
::
vector
<
std
::
shared_ptr
<
MLUTensor
>>
output_tensors_
;
std
::
vector
<
cnmlBaseOp_t
>
ops_
;
cnmlFusionOp_t
fusion_op_
;
std
::
vector
<
void
*>
const_data_storage_
;
#if PRINT_HW_TIME
...
...
lite/kernels/mlu/bridges/interpolate_op.cc
浏览文件 @
86bb150b
...
...
@@ -85,6 +85,7 @@ int InterpolateConverter(void* ctx, OpLite* op, KernelBase* kernel) {
nn_param
));
CNML_CALL
(
cnmlDestroyNearestNeighborOpParam
(
&
nn_param
));
graph
->
FuseOp
(
interp_op
);
CNML_CALL
(
cnmlDestroyBaseOp
(
&
interp_op
));
return
SUCCESS
;
}
...
...
lite/kernels/mlu/bridges/pool_op.cc
浏览文件 @
86bb150b
...
...
@@ -121,6 +121,7 @@ int PoolConverter(void* ctx, OpLite* op, KernelBase* kernel) {
output_tensor
->
mlu_tensor
()));
CNML_CALL
(
cnmlDestroyPoolOpParam
(
&
pool_param
));
graph
->
FuseOp
(
pool_op
);
CNML_CALL
(
cnmlDestroyBaseOp
(
&
pool_op
));
return
SUCCESS
;
}
...
...
lite/kernels/mlu/bridges/scale_op.cc
浏览文件 @
86bb150b
...
...
@@ -61,6 +61,7 @@ int ScaleConverter(void* ctx, OpLite* op, KernelBase* kernel) {
alpha_tensor
->
mlu_tensor
(),
beta_tensor
->
mlu_tensor
()));
graph
->
FuseOp
(
scale_op
);
CNML_CALL
(
cnmlDestroyBaseOp
(
&
scale_op
));
return
SUCCESS
;
}
...
...
lite/kernels/mlu/bridges/softmax_op.cc
浏览文件 @
86bb150b
...
...
@@ -55,6 +55,7 @@ int SoftmaxConverter(void* ctx, OpLite* op, KernelBase* kernel) {
graph
->
GetNode
(
x_var_name
)
->
mlu_tensor
(),
output_tensor
->
mlu_tensor
()));
graph
->
FuseOp
(
softmax_op
);
CNML_CALL
(
cnmlDestroyBaseOp
(
&
softmax_op
));
return
SUCCESS
;
}
...
...
lite/kernels/mlu/bridges/transpose_op.cc
浏览文件 @
86bb150b
...
...
@@ -61,7 +61,7 @@ int TransposeConverter(void* ctx, OpLite* op, KernelBase* kernel) {
CHECK
(
graph
->
HasNode
(
x_var_name
));
auto
input_tensor
=
graph
->
GetNode
(
x_var_name
);
cnmlBaseOp_t
transpose_op
_
{
nullptr
};
cnmlBaseOp_t
transpose_op
{
nullptr
};
cnmlNdTransposeOpParam_t
transpose_param
{
nullptr
};
...
...
@@ -69,12 +69,13 @@ int TransposeConverter(void* ctx, OpLite* op, KernelBase* kernel) {
&
transpose_param
,
axis_nhwc
.
data
(),
axis_nhwc
.
size
()));
// Use cnmlCreatexxxOpForward to create op.
CNML_CALL
(
cnmlCreateNdTransposeProOp
(
&
transpose_op
_
,
CNML_CALL
(
cnmlCreateNdTransposeProOp
(
&
transpose_op
,
input_tensor
->
mlu_tensor
(),
output_tensor
->
mlu_tensor
(),
transpose_param
));
graph
->
FuseOp
(
transpose_op_
);
graph
->
FuseOp
(
transpose_op
);
CNML_CALL
(
cnmlDestroyBaseOp
(
&
transpose_op
));
return
SUCCESS
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录