Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
4b0d60e7
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看板
未验证
提交
4b0d60e7
编写于
4月 01, 2020
作者:
H
HappyAngel
提交者:
GitHub
4月 01, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[arm]imporve infer_shape profile (#3308)
* fix format, test=develop * add some op infershape implement, test=develop
上级
24b270d7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
198 addition
and
0 deletion
+198
-0
lite/operators/op_params.h
lite/operators/op_params.h
+198
-0
未找到文件。
lite/operators/op_params.h
浏览文件 @
4b0d60e7
...
...
@@ -158,6 +158,21 @@ struct MulParam : ParamBase {
int
y_num_col_dims
{
1
};
// for int8
WITH_INT8_CONFIG
///////////////////////////////////////////////////////////////////////////////////
// get a vector of input tensors
const
std
::
vector
<
const
Tensor
*>*
input_tensor_ptrs
()
{
if
(
UNLIKELY
(
input_tensor_ptrs_cache_
))
{
input_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
const
Tensor
*>
({
x
,
y
}));
}
return
input_tensor_ptrs_cache_
.
get
();
}
// get a vector of output tensors
const
std
::
vector
<
Tensor
*>*
output_tensor_ptrs
()
{
if
(
UNLIKELY
(
output_tensor_ptrs_cache_
))
{
output_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
lite
::
Tensor
*>
({
output
}));
}
return
output_tensor_ptrs_cache_
.
get
();
}
};
struct
MulGradParam
:
ParamBase
{
...
...
@@ -226,6 +241,21 @@ struct ScaleParam : ParamBase {
float
scale
{
1.
};
float
bias
{};
bool
bias_after_scale
{
true
};
///////////////////////////////////////////////////////////////////////////////////
// get a vector of input tensors
const
std
::
vector
<
const
Tensor
*>*
input_tensor_ptrs
()
{
if
(
UNLIKELY
(
input_tensor_ptrs_cache_
))
{
input_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
const
Tensor
*>
({
x
}));
}
return
input_tensor_ptrs_cache_
.
get
();
}
// get a vector of output tensors
const
std
::
vector
<
Tensor
*>*
output_tensor_ptrs
()
{
if
(
UNLIKELY
(
output_tensor_ptrs_cache_
))
{
output_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
lite
::
Tensor
*>
({
output
}));
}
return
output_tensor_ptrs_cache_
.
get
();
}
};
// For Softmax op
...
...
@@ -260,6 +290,21 @@ struct ReshapeParam : ParamBase {
lite
::
Tensor
*
xshape
{};
bool
inplace
{
false
};
///////////////////////////////////////////////////////////////////////////////////
// get a vector of input tensors
const
std
::
vector
<
const
Tensor
*>*
input_tensor_ptrs
()
{
if
(
UNLIKELY
(
input_tensor_ptrs_cache_
))
{
input_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
const
Tensor
*>
({
x
}));
}
return
input_tensor_ptrs_cache_
.
get
();
}
// get a vector of output tensors
const
std
::
vector
<
Tensor
*>*
output_tensor_ptrs
()
{
if
(
UNLIKELY
(
output_tensor_ptrs_cache_
))
{
output_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
lite
::
Tensor
*>
({
output
}));
}
return
output_tensor_ptrs_cache_
.
get
();
}
};
// For Concat op
...
...
@@ -268,6 +313,24 @@ struct ConcatParam : ParamBase {
lite
::
Tensor
*
output
{};
int
axis
{
0
};
lite
::
Tensor
*
axis_tensor
{};
// get a vector of input tensors
const
std
::
vector
<
const
Tensor
*>*
input_tensor_ptrs
()
{
if
(
UNLIKELY
(
input_tensor_ptrs_cache_
))
{
std
::
vector
<
const
Tensor
*>
vec
;
for
(
auto
in
:
x
)
{
vec
.
push_back
(
in
);
}
input_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
const
Tensor
*>
(
vec
));
}
return
input_tensor_ptrs_cache_
.
get
();
}
// get a vector of output tensors
const
std
::
vector
<
Tensor
*>*
output_tensor_ptrs
()
{
if
(
UNLIKELY
(
output_tensor_ptrs_cache_
))
{
output_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
lite
::
Tensor
*>
({
output
}));
}
return
output_tensor_ptrs_cache_
.
get
();
}
};
/// ----------------------- activation operators ----------------------
...
...
@@ -370,6 +433,21 @@ struct BatchNormParam : ParamBase {
float
epsilon
;
float
momentum
;
DataLayoutType
data_layout
{
DATALAYOUT
(
kNCHW
)};
///////////////////////////////////////////////////////////////////////////////////
// get a vector of input tensors
const
std
::
vector
<
const
Tensor
*>*
input_tensor_ptrs
()
{
if
(
UNLIKELY
(
input_tensor_ptrs_cache_
))
{
input_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
const
Tensor
*>
({
x
}));
}
return
input_tensor_ptrs_cache_
.
get
();
}
// get a vector of output tensors
const
std
::
vector
<
Tensor
*>*
output_tensor_ptrs
()
{
if
(
UNLIKELY
(
output_tensor_ptrs_cache_
))
{
output_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
lite
::
Tensor
*>
({
y
}));
}
return
output_tensor_ptrs_cache_
.
get
();
}
};
// For Pooling op
...
...
@@ -394,6 +472,21 @@ struct PoolParam : ParamBase {
std
::
string
data_format
{
"AnyLayout"
};
// for int8
WITH_INT8_CONFIG
///////////////////////////////////////////////////////////////////////////////////
// get a vector of input tensors
const
std
::
vector
<
const
Tensor
*>*
input_tensor_ptrs
()
{
if
(
UNLIKELY
(
input_tensor_ptrs_cache_
))
{
input_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
const
Tensor
*>
({
x
}));
}
return
input_tensor_ptrs_cache_
.
get
();
}
// get a vector of output tensors
const
std
::
vector
<
Tensor
*>*
output_tensor_ptrs
()
{
if
(
UNLIKELY
(
output_tensor_ptrs_cache_
))
{
output_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
lite
::
Tensor
*>
({
output
}));
}
return
output_tensor_ptrs_cache_
.
get
();
}
};
// For Dropout op
...
...
@@ -418,6 +511,21 @@ struct SplitParam : ParamBase {
int
axis
{
-
1
};
int
num
{
0
};
std
::
vector
<
int
>
sections
;
///////////////////////////////////////////////////////////////////////////////////
// get a vector of input tensors
const
std
::
vector
<
const
Tensor
*>*
input_tensor_ptrs
()
{
if
(
UNLIKELY
(
input_tensor_ptrs_cache_
))
{
input_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
const
Tensor
*>
({
x
}));
}
return
input_tensor_ptrs_cache_
.
get
();
}
// get a vector of output tensors
const
std
::
vector
<
Tensor
*>*
output_tensor_ptrs
()
{
if
(
UNLIKELY
(
output_tensor_ptrs_cache_
))
{
output_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
lite
::
Tensor
*>
({
output
}));
}
return
output_tensor_ptrs_cache_
.
get
();
}
};
// For Transpose op
...
...
@@ -429,6 +537,21 @@ struct TransposeParam : ParamBase {
std
::
vector
<
int
>
axis
;
bool
use_mkldnn
{
false
};
std
::
string
data_format
{
"AnyLayout"
};
///////////////////////////////////////////////////////////////////////////////////
// // get a vector of input tensors
const
std
::
vector
<
const
Tensor
*>*
input_tensor_ptrs
()
{
if
(
UNLIKELY
(
input_tensor_ptrs_cache_
))
{
input_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
const
Tensor
*>
({
x
}));
}
return
input_tensor_ptrs_cache_
.
get
();
}
// get a vector of output tensors
const
std
::
vector
<
Tensor
*>*
output_tensor_ptrs
()
{
if
(
UNLIKELY
(
output_tensor_ptrs_cache_
))
{
output_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
lite
::
Tensor
*>
({
output
}));
}
return
output_tensor_ptrs_cache_
.
get
();
}
};
/// ----------------------- element wise operators ----------------------
...
...
@@ -754,6 +877,21 @@ struct Im2SequenceParam : ParamBase {
struct
SequenceSoftmaxParam
:
ParamBase
{
const
lite
::
Tensor
*
X
{};
lite
::
Tensor
*
Out
{};
///////////////////////////////////////////////////////////////////////////////////
// // get a vector of input tensors
const
std
::
vector
<
const
Tensor
*>*
input_tensor_ptrs
()
{
if
(
UNLIKELY
(
input_tensor_ptrs_cache_
))
{
input_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
const
Tensor
*>
({
X
}));
}
return
input_tensor_ptrs_cache_
.
get
();
}
// get a vector of output tensors
const
std
::
vector
<
Tensor
*>*
output_tensor_ptrs
()
{
if
(
UNLIKELY
(
output_tensor_ptrs_cache_
))
{
output_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
lite
::
Tensor
*>
({
Out
}));
}
return
output_tensor_ptrs_cache_
.
get
();
}
};
struct
NormParam
:
ParamBase
{
...
...
@@ -984,6 +1122,21 @@ struct SliceParam : ParamBase {
std
::
vector
<
lite
::
Tensor
*>
EndsTensorList
{};
lite
::
Tensor
*
StartsTensor
{
nullptr
};
lite
::
Tensor
*
EndsTensor
{
nullptr
};
///////////////////////////////////////////////////////////////////////////////////
// get a vector of input tensors
const
std
::
vector
<
const
Tensor
*>*
input_tensor_ptrs
()
{
if
(
UNLIKELY
(
input_tensor_ptrs_cache_
))
{
input_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
const
Tensor
*>
({
X
}));
}
return
input_tensor_ptrs_cache_
.
get
();
}
// get a vector of output tensors
const
std
::
vector
<
Tensor
*>*
output_tensor_ptrs
()
{
if
(
UNLIKELY
(
output_tensor_ptrs_cache_
))
{
output_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
lite
::
Tensor
*>
({
Out
}));
}
return
output_tensor_ptrs_cache_
.
get
();
}
};
struct
AffineChannelParam
:
ParamBase
{
...
...
@@ -1031,6 +1184,21 @@ struct SqueezeParam : ParamBase {
lite
::
Tensor
*
Out
{};
lite
::
Tensor
*
XShape
{};
std
::
vector
<
int
>
axes
{};
///////////////////////////////////////////////////////////////////////////////////
// get a vector of input tensors
const
std
::
vector
<
const
Tensor
*>*
input_tensor_ptrs
()
{
if
(
UNLIKELY
(
input_tensor_ptrs_cache_
))
{
input_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
const
Tensor
*>
({
X
}));
}
return
input_tensor_ptrs_cache_
.
get
();
}
// get a vector of output tensors
const
std
::
vector
<
Tensor
*>*
output_tensor_ptrs
()
{
if
(
UNLIKELY
(
output_tensor_ptrs_cache_
))
{
output_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
lite
::
Tensor
*>
({
Out
}));
}
return
output_tensor_ptrs_cache_
.
get
();
}
};
struct
UnsqueezeParam
:
ParamBase
{
...
...
@@ -1040,6 +1208,21 @@ struct UnsqueezeParam : ParamBase {
std
::
vector
<
int
>
axes
{};
const
lite
::
Tensor
*
axes_tensor
{};
std
::
vector
<
const
lite
::
Tensor
*>
axes_tensor_vct
{};
///////////////////////////////////////////////////////////////////////////////////
// get a vector of input tensors
const
std
::
vector
<
const
Tensor
*>*
input_tensor_ptrs
()
{
if
(
UNLIKELY
(
input_tensor_ptrs_cache_
))
{
input_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
const
Tensor
*>
({
X
}));
}
return
input_tensor_ptrs_cache_
.
get
();
}
// get a vector of output tensors
const
std
::
vector
<
Tensor
*>*
output_tensor_ptrs
()
{
if
(
UNLIKELY
(
output_tensor_ptrs_cache_
))
{
output_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
lite
::
Tensor
*>
({
Out
}));
}
return
output_tensor_ptrs_cache_
.
get
();
}
};
/// ----------------------- expand operators ----------------------
...
...
@@ -1057,6 +1240,21 @@ struct MatMulParam : ParamBase {
bool
transpose_X
{
false
};
bool
transpose_Y
{
false
};
float
alpha
{
1.0
f
};
///////////////////////////////////////////////////////////////////////////////////
// get a vector of input tensors
const
std
::
vector
<
const
Tensor
*>*
input_tensor_ptrs
()
{
if
(
UNLIKELY
(
input_tensor_ptrs_cache_
))
{
input_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
const
Tensor
*>
({
X
,
Y
}));
}
return
input_tensor_ptrs_cache_
.
get
();
}
// get a vector of output tensors
const
std
::
vector
<
Tensor
*>*
output_tensor_ptrs
()
{
if
(
UNLIKELY
(
output_tensor_ptrs_cache_
))
{
output_tensor_ptrs_cache_
.
reset
(
new
std
::
vector
<
lite
::
Tensor
*>
({
Out
}));
}
return
output_tensor_ptrs_cache_
.
get
();
}
};
struct
GatherParam
:
ParamBase
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录