Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
0458f704
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
332
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看板
未验证
提交
0458f704
编写于
3月 05, 2019
作者:
R
Ray Liu
提交者:
GitHub
3月 05, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1462 from codeWorm2015/develop
fix
#1461
put tensor when kernel init in scope
上级
abab2bf9
93a1705a
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
450 addition
and
353 deletion
+450
-353
src/framework/operator.h
src/framework/operator.h
+1
-1
src/operators/fill_constant_op.h
src/operators/fill_constant_op.h
+1
-1
src/operators/kernel/arm/conv_add_bn_relu_kernel.cpp
src/operators/kernel/arm/conv_add_bn_relu_kernel.cpp
+5
-2
src/operators/kernel/arm/conv_bn_relu_kernel.cpp
src/operators/kernel/arm/conv_bn_relu_kernel.cpp
+2
-2
src/operators/kernel/detection_kernel.h
src/operators/kernel/detection_kernel.h
+29
-22
src/operators/kernel/while_kernel.h
src/operators/kernel/while_kernel.h
+6
-3
src/operators/op_param.h
src/operators/op_param.h
+406
-322
未找到文件。
src/framework/operator.h
浏览文件 @
0458f704
...
...
@@ -103,7 +103,7 @@ class OperatorWithKernel : public OperatorBase<Dtype> {
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
std
::
shared_ptr
<
Scope
>
scope
)
:
OperatorBase
<
Dtype
>
(
type
,
inputs
,
outputs
,
attrs
,
scope
),
param_
(
inputs
,
outputs
,
attrs
,
*
scope
)
{
param_
(
inputs
,
outputs
,
attrs
,
scope
.
get
()
)
{
#ifdef PADDLE_MOBILE_CL
kernel_
.
InitCLHelper
(
scope
->
GetCLScpoe
());
#endif
...
...
src/operators/fill_constant_op.h
浏览文件 @
0458f704
...
...
@@ -35,7 +35,7 @@ class FillConstantOp : public framework::OperatorBase<DeviceType> {
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorBase
<
DeviceType
>
(
type
,
inputs
,
outputs
,
attrs
,
scope
),
param_
(
inputs
,
outputs
,
attrs
,
*
scope
)
{}
param_
(
inputs
,
outputs
,
attrs
,
scope
.
get
()
)
{}
void
RunImpl
()
{
auto
data_type
=
static_cast
<
_PaddleMobile__Framework__Proto__VarType__Type
>
(
...
...
src/operators/kernel/arm/conv_add_bn_relu_kernel.cpp
浏览文件 @
0458f704
...
...
@@ -41,8 +41,11 @@ bool ConvAddBNReluKernel<CPU, float>::Init(
inv_std_ptr
[
i
]
=
1
/
static_cast
<
float
>
(
pow
((
variance_ptr
[
i
]
+
epsilon
),
0.5
));
}
Tensor
*
new_scale
=
new
Tensor
();
Tensor
*
new_bias
=
new
Tensor
();
// Tensor *new_scale = new Tensor();
// Tensor *new_bias = new Tensor();
Tensor
*
new_scale
=
param
->
CreateNewScale
<
Tensor
>
();
Tensor
*
new_bias
=
param
->
CreateNewBiase
<
Tensor
>
();
auto
new_scale_ptr
=
new_scale
->
mutable_data
<
float
>
({
C
});
auto
new_bias_ptr
=
new_bias
->
mutable_data
<
float
>
({
C
});
for
(
int
i
=
0
;
i
<
C
;
i
++
)
{
...
...
src/operators/kernel/arm/conv_bn_relu_kernel.cpp
浏览文件 @
0458f704
...
...
@@ -42,8 +42,8 @@ bool ConvBNReluKernel<CPU, float>::Init(FusionConvBNReluParam<CPU> *param) {
inv_std_ptr
[
i
]
=
1
/
static_cast
<
float
>
(
pow
((
variance_ptr
[
i
]
+
epsilon
),
0.5
));
}
Tensor
*
new_scale
=
new
Tensor
();
Tensor
*
new_bias
=
new
Tensor
();
Tensor
*
new_scale
=
param
->
CreateNewScale
<
Tensor
>
();
Tensor
*
new_bias
=
param
->
CreateNewBiase
<
Tensor
>
();
auto
new_scale_ptr
=
new_scale
->
mutable_data
<
float
>
({
C
});
auto
new_bias_ptr
=
new_bias
->
mutable_data
<
float
>
({
C
});
for
(
int
i
=
0
;
i
<
C
;
i
++
)
{
...
...
src/operators/kernel/detection_kernel.h
浏览文件 @
0458f704
...
...
@@ -27,12 +27,14 @@ class AnchorGeneratorParam : public OpParam {
public:
AnchorGeneratorParam
(
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
Scope
&
scope
)
{
input_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"Input"
,
inputs
,
scope
);
const
AttributeMap
&
attrs
,
Scope
*
scope
)
:
OpParam
(
inputs
,
outputs
,
attrs
,
scope
)
{
input_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"Input"
,
inputs
,
*
scope
);
output_anchors_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"Anchors"
,
outputs
,
scope
);
output_variances_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"Variances"
,
outputs
,
scope
);
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"Anchors"
,
outputs
,
*
scope
);
output_variances_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"Variances"
,
outputs
,
*
scope
);
anchor_sizes_
=
OpParam
::
GetAttr
<
std
::
vector
<
float
>>
(
"anchor_sizes"
,
attrs
);
aspect_ratios_
=
...
...
@@ -64,22 +66,23 @@ template <typename Dtype>
class
ProposalParam
:
public
OpParam
{
public:
ProposalParam
(
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
Scope
&
scope
)
{
const
AttributeMap
&
attrs
,
Scope
*
scope
)
:
OpParam
(
inputs
,
outputs
,
attrs
,
scope
)
{
scores_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"Scores"
,
inputs
,
scope
);
bbox_deltas_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"BboxDeltas"
,
inputs
,
scope
);
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"Scores"
,
inputs
,
*
scope
);
bbox_deltas_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"BboxDeltas"
,
inputs
,
*
scope
);
im_info_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"ImInfo"
,
inputs
,
scope
);
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"ImInfo"
,
inputs
,
*
scope
);
anchors_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"Anchors"
,
inputs
,
scope
);
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"Anchors"
,
inputs
,
*
scope
);
variances_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"Variances"
,
inputs
,
scope
);
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"Variances"
,
inputs
,
*
scope
);
rpn_rois_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"RpnRois"
,
outputs
,
scope
);
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"RpnRois"
,
outputs
,
*
scope
);
rpn_probs_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"RpnRoiProbs"
,
outputs
,
scope
);
outputs
,
*
scope
);
pre_nms_topn_
=
OpParam
::
GetAttr
<
int
>
(
"pre_nms_topN"
,
attrs
);
post_nms_topn_
=
OpParam
::
GetAttr
<
int
>
(
"post_nms_topN"
,
attrs
);
...
...
@@ -117,11 +120,13 @@ template <typename Dtype>
class
PSRoiPoolParam
:
public
OpParam
{
public:
PSRoiPoolParam
(
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
Scope
&
scope
)
{
input_x_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"X"
,
inputs
,
scope
);
const
AttributeMap
&
attrs
,
Scope
*
scope
)
:
OpParam
(
inputs
,
outputs
,
attrs
,
scope
)
{
input_x_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"X"
,
inputs
,
*
scope
);
input_rois_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"ROIs"
,
inputs
,
scope
);
output_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"Out"
,
outputs
,
scope
);
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"ROIs"
,
inputs
,
*
scope
);
output_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"Out"
,
outputs
,
*
scope
);
output_channels_
=
OpParam
::
GetAttr
<
int
>
(
"output_channels"
,
attrs
);
pooled_height_
=
OpParam
::
GetAttr
<
int
>
(
"pooled_height"
,
attrs
);
...
...
@@ -152,11 +157,13 @@ class RoiPerspectiveParam : public OpParam {
public:
RoiPerspectiveParam
(
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
Scope
&
scope
)
{
input_x_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"X"
,
inputs
,
scope
);
Scope
*
scope
)
:
OpParam
(
inputs
,
outputs
,
attrs
,
scope
)
{
input_x_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"X"
,
inputs
,
*
scope
);
input_rois_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"ROIs"
,
inputs
,
scope
);
output_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"Out"
,
outputs
,
scope
);
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"ROIs"
,
inputs
,
*
scope
);
output_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"Out"
,
outputs
,
*
scope
);
spatial_scale_
=
OpParam
::
GetAttr
<
float
>
(
"spatial_scale"
,
attrs
);
transformed_height_
=
OpParam
::
GetAttr
<
int
>
(
"transformed_height"
,
attrs
);
...
...
src/operators/kernel/while_kernel.h
浏览文件 @
0458f704
...
...
@@ -25,10 +25,13 @@ template <typename Dtype>
class
WhileParam
:
public
OpParam
{
public:
WhileParam
(
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
Scope
&
scope
)
:
inputs_
(
inputs
),
outputs_
(
outputs
),
scope_
(
scope
)
{
const
AttributeMap
&
attrs
,
Scope
*
scope
)
:
inputs_
(
inputs
),
outputs_
(
outputs
),
scope_
(
*
scope
),
OpParam
(
inputs
,
outputs
,
attrs
,
scope
)
{
cond_
=
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"Condition"
,
inputs
,
scope
);
OpParam
::
GetVarValue
<
framework
::
LoDTensor
>
(
"Condition"
,
inputs
,
*
scope
);
sub_block_
=
OpParam
::
GetAttr
<
int
>
(
"sub_block"
,
attrs
);
}
...
...
src/operators/op_param.h
浏览文件 @
0458f704
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录