Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
924fed01
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
924fed01
编写于
6月 13, 2019
作者:
Z
zhupy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix split unit test
上级
7e714e2b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
22 deletion
+28
-22
paddle/fluid/lite/kernels/arm/split_compute_test.cc
paddle/fluid/lite/kernels/arm/split_compute_test.cc
+25
-19
paddle/fluid/lite/operators/split_op.cc
paddle/fluid/lite/operators/split_op.cc
+3
-3
未找到文件。
paddle/fluid/lite/kernels/arm/split_compute_test.cc
浏览文件 @
924fed01
...
...
@@ -24,20 +24,10 @@ namespace kernels {
namespace
arm
{
void
splite_resize_out
(
const
lite
::
Tensor
*
din
,
std
::
vector
<
lite
::
Tensor
*>*
dout
,
int
axis
,
int
num
,
const
std
::
vector
<
int
>&
sections
)
{
for
(
auto
out
:
*
dout
)
delete
out
;
dout
->
clear
();
const
std
::
vector
<
lite
::
Tensor
*>&
dout
,
int
axis
,
int
num
,
const
std
::
vector
<
int
>&
sections
)
{
auto
in_dims
=
din
->
dims
();
int
outs_number
;
if
(
num
>
0
)
{
outs_number
=
num
;
}
else
{
outs_number
=
sections
.
size
();
}
for
(
int
i
=
0
;
i
<
outs_number
;
i
++
)
{
dout
->
push_back
(
new
lite
::
Tensor
);
}
std
::
vector
<
lite
::
DDimLite
>
outs_dims
;
outs_dims
.
reserve
(
outs_number
);
...
...
@@ -58,7 +48,7 @@ void splite_resize_out(const lite::Tensor* din,
}
for
(
int
j
=
0
;
j
<
outs_dims
.
size
();
++
j
)
{
(
*
dout
)
[
j
]
->
Resize
(
outs_dims
[
j
]);
dout
[
j
]
->
Resize
(
outs_dims
[
j
]);
}
}
...
...
@@ -75,7 +65,7 @@ void split_compute_ref(const operators::SplitParam& param) {
}
int
input_offset
=
0
;
for
(
auto
out
:
*
dout
)
{
for
(
auto
out
:
dout
)
{
auto
out_dim
=
out
->
dims
();
std
::
vector
<
int
>
out_strides
(
out_dim
.
size
());
out_strides
[
out_dim
.
size
()
-
1
]
=
out_dim
[
out_dim
.
size
()
-
1
];
...
...
@@ -128,16 +118,32 @@ TEST(split_arm, compute) {
for
(
int
i
=
0
;
i
<
x
.
dims
().
production
();
i
++
)
{
x_data
[
i
]
=
i
;
}
splite_resize_out
(
&
x
,
&
output
,
axis
,
num
,
sections
);
splite_resize_out
(
&
x
,
&
output_ref
,
axis
,
num
,
sections
);
for
(
auto
out
:
output
)
delete
out
;
for
(
auto
out
:
output_ref
)
delete
out
;
output
.
clear
();
output_ref
.
clear
();
int
outs_number
;
if
(
num
>
0
)
{
outs_number
=
num
;
}
else
{
outs_number
=
sections
.
size
();
}
for
(
int
i
=
0
;
i
<
outs_number
;
i
++
)
{
output
.
push_back
(
new
lite
::
Tensor
);
output_ref
.
push_back
(
new
lite
::
Tensor
);
}
splite_resize_out
(
&
x
,
output
,
axis
,
num
,
sections
);
splite_resize_out
(
&
x
,
output_ref
,
axis
,
num
,
sections
);
param
.
x
=
&
x
;
param
.
axis
=
axis
;
param
.
num
=
num
;
param
.
sections
=
&
sections
;
param
.
output
=
&
output
;
param
.
sections
=
sections
;
param
.
output
=
output
;
split
.
SetParam
(
param
);
split
.
Run
();
param
.
output
=
&
output_ref
;
param
.
output
=
output_ref
;
split_compute_ref
<
float
>
(
param
);
for
(
int
i
=
0
;
i
<
output
.
size
();
i
++
)
{
float
*
output_data
=
output
[
i
]
->
mutable_data
<
float
>
();
...
...
paddle/fluid/lite/operators/split_op.cc
浏览文件 @
924fed01
...
...
@@ -21,7 +21,7 @@ namespace operators {
bool
SplitOp
::
CheckShape
()
const
{
CHECK_OR_FALSE
(
param_
.
x
);
CHECK_
OR_FALSE
(
param_
.
output
);
CHECK_
GT_OR_FALSE
(
param_
.
output
.
size
(),
1UL
);
auto
x_dims
=
param_
.
x
->
dims
();
auto
x_rank
=
x_dims
.
size
();
CHECK_OR_FALSE
(
param_
.
axis
>=
-
static_cast
<
int
>
(
x_rank
)
&&
...
...
@@ -68,7 +68,7 @@ bool SplitOp::AttachImpl(const cpp::OpDesc &opdesc, lite::Scope *scope) {
param_
.
sections
=
opdesc
.
GetAttr
<
std
::
vector
<
int
>>
(
"sections"
);
param_
.
x
=
const_cast
<
lite
::
Tensor
*>
(
&
scope
->
FindVar
(
opdesc
.
Input
(
"X"
).
front
())
->
Get
<
lite
::
Tensor
>
());
auto
outs
=
op_desc
.
Output
(
"Out"
);
auto
outs
=
op_desc
.
Output
(
"Out"
)
.
front
;
for
(
auto
var
:
outs
)
{
param_
.
output
.
push_back
(
scope
->
FindVar
(
var
)
->
GetMutable
<
lite
::
Tensor
>
());
}
...
...
@@ -79,4 +79,4 @@ bool SplitOp::AttachImpl(const cpp::OpDesc &opdesc, lite::Scope *scope) {
}
// namespace lite
}
// namespace paddle
REGISTER_LITE_OP
(
s
oftmax
,
paddle
::
lite
::
operators
::
Softmax
Op
);
REGISTER_LITE_OP
(
s
plit
,
paddle
::
lite
::
operators
::
Split
Op
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录