Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
8d326507
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看板
提交
8d326507
编写于
11月 14, 2019
作者:
C
chenjiaoAngel
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix x8d build error on shared_ptr, test=ddevelop
上级
3df6aa7e
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
14 addition
and
18 deletion
+14
-18
lite/kernels/npu/bridges/pool_op.cc
lite/kernels/npu/bridges/pool_op.cc
+1
-2
lite/kernels/npu/bridges/pool_op_test.cc
lite/kernels/npu/bridges/pool_op_test.cc
+3
-5
lite/kernels/opencl/pool_compute_test.cc
lite/kernels/opencl/pool_compute_test.cc
+2
-1
lite/kernels/x86/pool_compute_test.cc
lite/kernels/x86/pool_compute_test.cc
+2
-1
lite/kernels/xpu/bridges/pool_op.cc
lite/kernels/xpu/bridges/pool_op.cc
+3
-4
lite/kernels/xpu/bridges/pool_op_test.cc
lite/kernels/xpu/bridges/pool_op_test.cc
+3
-5
未找到文件。
lite/kernels/npu/bridges/pool_op.cc
浏览文件 @
8d326507
...
...
@@ -47,8 +47,7 @@ node_map_type PoolConverter(const std::shared_ptr<lite::OpLite> pool_op,
auto
ksize
=
op_info
->
GetAttr
<
std
::
vector
<
int
>>
(
"ksize"
);
auto
npu_window
=
ge
::
AttrValue
::
LIST_INT
(
ksize
.
begin
(),
ksize
.
end
());
auto
padding
=
*
(
op_info
->
GetAttr
<
std
::
shared_ptr
<
std
::
vector
<
int
>>>
(
"paddings"
));
auto
padding
=
op_info
->
GetAttr
<
std
::
vector
<
int
>>
(
"paddings"
);
bool
pads_equal
=
(
padding
[
0
]
==
padding
[
1
])
&&
(
padding
[
2
]
==
padding
[
3
]);
if
(
!
pads_equal
)
{
LOG
(
FATAL
)
...
...
lite/kernels/npu/bridges/pool_op_test.cc
浏览文件 @
8d326507
...
...
@@ -39,8 +39,7 @@ void pool_ref(const std::shared_ptr<operators::PoolOpLite> op) {
std
::
vector
<
int
>
ksize
=
op_info
->
GetAttr
<
std
::
vector
<
int
>>
(
"ksize"
);
std
::
vector
<
int
>
strides
=
op_info
->
GetAttr
<
std
::
vector
<
int
>>
(
"strides"
);
std
::
vector
<
int
>
paddings
=
*
(
op_info
->
GetAttr
<
std
::
shared_ptr
<
std
::
vector
<
int
>>>
(
"paddings"
));
std
::
vector
<
int
>
paddings
=
op_info
->
GetAttr
<
std
::
vector
<
int
>>
(
"paddings"
);
bool
exclusive
=
op_info
->
GetAttr
<
bool
>
(
"exclusive"
);
std
::
string
pooling_type
=
op_info
->
GetAttr
<
std
::
string
>
(
"pooling_type"
);
bool
global_pooling
=
op_info
->
GetAttr
<
bool
>
(
"global_pooling"
);
...
...
@@ -164,9 +163,8 @@ void test_pool(int bs,
opdesc
.
SetAttr
(
"global_pooling"
,
global_pooling
);
opdesc
.
SetAttr
(
"exclusive"
,
exclusive
);
opdesc
.
SetAttr
(
"strides"
,
std
::
vector
<
int
>
({
stride
,
stride
}));
opdesc
.
SetAttr
(
"paddings"
,
std
::
shared_ptr
<
std
::
vector
<
int
>>
({
padding
,
padding
,
padding
,
padding
}));
opdesc
.
SetAttr
(
"paddings"
,
std
::
vector
<
int
>
({
padding
,
padding
,
padding
,
padding
}));
// create and convert op to NPU model, then run it on NPU
auto
op
=
CreateOp
<
operators
::
PoolOpLite
>
(
opdesc
,
&
scope
);
...
...
lite/kernels/opencl/pool_compute_test.cc
浏览文件 @
8d326507
...
...
@@ -89,9 +89,10 @@ TEST(pool2d, compute) {
param
.
output
=
&
out
;
param
.
global_pooling
=
true
;
param
.
pooling_type
=
"avg"
;
param
.
paddings
=
std
::
make_shared
<
std
::
vector
<
int
>>
({
0
,
0
,
0
,
0
})
;
std
::
vector
<
int
>
paddings
=
{
0
,
0
,
0
,
0
}
;
param
.
strides
=
std
::
vector
<
int
>
{
1
,
1
};
param
.
ksize
=
std
::
vector
<
int
>
{
7
,
7
};
param
.
paddings
=
std
::
make_shared
<
std
::
vector
<
int
>>
(
paddings
);
std
::
unique_ptr
<
KernelContext
>
context
(
new
KernelContext
);
context
->
As
<
OpenCLContext
>
().
InitOnce
();
...
...
lite/kernels/x86/pool_compute_test.cc
浏览文件 @
8d326507
...
...
@@ -60,7 +60,8 @@ TEST(pool2d_x86, run_test) {
param
.
x
=
&
x
;
param
.
output
=
&
out
;
param
.
strides
=
{
2
,
2
};
param
.
paddings
=
std
::
make_shared
<
std
::
vector
<
int
>>
({
0
,
0
,
0
,
0
});
std
::
vector
<
int
>
paddings
=
{
0
,
0
,
0
,
0
};
param
.
paddings
=
std
::
make_shared
<
std
::
vector
<
int
>>
(
paddings
);
param
.
ksize
=
{
2
,
2
};
param
.
pooling_type
=
"max"
;
std
::
unique_ptr
<
KernelContext
>
ctx
(
new
KernelContext
);
...
...
lite/kernels/xpu/bridges/pool_op.cc
浏览文件 @
8d326507
...
...
@@ -38,8 +38,7 @@ node_map_type PoolConverter(const std::shared_ptr<lite::OpLite> op,
auto
x_var_name
=
op_info
->
Input
(
"X"
).
front
();
auto
pooling_type
=
op_info
->
GetAttr
<
std
::
string
>
(
"pooling_type"
);
auto
ceil_mode
=
op_info
->
GetAttr
<
bool
>
(
"ceil_mode"
);
auto
paddings
=
op_info
->
GetAttr
<
std
::
shared_ptr
<
std
::
vector
<
int
>>>
(
"paddings"
);
auto
paddings
=
op_info
->
GetAttr
<
std
::
vector
<
int
>>
(
"paddings"
);
auto
global_pooling
=
op_info
->
GetAttr
<
bool
>
(
"global_pooling"
);
auto
ksize
=
op_info
->
GetAttr
<
std
::
vector
<
int
>>
(
"ksize"
);
auto
strides
=
op_info
->
GetAttr
<
std
::
vector
<
int
>>
(
"strides"
);
...
...
@@ -58,7 +57,7 @@ node_map_type PoolConverter(const std::shared_ptr<lite::OpLite> op,
graph_ctx
->
builder
->
CreateMaxPool2D
(
*
input_nodes
.
at
(
x_var_name
),
lite
::
xpu
::
CvtShape
(
ksize
),
lite
::
xpu
::
CvtShape
(
strides
),
lite
::
xpu
::
CvtShape
(
*
paddings
),
lite
::
xpu
::
CvtShape
(
paddings
),
"NCHW"
,
ceil_mode
));
}
...
...
@@ -73,7 +72,7 @@ node_map_type PoolConverter(const std::shared_ptr<lite::OpLite> op,
graph_ctx
->
builder
->
CreateAvgPool2D
(
*
input_nodes
.
at
(
x_var_name
),
lite
::
xpu
::
CvtShape
(
ksize
),
lite
::
xpu
::
CvtShape
(
strides
),
lite
::
xpu
::
CvtShape
(
*
paddings
),
lite
::
xpu
::
CvtShape
(
paddings
),
"NCHW"
,
ceil_mode
,
!
exclusive
));
...
...
lite/kernels/xpu/bridges/pool_op_test.cc
浏览文件 @
8d326507
...
...
@@ -38,8 +38,7 @@ void pool_ref(const std::shared_ptr<operators::PoolOpLite> op) {
std
::
vector
<
int
>
ksize
=
op_info
->
GetAttr
<
std
::
vector
<
int
>>
(
"ksize"
);
std
::
vector
<
int
>
strides
=
op_info
->
GetAttr
<
std
::
vector
<
int
>>
(
"strides"
);
std
::
vector
<
int
>
paddings
=
*
(
op_info
->
GetAttr
<
std
::
shared_ptr
<
std
::
vector
<
int
>>>
(
"paddings"
));
std
::
vector
<
int
>
paddings
=
op_info
->
GetAttr
<
std
::
vector
<
int
>>
(
"paddings"
);
bool
exclusive
=
op_info
->
GetAttr
<
bool
>
(
"exclusive"
);
std
::
string
pooling_type
=
op_info
->
GetAttr
<
std
::
string
>
(
"pooling_type"
);
bool
global_pooling
=
op_info
->
GetAttr
<
bool
>
(
"global_pooling"
);
...
...
@@ -163,9 +162,8 @@ void test_pool(int bs,
opdesc
.
SetAttr
(
"global_pooling"
,
global_pooling
);
opdesc
.
SetAttr
(
"exclusive"
,
exclusive
);
opdesc
.
SetAttr
(
"strides"
,
std
::
vector
<
int
>
({
stride
,
stride
}));
opdesc
.
SetAttr
(
"paddings"
,
std
::
shared_ptr
<
std
::
vector
<
int
>>
({
padding
,
padding
,
padding
,
padding
}));
opdesc
.
SetAttr
(
"paddings"
,
std
::
vector
<
int
>
({
padding
,
padding
,
padding
,
padding
}));
opdesc
.
SetAttr
(
"ceil_mode"
,
ceil_mode
);
// create and convert op to XPU model, then run it on XPU
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录