Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
05df5200
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看板
提交
05df5200
编写于
2月 06, 2020
作者:
L
Liu Yiqun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change all reference to const reference.
上级
dea6154b
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
33 addition
and
33 deletion
+33
-33
lite/kernels/x86/fc_compute.h
lite/kernels/x86/fc_compute.h
+2
-2
lite/operators/gru_op.cc
lite/operators/gru_op.cc
+5
-5
lite/operators/gru_unit_op.cc
lite/operators/gru_unit_op.cc
+5
-5
lite/operators/instance_norm_op.cc
lite/operators/instance_norm_op.cc
+4
-6
lite/operators/lookup_table_op.cc
lite/operators/lookup_table_op.cc
+4
-4
lite/operators/match_matrix_tensor_op.cc
lite/operators/match_matrix_tensor_op.cc
+2
-2
lite/operators/reduce_ops.cc
lite/operators/reduce_ops.cc
+6
-4
lite/operators/reshape_op.cc
lite/operators/reshape_op.cc
+5
-5
未找到文件。
lite/kernels/x86/fc_compute.h
浏览文件 @
05df5200
...
...
@@ -135,13 +135,13 @@ class FcCompute : public KernelLite<TARGET(kX86), PRECISION(kFloat)> {
bool
with_relu
=
(
param
.
activation_type
==
"relu"
)
?
true
:
false
;
bool
padding_weights
=
param
.
padding_weights
;
auto
&
w_dims
=
w
->
dims
();
const
auto
&
w_dims
=
w
->
dims
();
auto
w_dims0
=
padding_weights
?
w_dims
[
0
]
-
4
:
w_dims
[
0
];
auto
w_dims1
=
padding_weights
?
w_dims
[
1
]
-
4
:
w_dims
[
1
];
DDim
out_dims
;
out_dims
.
resize
(
static_cast
<
size_t
>
(
in_num_col_dims
+
1
));
auto
&
in_dims
=
input
->
dims
();
const
auto
&
in_dims
=
input
->
dims
();
for
(
int
i
=
0
;
i
<
in_num_col_dims
;
++
i
)
{
out_dims
[
i
]
=
in_dims
[
i
];
}
...
...
lite/operators/gru_op.cc
浏览文件 @
05df5200
...
...
@@ -28,8 +28,8 @@ bool GRUOpLite::CheckShape() const {
CHECK_OR_FALSE
(
param_
.
batch_hidden
)
CHECK_OR_FALSE
(
param_
.
hidden
)
auto
input_dims
=
param_
.
input
->
dims
();
auto
weight_dims
=
param_
.
weight
->
dims
();
const
auto
&
input_dims
=
param_
.
input
->
dims
();
const
auto
&
weight_dims
=
param_
.
weight
->
dims
();
int
input_size
=
input_dims
[
1
];
int
frame_size
=
weight_dims
[
0
];
CHECK_EQ_OR_FALSE
(
input_size
,
frame_size
*
3
)
...
...
@@ -52,14 +52,14 @@ bool GRUOpLite::CheckShape() const {
}
bool
GRUOpLite
::
InferShape
()
const
{
auto
&
input_dims
=
param_
.
input
->
dims
();
auto
&
weight_dims
=
param_
.
weight
->
dims
();
const
auto
&
input_dims
=
param_
.
input
->
dims
();
const
auto
&
weight_dims
=
param_
.
weight
->
dims
();
int
frame_size
=
weight_dims
[
0
];
auto
batch_size
=
input_dims
[
0
];
param_
.
batch_gate
->
Resize
(
input_dims
);
auto
out_dims
=
DDim
({
batch_size
,
frame_size
});
DDim
out_dims
({
batch_size
,
frame_size
});
param_
.
batch_reset_hidden_prev
->
Resize
(
out_dims
);
param_
.
batch_hidden
->
Resize
(
out_dims
);
param_
.
hidden
->
Resize
(
out_dims
);
...
...
lite/operators/gru_unit_op.cc
浏览文件 @
05df5200
...
...
@@ -28,9 +28,9 @@ bool GRUUnitOpLite::CheckShape() const {
CHECK_OR_FALSE
(
param_
.
hidden
);
CHECK_OR_FALSE
(
param_
.
weight
);
auto
input_dims
=
param_
.
input
->
dims
();
auto
hidden_prev_dims
=
param_
.
hidden_prev
->
dims
();
auto
weight_dims
=
param_
.
weight
->
dims
();
const
auto
&
input_dims
=
param_
.
input
->
dims
();
const
auto
&
hidden_prev_dims
=
param_
.
hidden_prev
->
dims
();
const
auto
&
weight_dims
=
param_
.
weight
->
dims
();
int
input_size
=
input_dims
[
1
];
int
frame_size
=
hidden_prev_dims
[
1
];
...
...
@@ -52,8 +52,8 @@ bool GRUUnitOpLite::CheckShape() const {
}
bool
GRUUnitOpLite
::
InferShape
()
const
{
auto
input_dims
=
param_
.
input
->
dims
();
auto
hidden_prev_dims
=
param_
.
hidden_prev
->
dims
();
const
auto
&
input_dims
=
param_
.
input
->
dims
();
const
auto
&
hidden_prev_dims
=
param_
.
hidden_prev
->
dims
();
int
batch_size
=
input_dims
[
0
];
int
frame_size
=
hidden_prev_dims
[
1
];
...
...
lite/operators/instance_norm_op.cc
浏览文件 @
05df5200
...
...
@@ -43,12 +43,10 @@ bool InstanceNormOp::CheckShape() const {
}
bool
InstanceNormOp
::
InferShape
()
const
{
auto
x_dims
=
param_
.
x
->
dims
();
int64_t
batch_size
=
x_dims
[
0
];
int64_t
channel_size
=
x_dims
[
1
];
param_
.
saved_mean
->
Resize
(
std
::
vector
<
int64_t
>
({
batch_size
*
channel_size
}));
param_
.
saved_variance
->
Resize
(
std
::
vector
<
int64_t
>
({
batch_size
*
channel_size
}));
const
auto
&
x_dims
=
param_
.
x
->
dims
();
DDim
saved_dims
({
x_dims
[
0
]
*
x_dims
[
1
]});
// batch_size * channel_size
param_
.
saved_mean
->
Resize
(
saved_dims
);
param_
.
saved_variance
->
Resize
(
saved_dims
);
param_
.
out
->
Resize
(
x_dims
);
return
true
;
}
...
...
lite/operators/lookup_table_op.cc
浏览文件 @
05df5200
...
...
@@ -25,8 +25,8 @@ bool LookupTableOpLite::CheckShape() const {
CHECK_OR_FALSE
(
param_
.
Ids
)
CHECK_OR_FALSE
(
param_
.
Out
)
auto
table_dims
=
param_
.
W
->
dims
();
auto
ids_dims
=
param_
.
Ids
->
dims
();
const
auto
&
table_dims
=
param_
.
W
->
dims
();
const
auto
&
ids_dims
=
param_
.
Ids
->
dims
();
int
ids_rank
=
ids_dims
.
size
();
...
...
@@ -37,8 +37,8 @@ bool LookupTableOpLite::CheckShape() const {
}
bool
LookupTableOpLite
::
InferShape
()
const
{
auto
&
table_dims
=
param_
.
W
->
dims
();
auto
&
ids_dims
=
param_
.
Ids
->
dims
();
const
auto
&
table_dims
=
param_
.
W
->
dims
();
const
auto
&
ids_dims
=
param_
.
Ids
->
dims
();
auto
out_dims
=
ids_dims
;
int
ids_rank
=
ids_dims
.
size
();
...
...
lite/operators/match_matrix_tensor_op.cc
浏览文件 @
05df5200
...
...
@@ -45,8 +45,8 @@ bool MatchMatrixTensorOpLite::CheckShape() const {
bool
MatchMatrixTensorOpLite
::
InferShape
()
const
{
const
Tensor
*
x
=
param_
.
x
;
const
Tensor
*
y
=
param_
.
y
;
DDim
x_dims
=
param_
.
x
->
dims
();
DDim
y_dims
=
param_
.
y
->
dims
();
const
auto
&
x_dims
=
param_
.
x
->
dims
();
const
auto
&
y_dims
=
param_
.
y
->
dims
();
int
dim_t
=
param_
.
dim_t
;
const
auto
&
x_lod
=
x
->
lod
();
...
...
lite/operators/reduce_ops.cc
浏览文件 @
05df5200
...
...
@@ -29,11 +29,13 @@ bool ReduceOp::CheckShape() const {
}
bool
ReduceOp
::
InferShape
()
const
{
auto
&
x_dims
=
param_
.
x
->
dims
();
const
auto
&
x_dims
=
param_
.
x
->
dims
();
auto
x_rank
=
x_dims
.
size
();
auto
&
dims
=
param_
.
dim
;
auto
dims
=
param_
.
dim
;
for
(
size_t
i
=
0
;
i
<
dims
.
size
();
++
i
)
{
if
(
dims
[
i
]
<
0
)
dims
[
i
]
=
x_rank
+
dims
[
i
];
if
(
dims
[
i
]
<
0
)
{
dims
[
i
]
=
x_rank
+
dims
[
i
];
}
CHECK_LT
(
dims
[
i
],
x_rank
)
<<
"The dim should be in the range [-rank(input), rank(input)."
;
}
...
...
@@ -58,7 +60,7 @@ bool ReduceOp::InferShape() const {
int
dim_index
=
0
;
int
out_index
=
0
;
for
(
size_t
i
=
0
;
i
<
x_rank
;
++
i
)
{
if
(
dims
[
dim_index
]
==
i
)
{
if
(
dims
[
dim_index
]
==
static_cast
<
DDim
::
value_type
>
(
i
)
)
{
dim_index
++
;
}
else
{
out_dims
[
out_index
++
]
=
x_dims
[
i
];
...
...
lite/operators/reshape_op.cc
浏览文件 @
05df5200
...
...
@@ -27,11 +27,11 @@ bool ReshapeOp::CheckShape() const {
}
bool
ReshapeOp
::
InferShape
()
const
{
auto
&
shape_tensor_vct
=
param_
.
shape_tensor_vct
;
const
auto
&
shape_tensor_vct
=
param_
.
shape_tensor_vct
;
auto
*
shape_tensor
=
param_
.
shape_tensor
;
auto
&
shape_vct
=
param_
.
shape_vct
;
std
::
vector
<
int
>
final_shape
;
const
auto
&
shape_vct
=
param_
.
shape_vct
;
std
::
vector
<
int
>
final_shape
;
if
(
shape_tensor_vct
.
size
()
>
0
)
{
final_shape
.
resize
(
shape_tensor_vct
.
size
());
for
(
int
i
=
0
;
i
<
shape_tensor_vct
.
size
();
i
++
)
{
...
...
@@ -47,7 +47,7 @@ bool ReshapeOp::InferShape() const {
LOG
(
FATAL
)
<<
"input shape error"
;
}
auto
&
x_dims
=
param_
.
x
->
dims
();
const
auto
&
x_dims
=
param_
.
x
->
dims
();
auto
output_dims
=
ValidateShape
(
final_shape
,
x_dims
);
param_
.
output
->
Resize
(
output_dims
);
auto
out_lod
=
param_
.
output
->
mutable_lod
();
...
...
@@ -99,7 +99,7 @@ bool Reshape2Op::CheckShape() const {
bool
Reshape2Op
::
InferShape
()
const
{
ReshapeOp
::
InferShape
();
auto
&
x_dims
=
param_
.
x
->
dims
();
const
auto
&
x_dims
=
param_
.
x
->
dims
();
DDim
xshape_dims
;
xshape_dims
.
resize
(
x_dims
.
size
()
+
1
);
xshape_dims
[
0
]
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录