Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
639c8fc2
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
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看板
未验证
提交
639c8fc2
编写于
10月 19, 2018
作者:
R
Ray Liu
提交者:
GitHub
10月 19, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1155 from Eclipsess/develop
fix
#1154
paddle_mobile_enforce
上级
329b64f4
6b91b068
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
14 addition
and
29 deletion
+14
-29
src/framework/load_ops.h
src/framework/load_ops.h
+6
-0
src/operators/kernel/central-arm-func/sum_arm_func.h
src/operators/kernel/central-arm-func/sum_arm_func.h
+4
-8
src/operators/math/selected_rows_functor.h
src/operators/math/selected_rows_functor.h
+4
-3
src/operators/op_param.h
src/operators/op_param.h
+0
-18
未找到文件。
src/framework/load_ops.h
浏览文件 @
639c8fc2
...
...
@@ -199,6 +199,12 @@ LOAD_OP3(pool2d, CPU, MALI_GPU, FPGA);
#ifdef MULTICLASSNMS_OP
LOAD_OP1
(
multiclass_nms
,
CPU
);
#endif
#ifdef SUM_OP
LOAD_OP1
(
sum
,
CPU
);
#endif
#ifdef ELEMENTWISEMUL_OP
LOAD_OP1
(
elementwise_mul
,
CPU
);
#endif
#ifdef SLICE_OP
LOAD_OP2
(
slice
,
CPU
,
MALI_GPU
);
#endif
...
...
src/operators/kernel/central-arm-func/sum_arm_func.h
浏览文件 @
639c8fc2
...
...
@@ -27,13 +27,11 @@ void SumCompute(const SumParam<CPU> ¶m) {
auto
*
outvar
=
param
.
OutVar
();
bool
in_place
=
outvar
==
inputsvars
[
0
];
DLOG
<<
"11:"
;
if
(
outvar
->
IsType
<
framework
::
LoDTensor
>
())
{
auto
*
out
=
outvar
->
GetMutable
<
LoDTensor
>
();
if
(
!
in_place
)
{
out
->
mutable_data
<
float
>
();
}
DLOG
<<
"1:"
;
auto
*
outptr
=
out
->
data
<
float
>
();
// auto result = Flatten(*out);
...
...
@@ -62,7 +60,6 @@ void SumCompute(const SumParam<CPU> ¶m) {
}
}
else
if
(
outvar
->
IsType
<
framework
::
SelectedRows
>
())
{
DLOG
<<
"2:"
;
std
::
unique_ptr
<
framework
::
SelectedRows
>
in0
;
if
(
in_place
)
{
// If is in_place, we store the input[0] to in0
...
...
@@ -119,12 +116,12 @@ void SumCompute(const SumParam<CPU> ¶m) {
if
(
sel_row
.
rows
().
size
()
==
0
)
{
continue
;
}
PADDLE_MOBILE_ENFORCE
(
out
->
height
()
==
sel_row
.
height
());
PADDLE_MOBILE_ENFORCE
(
out
->
height
()
==
sel_row
.
height
(),
"seletrows height != outheight"
);
functor
(
sel_row
,
offset
,
out
);
offset
+=
sel_row
.
value
().
numel
();
}
}
else
if
(
outvar
->
IsType
<
LoDTensorArray
>
())
{
DLOG
<<
"3:"
;
auto
&
out_array
=
*
outvar
->
GetMutable
<
LoDTensorArray
>
();
for
(
size_t
i
=
in_place
?
1
:
0
;
i
<
inputsvars
.
size
();
++
i
)
{
PADDLE_MOBILE_ENFORCE
(
inputsvars
[
i
]
->
IsType
<
LoDTensorArray
>
(),
...
...
@@ -140,7 +137,8 @@ void SumCompute(const SumParam<CPU> ¶m) {
framework
::
TensorCopy
((
*
in_array
)[
i
],
&
out_array
[
i
]);
out_array
[
i
].
set_lod
((
*
in_array
)[
i
].
lod
());
}
else
{
PADDLE_MOBILE_ENFORCE
(
out_array
[
i
].
lod
()
==
(
*
in_array
)[
i
].
lod
());
PADDLE_MOBILE_ENFORCE
(
out_array
[
i
].
lod
()
==
(
*
in_array
)[
i
].
lod
(),
"outLod != inLod"
);
auto
*
inptr
=
(
*
in_array
)[
i
].
data
<
float
>
();
auto
*
outptr
=
out_array
[
i
].
data
<
float
>
();
...
...
@@ -152,9 +150,7 @@ void SumCompute(const SumParam<CPU> ¶m) {
}
}
}
else
{
DLOG
<<
"2:"
;
if
(
outvar
->
IsType
<
framework
::
Tensor
>
())
{
DLOG
<<
"3: "
;
}
PADDLE_MOBILE_THROW_EXCEPTION
(
"Unexpected branch, output variable type is %s"
,
outvar
->
Type
().
name
());
...
...
src/operators/math/selected_rows_functor.h
浏览文件 @
639c8fc2
...
...
@@ -47,7 +47,7 @@ struct SelectedRowsAddTo {
const
int64_t
input2_offset
,
framework
::
SelectedRows
*
input2
)
{
auto
in1_height
=
input1
.
height
();
PADDLE_MOBILE_ENFORCE
(
in1_height
==
input2
->
height
());
PADDLE_MOBILE_ENFORCE
(
in1_height
==
input2
->
height
()
,
"height error"
);
auto
&
in1_rows
=
input1
.
rows
();
auto
&
in2_rows
=
*
(
input2
->
mutable_rows
());
...
...
@@ -77,13 +77,14 @@ struct SelectedRowsAddToTensor {
framework
::
Tensor
*
input2
)
{
auto
in1_height
=
input1
.
height
();
auto
in2_dims
=
input2
->
dims
();
PADDLE_MOBILE_ENFORCE
(
in1_height
==
in2_dims
[
0
]);
PADDLE_MOBILE_ENFORCE
(
in1_height
==
in2_dims
[
0
]
,
"height != dims[0]"
);
auto
&
in1_value
=
input1
.
value
();
auto
&
in1_rows
=
input1
.
rows
();
int64_t
in1_row_numel
=
in1_value
.
numel
()
/
in1_rows
.
size
();
PADDLE_MOBILE_ENFORCE
(
in1_row_numel
==
input2
->
numel
()
/
in1_height
);
PADDLE_MOBILE_ENFORCE
(
in1_row_numel
==
input2
->
numel
()
/
in1_height
,
"row_numel error"
);
auto
*
in1_data
=
in1_value
.
data
<
T
>
();
auto
*
input2_data
=
input2
->
data
<
T
>
();
...
...
src/operators/op_param.h
浏览文件 @
639c8fc2
...
...
@@ -471,15 +471,6 @@ class ElementwiseMulParam : OpParam {
GType
*
input_y_
;
GType
*
out_
;
int
axis_
;
#ifdef PADDLE_MOBILE_FPGA
private:
fpga
::
EWMulArgs
fpga_EW_mul_args
;
public:
const
fpga
::
EWMulArgs
&
FpgaArgs
()
const
{
return
fpga_EW_mul_args
;
}
void
SetFpgaArgs
(
const
fpga
::
EWMulArgs
&
args
)
{
fpga_EW_mul_args
=
args
;
}
#endif
};
#endif
...
...
@@ -628,15 +619,6 @@ class SumParam : public OpParam {
Variable
*
out_var_
;
vector
<
GType
*>
inputs_
;
GType
*
out_
;
#ifdef PADDLE_MOBILE_FPGA
private:
fpga
::
SumArgs
fpga_sum_args
;
public:
const
fpga
::
SumArgs
&
FpgaArgs
()
const
{
return
fpga_sum_args
;
}
void
SetFpgaArgs
(
const
fpga
::
SumArgs
&
args
)
{
fpga_sum_args
=
args
;
}
#endif
};
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录