Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
276ec6f9
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
338
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看板
提交
276ec6f9
编写于
2月 15, 2019
作者:
H
hjchen2
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement while op, fix feed/fetch and fix code style
上级
9d499955
变更
128
展开全部
显示空白变更内容
内联
并排
Showing
128 changed file
with
334 addition
and
285 deletion
+334
-285
src/common/type_define.h
src/common/type_define.h
+1
-2
src/framework/executor.cpp
src/framework/executor.cpp
+89
-30
src/framework/executor.h
src/framework/executor.h
+3
-0
src/framework/lod_tensor.h
src/framework/lod_tensor.h
+2
-0
src/framework/op_registry.h
src/framework/op_registry.h
+2
-3
src/framework/operator.cpp
src/framework/operator.cpp
+1
-1
src/framework/operator.h
src/framework/operator.h
+18
-19
src/framework/scope.h
src/framework/scope.h
+1
-9
src/operators/batchnorm_op.h
src/operators/batchnorm_op.h
+1
-2
src/operators/bilinear_interp_op.h
src/operators/bilinear_interp_op.h
+1
-2
src/operators/box_coder_op.h
src/operators/box_coder_op.h
+1
-2
src/operators/cast_op.h
src/operators/cast_op.h
+1
-1
src/operators/concat_op.h
src/operators/concat_op.h
+1
-1
src/operators/conv_op.h
src/operators/conv_op.h
+1
-1
src/operators/conv_transpose_op.h
src/operators/conv_transpose_op.h
+1
-2
src/operators/crf_op.h
src/operators/crf_op.h
+1
-1
src/operators/depthwise_conv_op.h
src/operators/depthwise_conv_op.h
+1
-2
src/operators/dequantize_op.h
src/operators/dequantize_op.h
+1
-2
src/operators/dropout_op.h
src/operators/dropout_op.h
+1
-1
src/operators/elementwise_add_op.h
src/operators/elementwise_add_op.h
+1
-1
src/operators/elementwise_mul_op.h
src/operators/elementwise_mul_op.h
+1
-1
src/operators/elementwise_sub_op.h
src/operators/elementwise_sub_op.h
+1
-1
src/operators/feed_op.h
src/operators/feed_op.h
+1
-1
src/operators/fetch_op.cpp
src/operators/fetch_op.cpp
+2
-1
src/operators/fetch_op.h
src/operators/fetch_op.h
+1
-1
src/operators/fill_constant_op.h
src/operators/fill_constant_op.h
+1
-2
src/operators/flatten_op.h
src/operators/flatten_op.h
+1
-2
src/operators/fusion_conv_add_add_prelu_op.h
src/operators/fusion_conv_add_add_prelu_op.h
+1
-1
src/operators/fusion_conv_add_bn_op.h
src/operators/fusion_conv_add_bn_op.h
+2
-2
src/operators/fusion_conv_add_bn_relu_op.h
src/operators/fusion_conv_add_bn_relu_op.h
+1
-1
src/operators/fusion_conv_add_op.h
src/operators/fusion_conv_add_op.h
+1
-2
src/operators/fusion_conv_add_prelu_op.h
src/operators/fusion_conv_add_prelu_op.h
+1
-1
src/operators/fusion_conv_add_relu_op.h
src/operators/fusion_conv_add_relu_op.h
+1
-1
src/operators/fusion_conv_bn_add_relu_op.h
src/operators/fusion_conv_bn_add_relu_op.h
+1
-1
src/operators/fusion_conv_bn_op.h
src/operators/fusion_conv_bn_op.h
+1
-2
src/operators/fusion_conv_bn_relu_op.h
src/operators/fusion_conv_bn_relu_op.h
+1
-1
src/operators/fusion_deconv_add_op.h
src/operators/fusion_deconv_add_op.h
+1
-1
src/operators/fusion_deconv_add_relu_op.h
src/operators/fusion_deconv_add_relu_op.h
+1
-1
src/operators/fusion_deconv_relu_op.h
src/operators/fusion_deconv_relu_op.h
+1
-1
src/operators/fusion_dequant_add_bn_op.h
src/operators/fusion_dequant_add_bn_op.h
+1
-1
src/operators/fusion_dequant_add_bn_relu_op.h
src/operators/fusion_dequant_add_bn_relu_op.h
+1
-1
src/operators/fusion_dequant_add_bn_relu_quant_op.h
src/operators/fusion_dequant_add_bn_relu_quant_op.h
+2
-2
src/operators/fusion_dequant_bn_op.h
src/operators/fusion_dequant_bn_op.h
+2
-2
src/operators/fusion_dequant_bn_relu_op.h
src/operators/fusion_dequant_bn_relu_op.h
+1
-1
src/operators/fusion_dwconv_bn_relu_op.h
src/operators/fusion_dwconv_bn_relu_op.h
+1
-1
src/operators/fusion_elementwise_add_relu_op.h
src/operators/fusion_elementwise_add_relu_op.h
+2
-1
src/operators/fusion_fc_op.h
src/operators/fusion_fc_op.h
+1
-2
src/operators/fusion_fc_relu_op.h
src/operators/fusion_fc_relu_op.h
+1
-2
src/operators/gru_op.h
src/operators/gru_op.h
+1
-1
src/operators/gru_unit_op.h
src/operators/gru_unit_op.h
+3
-2
src/operators/im2sequence_op.h
src/operators/im2sequence_op.h
+1
-2
src/operators/increment_op.h
src/operators/increment_op.h
+1
-2
src/operators/is_empty_op.h
src/operators/is_empty_op.h
+1
-2
src/operators/kernel/arm/beam_search_decode_kernel.cpp
src/operators/kernel/arm/beam_search_decode_kernel.cpp
+7
-0
src/operators/kernel/arm/fetch_kernel.cpp
src/operators/kernel/arm/fetch_kernel.cpp
+8
-1
src/operators/kernel/arm/sequence_expand_kernel.cpp
src/operators/kernel/arm/sequence_expand_kernel.cpp
+1
-1
src/operators/kernel/arm/sequence_softmax_kernel.cpp
src/operators/kernel/arm/sequence_softmax_kernel.cpp
+7
-4
src/operators/kernel/arm/tensor_array_read_write_kernel.cpp
src/operators/kernel/arm/tensor_array_read_write_kernel.cpp
+5
-0
src/operators/kernel/arm/while_kernel.cpp
src/operators/kernel/arm/while_kernel.cpp
+3
-5
src/operators/kernel/central-arm-func/increment_arm_func.h
src/operators/kernel/central-arm-func/increment_arm_func.h
+4
-4
src/operators/lookup_op.h
src/operators/lookup_op.h
+1
-1
src/operators/lrn_op.h
src/operators/lrn_op.h
+1
-1
src/operators/math/depthwise_conv3x3.cpp
src/operators/math/depthwise_conv3x3.cpp
+12
-16
src/operators/mul_op.h
src/operators/mul_op.h
+1
-1
src/operators/multiclass_nms_op.h
src/operators/multiclass_nms_op.h
+1
-2
src/operators/norm_op.h
src/operators/norm_op.h
+1
-1
src/operators/op_param.h
src/operators/op_param.h
+12
-13
src/operators/polygon_box_transform_op.h
src/operators/polygon_box_transform_op.h
+1
-1
src/operators/pool_op.h
src/operators/pool_op.h
+8
-10
src/operators/prelu_op.h
src/operators/prelu_op.h
+1
-1
src/operators/prior_box_op.h
src/operators/prior_box_op.h
+1
-2
src/operators/quantize_op.h
src/operators/quantize_op.h
+1
-2
src/operators/reshape2_op.h
src/operators/reshape2_op.h
+1
-2
src/operators/reshape_op.h
src/operators/reshape_op.h
+1
-2
src/operators/resize_op.h
src/operators/resize_op.h
+1
-1
src/operators/scale_op.h
src/operators/scale_op.h
+1
-1
src/operators/sequence_ops/sequence_expand_op.h
src/operators/sequence_ops/sequence_expand_op.h
+1
-1
src/operators/sequence_ops/sequence_pool_op.h
src/operators/sequence_ops/sequence_pool_op.h
+1
-2
src/operators/sequence_ops/sequence_softmax_op.h
src/operators/sequence_ops/sequence_softmax_op.h
+1
-1
src/operators/shape_op.h
src/operators/shape_op.h
+1
-1
src/operators/slice_op.h
src/operators/slice_op.h
+1
-1
src/operators/softmax_op.h
src/operators/softmax_op.h
+1
-2
src/operators/split_op.h
src/operators/split_op.h
+1
-1
src/operators/sum_op.h
src/operators/sum_op.h
+1
-1
src/operators/top_k_op.cpp
src/operators/top_k_op.cpp
+4
-0
src/operators/top_k_op.h
src/operators/top_k_op.h
+1
-1
src/operators/transpose2_op.h
src/operators/transpose2_op.h
+1
-2
src/operators/transpose_op.h
src/operators/transpose_op.h
+1
-2
test/executor_for_test.h
test/executor_for_test.h
+3
-3
test/operators/test_batchnorm_op.cpp
test/operators/test_batchnorm_op.cpp
+2
-2
test/operators/test_box_coder_op.cpp
test/operators/test_box_coder_op.cpp
+2
-2
test/operators/test_cast_op.cpp
test/operators/test_cast_op.cpp
+2
-2
test/operators/test_concat_op.cpp
test/operators/test_concat_op.cpp
+4
-4
test/operators/test_conv_bn_relu_op.cpp
test/operators/test_conv_bn_relu_op.cpp
+1
-1
test/operators/test_conv_op.cpp
test/operators/test_conv_op.cpp
+1
-1
test/operators/test_dequantize_op.cpp
test/operators/test_dequantize_op.cpp
+2
-2
test/operators/test_dwconv_bn_relu_op.cpp
test/operators/test_dwconv_bn_relu_op.cpp
+1
-1
test/operators/test_elementwise_sub_op.cpp
test/operators/test_elementwise_sub_op.cpp
+2
-2
test/operators/test_fill_constant_op.cpp
test/operators/test_fill_constant_op.cpp
+2
-2
test/operators/test_fusion_fc_op.cpp
test/operators/test_fusion_fc_op.cpp
+1
-1
test/operators/test_gru_op.cpp
test/operators/test_gru_op.cpp
+2
-2
test/operators/test_im2sequence_op.cpp
test/operators/test_im2sequence_op.cpp
+2
-2
test/operators/test_increment_op.cpp
test/operators/test_increment_op.cpp
+2
-2
test/operators/test_is_empty_op.cpp
test/operators/test_is_empty_op.cpp
+1
-1
test/operators/test_less_than_op.cpp
test/operators/test_less_than_op.cpp
+1
-1
test/operators/test_log_op.cpp
test/operators/test_log_op.cpp
+2
-2
test/operators/test_logical_and_op.cpp
test/operators/test_logical_and_op.cpp
+2
-2
test/operators/test_logical_not_op.cpp
test/operators/test_logical_not_op.cpp
+2
-2
test/operators/test_logical_or_op.cpp
test/operators/test_logical_or_op.cpp
+2
-2
test/operators/test_logical_xor_op.cpp
test/operators/test_logical_xor_op.cpp
+2
-2
test/operators/test_mul_op.cpp
test/operators/test_mul_op.cpp
+2
-2
test/operators/test_multiclass_nms_op.cpp
test/operators/test_multiclass_nms_op.cpp
+2
-2
test/operators/test_polygon_box_transform_op.cpp
test/operators/test_polygon_box_transform_op.cpp
+2
-2
test/operators/test_pool_op.cpp
test/operators/test_pool_op.cpp
+1
-1
test/operators/test_prior_box_op.cpp
test/operators/test_prior_box_op.cpp
+2
-2
test/operators/test_quantize_op.cpp
test/operators/test_quantize_op.cpp
+1
-1
test/operators/test_relu6_op.cpp
test/operators/test_relu6_op.cpp
+1
-1
test/operators/test_relu_op.cpp
test/operators/test_relu_op.cpp
+2
-2
test/operators/test_reshape2_op.cpp
test/operators/test_reshape2_op.cpp
+2
-2
test/operators/test_sequence_expand_op.cpp
test/operators/test_sequence_expand_op.cpp
+1
-1
test/operators/test_sequence_pool_op.cpp
test/operators/test_sequence_pool_op.cpp
+2
-2
test/operators/test_sequence_softmax_op.cpp
test/operators/test_sequence_softmax_op.cpp
+1
-1
test/operators/test_sigmoid_op.cpp
test/operators/test_sigmoid_op.cpp
+1
-1
test/operators/test_softmax_op.cpp
test/operators/test_softmax_op.cpp
+1
-1
test/operators/test_sum_op.cpp
test/operators/test_sum_op.cpp
+2
-2
test/operators/test_tanh_op.cpp
test/operators/test_tanh_op.cpp
+2
-2
test/operators/test_topk_op.cpp
test/operators/test_topk_op.cpp
+2
-2
test/operators/test_transpose2_op.cpp
test/operators/test_transpose2_op.cpp
+2
-2
未找到文件。
src/common/type_define.h
浏览文件 @
276ec6f9
...
@@ -37,8 +37,7 @@ template <typename Dtype>
...
@@ -37,8 +37,7 @@ template <typename Dtype>
using
OpCreator
=
std
::
function
<
framework
::
OperatorBase
<
Dtype
>
*
(
using
OpCreator
=
std
::
function
<
framework
::
OperatorBase
<
Dtype
>
*
(
const
std
::
string
&
/*type*/
,
const
VariableNameMap
&
/*inputs*/
,
const
std
::
string
&
/*type*/
,
const
VariableNameMap
&
/*inputs*/
,
const
VariableNameMap
&
/*outputs*/
,
const
VariableNameMap
&
/*outputs*/
,
const
framework
::
AttributeMap
&
/*attrs*/
,
const
framework
::
AttributeMap
&
/*attrs*/
,
framework
::
Scope
*
/*scope*/
)
>
;
std
::
shared_ptr
<
framework
::
Scope
>
/*scope*/
)
>
;
using
InferVarTypeFN
=
std
::
function
<
void
(
const
framework
::
OpDesc
&
/*op_desc*/
,
using
InferVarTypeFN
=
std
::
function
<
void
(
const
framework
::
OpDesc
&
/*op_desc*/
,
framework
::
BlockDesc
*
/*block*/
)
>
;
framework
::
BlockDesc
*
/*block*/
)
>
;
...
...
src/framework/executor.cpp
浏览文件 @
276ec6f9
...
@@ -66,7 +66,7 @@ Executor<Device, T>::Executor(const Program<Device> &program,
...
@@ -66,7 +66,7 @@ Executor<Device, T>::Executor(const Program<Device> &program,
auto
op_handler
=
OpRegistry
<
Device
>::
CreateOp
(
auto
op_handler
=
OpRegistry
<
Device
>::
CreateOp
(
op_desc
->
Type
(),
op_desc
->
GetInputs
(),
op_desc
->
GetOutputs
(),
op_desc
->
Type
(),
op_desc
->
GetInputs
(),
op_desc
->
GetOutputs
(),
op_desc
->
GetAttrMap
(),
program_
.
scope
);
op_desc
->
GetAttrMap
(),
program_
.
scope
.
get
()
);
// infer shape to reshape inputs and outputs before predict,
// infer shape to reshape inputs and outputs before predict,
// but for lod mode, it still need to infer shape in runtime
// but for lod mode, it still need to infer shape in runtime
if
(
!
lod_mode
)
{
if
(
!
lod_mode
)
{
...
@@ -80,6 +80,8 @@ Executor<Device, T>::Executor(const Program<Device> &program,
...
@@ -80,6 +80,8 @@ Executor<Device, T>::Executor(const Program<Device> &program,
}
else
{
}
else
{
InitMemory
();
InitMemory
();
}
}
// resize feed and fetch list
InitFeedFetchList
();
int
count
=
0
;
int
count
=
0
;
for
(
auto
&
op_handler
:
ops_of_block0_
)
{
for
(
auto
&
op_handler
:
ops_of_block0_
)
{
...
@@ -88,6 +90,33 @@ Executor<Device, T>::Executor(const Program<Device> &program,
...
@@ -88,6 +90,33 @@ Executor<Device, T>::Executor(const Program<Device> &program,
}
}
}
}
template
<
typename
Device
,
typename
T
>
void
Executor
<
Device
,
T
>::
InitFeedFetchList
()
{
std
::
unordered_map
<
std
::
string
,
int
>
feed_indices
,
fetch_indices
;
for
(
const
auto
&
block
:
program_desc_
->
Blocks
())
{
for
(
const
auto
&
op_desc
:
block
->
Ops
())
{
if
(
op_desc
->
Type
()
==
"feed"
)
{
std
::
string
name
=
op_desc
->
Output
(
"Out"
)[
0
];
feed_indices
[
name
]
=
op_desc
->
GetAttr
(
"col"
).
Get
<
int
>
();
}
else
if
(
op_desc
->
Type
()
==
"fetch"
)
{
std
::
string
name
=
op_desc
->
Input
(
"X"
)[
0
];
fetch_indices
[
name
]
=
op_desc
->
GetAttr
(
"col"
).
Get
<
int
>
();
}
}
}
feed_indices_
.
swap
(
feed_indices
);
fetch_indices_
.
swap
(
fetch_indices
);
auto
*
feed_var
=
program_
.
scope
->
Var
(
"feed"
);
auto
*
feed_list
=
feed_var
->
template
GetMutable
<
framework
::
LoDTensorArray
>();
feed_list
->
resize
(
feed_indices_
.
size
());
auto
*
fetch_var
=
program_
.
scope
->
Var
(
"fetch"
);
auto
*
fetch_list
=
fetch_var
->
template
GetMutable
<
framework
::
LoDTensorArray
>();
fetch_list
->
resize
(
fetch_indices_
.
size
());
}
template
<
typename
T
>
template
<
typename
T
>
static
void
LoadMemInternal
(
void
**
data
,
LoDTensor
*
tensor
,
static
void
LoadMemInternal
(
void
**
data
,
LoDTensor
*
tensor
,
bool
quant_uint8
=
false
)
{
bool
quant_uint8
=
false
)
{
...
@@ -182,6 +211,7 @@ void Executor<Device, T>::InitMemory() {
...
@@ -182,6 +211,7 @@ void Executor<Device, T>::InitMemory() {
LoadMemory
(
reinterpret_cast
<
void
**>
(
&
data
),
var_desc
,
tensor
);
LoadMemory
(
reinterpret_cast
<
void
**>
(
&
data
),
var_desc
,
tensor
);
delete
[]
origin_data
;
delete
[]
origin_data
;
}
else
{
}
else
{
DLOG
<<
"init no persistable var: "
<<
var_desc
->
Name
();
varInputMemory
(
var_desc
,
var
);
varInputMemory
(
var_desc
,
var
);
}
}
}
}
...
@@ -319,11 +349,19 @@ PMStatus Executor<Device, T>::Predict(
...
@@ -319,11 +349,19 @@ PMStatus Executor<Device, T>::Predict(
template
<
typename
Device
,
typename
T
>
template
<
typename
Device
,
typename
T
>
std
::
vector
<
T
>
Executor
<
Device
,
T
>::
Predict
(
const
std
::
vector
<
T
>
&
input
,
std
::
vector
<
T
>
Executor
<
Device
,
T
>::
Predict
(
const
std
::
vector
<
T
>
&
input
,
const
std
::
vector
<
int64_t
>
&
dims
)
{
const
std
::
vector
<
int64_t
>
&
dims
)
{
PADDLE_MOBILE_ENFORCE
(
feed_indices_
.
size
()
!=
0
,
"We don't know which tensor should be assign, since no "
"feed op found in this model"
);
PADDLE_MOBILE_ENFORCE
(
fetch_indices_
.
size
()
!=
0
,
"We don't know which tensor should be fetch out, since "
"no fetch op found in this model"
);
std
::
string
input_name
=
feed_indices_
.
begin
()
->
first
;
Tensor
feed_tensor
(
input
,
make_ddim
(
dims
));
Tensor
feed_tensor
(
input
,
make_ddim
(
dims
));
SetInput
(
feed_tensor
,
"feed"
);
SetInput
(
feed_tensor
,
input_name
);
std
::
vector
<
T
>
output
;
std
::
vector
<
T
>
output
;
if
(
this
->
Predict
()
==
PMSuccess
)
{
if
(
this
->
Predict
()
==
PMSuccess
)
{
const
auto
output_tensor
=
GetOutput
(
"fetch"
);
std
::
string
output_name
=
fetch_indices_
.
begin
()
->
first
;
const
auto
output_tensor
=
GetOutput
(
output_name
);
output
.
resize
(
output_tensor
->
numel
());
output
.
resize
(
output_tensor
->
numel
());
memcpy
(
output
.
data
(),
output_tensor
->
template
data
<
T
>(),
memcpy
(
output
.
data
(),
output_tensor
->
template
data
<
T
>(),
output
.
size
()
*
sizeof
(
T
));
output
.
size
()
*
sizeof
(
T
));
...
@@ -334,12 +372,18 @@ std::vector<T> Executor<Device, T>::Predict(const std::vector<T> &input,
...
@@ -334,12 +372,18 @@ std::vector<T> Executor<Device, T>::Predict(const std::vector<T> &input,
template
<
typename
Device
,
typename
T
>
template
<
typename
Device
,
typename
T
>
void
Executor
<
Device
,
T
>::
SetInput
(
const
Tensor
&
input
,
void
Executor
<
Device
,
T
>::
SetInput
(
const
Tensor
&
input
,
const
std
::
string
&
var_name
)
{
const
std
::
string
&
var_name
)
{
framework
::
LoDTensor
*
target
=
nullptr
;
if
(
feed_indices_
.
find
(
var_name
)
!=
feed_indices_
.
end
())
{
int
index
=
feed_indices_
.
find
(
var_name
)
->
second
;
auto
*
feed_var
=
program_
.
scope
->
Var
(
"feed"
);
target
=
&
(
feed_var
->
template
GetMutable
<
framework
::
LoDTensorArray
>()
->
at
(
index
));
}
else
{
auto
*
target_var
=
program_
.
scope
->
FindVar
(
var_name
);
auto
*
target_var
=
program_
.
scope
->
FindVar
(
var_name
);
PADDLE_MOBILE_ENFORCE
(
target_var
!=
nullptr
,
"Variable %s is not exist"
,
PADDLE_MOBILE_ENFORCE
(
target_var
!=
nullptr
,
"Variable %s is not exist"
,
var_name
.
c_str
());
var_name
.
c_str
());
target
=
target_var
->
template
GetMutable
<
LoDTensor
>();
auto
*
target_tensor
=
target_var
->
template
GetMutable
<
LoDTensor
>();
}
if
(
config_
.
load_when_predict
)
{
if
(
config_
.
load_when_predict
)
{
if
(
input_dim_last_
!=
input
.
dims
())
{
if
(
input_dim_last_
!=
input
.
dims
())
{
InitNoPersistableMemory
(
input
);
InitNoPersistableMemory
(
input
);
...
@@ -347,28 +391,53 @@ void Executor<Device, T>::SetInput(const Tensor &input,
...
@@ -347,28 +391,53 @@ void Executor<Device, T>::SetInput(const Tensor &input,
}
}
}
}
target
_tensor
->
Resize
(
input
.
dims
());
target
->
Resize
(
input
.
dims
());
target
_tensor
->
ShareDataWith
(
input
);
target
->
ShareDataWith
(
input
);
}
}
template
<
typename
Device
,
typename
T
>
template
<
typename
Device
,
typename
T
>
void
Executor
<
Device
,
T
>::
SetInput
(
const
LoDTensor
&
input
,
void
Executor
<
Device
,
T
>::
SetInput
(
const
LoDTensor
&
input
,
const
std
::
string
&
var_name
)
{
const
std
::
string
&
var_name
)
{
framework
::
LoDTensor
*
target
=
nullptr
;
if
(
feed_indices_
.
find
(
var_name
)
!=
feed_indices_
.
end
())
{
int
index
=
feed_indices_
.
find
(
var_name
)
->
second
;
auto
*
feed_var
=
program_
.
scope
->
Var
(
"feed"
);
target
=
&
(
feed_var
->
template
GetMutable
<
framework
::
LoDTensorArray
>()
->
at
(
index
));
}
else
{
auto
*
target_var
=
program_
.
scope
->
FindVar
(
var_name
);
auto
*
target_var
=
program_
.
scope
->
FindVar
(
var_name
);
PADDLE_MOBILE_ENFORCE
(
target_var
!=
nullptr
,
"Variable %s is not exist"
,
PADDLE_MOBILE_ENFORCE
(
target_var
!=
nullptr
,
"Variable %s is not exist"
,
var_name
.
c_str
());
var_name
.
c_str
());
auto
*
target_tensor
=
target_var
->
template
GetMutable
<
LoDTensor
>();
target
=
target_var
->
template
GetMutable
<
LoDTensor
>();
}
if
(
config_
.
load_when_predict
)
{
if
(
config_
.
load_when_predict
)
{
if
(
input_dim_last_
!=
input
.
dims
())
{
if
(
input_dim_last_
!=
input
.
dims
())
{
InitNoPersistableMemory
(
*
target_tensor
);
InitNoPersistableMemory
(
input
);
input_dim_last_
=
input
.
dims
();
input_dim_last_
=
input
.
dims
();
}
}
}
}
target_tensor
->
Resize
(
input
.
dims
());
target
->
Resize
(
input
.
dims
());
target_tensor
->
ShareDataWith
(
input
);
target
->
ShareDataWith
(
input
);
target_tensor
->
set_lod
(
input
.
lod
());
target
->
set_lod
(
input
.
lod
());
}
template
<
typename
Device
,
typename
T
>
std
::
shared_ptr
<
LoDTensor
>
Executor
<
Device
,
T
>::
GetOutput
(
const
std
::
string
&
var_name
)
{
framework
::
LoDTensor
*
target
=
nullptr
;
if
(
fetch_indices_
.
find
(
var_name
)
!=
fetch_indices_
.
end
())
{
int
index
=
fetch_indices_
.
find
(
var_name
)
->
second
;
auto
*
fetch_var
=
program_
.
scope
->
Var
(
"fetch"
);
target
=
&
(
fetch_var
->
template
GetMutable
<
framework
::
LoDTensorArray
>()
->
at
(
index
));
}
else
{
auto
*
target_var
=
program_
.
scope
->
FindVar
(
var_name
);
PADDLE_MOBILE_ENFORCE
(
target_var
!=
nullptr
,
"Variable %s is not exist"
,
var_name
.
c_str
());
target
=
target_var
->
template
GetMutable
<
LoDTensor
>();
}
return
std
::
make_shared
<
LoDTensor
>
(
*
target
);
}
}
template
<
typename
Device
,
typename
T
>
template
<
typename
Device
,
typename
T
>
...
@@ -432,16 +501,6 @@ PMStatus Executor<Device, T>::Predict() {
...
@@ -432,16 +501,6 @@ PMStatus Executor<Device, T>::Predict() {
return
PMSuccess
;
return
PMSuccess
;
}
}
template
<
typename
Device
,
typename
T
>
std
::
shared_ptr
<
LoDTensor
>
Executor
<
Device
,
T
>::
GetOutput
(
const
std
::
string
&
var_name
)
{
auto
*
target_var
=
program_
.
scope
->
FindVar
(
var_name
);
PADDLE_MOBILE_ENFORCE
(
target_var
!=
nullptr
,
"Variable %s is not exist"
,
var_name
.
c_str
());
auto
*
output_tensor
=
target_var
->
template
GetMutable
<
LoDTensor
>();
return
std
::
make_shared
<
LoDTensor
>
(
*
output_tensor
);
}
#ifdef PADDLE_MOBILE_FPGA
#ifdef PADDLE_MOBILE_FPGA
template
<
typename
Device
,
typename
T
>
template
<
typename
Device
,
typename
T
>
void
Executor
<
Device
,
T
>::
InjectVariable
(
const
Tensor
&
t
,
void
Executor
<
Device
,
T
>::
InjectVariable
(
const
Tensor
&
t
,
...
...
src/framework/executor.h
浏览文件 @
276ec6f9
...
@@ -63,6 +63,7 @@ class Executor {
...
@@ -63,6 +63,7 @@ class Executor {
bool
varInputMemory
(
const
std
::
shared_ptr
<
VarDesc
>
&
var_desc
,
bool
varInputMemory
(
const
std
::
shared_ptr
<
VarDesc
>
&
var_desc
,
Variable
*
var
)
const
;
Variable
*
var
)
const
;
void
InitFeedFetchList
();
void
InitMemory
();
void
InitMemory
();
void
InitCombineMemory
();
void
InitCombineMemory
();
void
InitNoPersistableMemory
(
const
Tensor
&
input_tensor
);
void
InitNoPersistableMemory
(
const
Tensor
&
input_tensor
);
...
@@ -79,6 +80,8 @@ class Executor {
...
@@ -79,6 +80,8 @@ class Executor {
Program
<
Device
>
program_
;
Program
<
Device
>
program_
;
std
::
shared_ptr
<
ProgramDesc
>
program_desc_
;
std
::
shared_ptr
<
ProgramDesc
>
program_desc_
;
std
::
vector
<
std
::
shared_ptr
<
OperatorBase
<
Device
>>>
ops_of_block0_
;
std
::
vector
<
std
::
shared_ptr
<
OperatorBase
<
Device
>>>
ops_of_block0_
;
std
::
unordered_map
<
std
::
string
,
int
>
feed_indices_
;
std
::
unordered_map
<
std
::
string
,
int
>
fetch_indices_
;
// for super resoltion
// for super resoltion
DDim
input_dim_last_
;
DDim
input_dim_last_
;
...
...
src/framework/lod_tensor.h
浏览文件 @
276ec6f9
...
@@ -221,6 +221,8 @@ inline Print &operator<<(Print &printer, const LoDTensor &tensor) {
...
@@ -221,6 +221,8 @@ inline Print &operator<<(Print &printer, const LoDTensor &tensor) {
printer
<<
static_cast
<
int
>
(
tensor
.
data
<
int8_t
>
()[
i
])
<<
" "
;
printer
<<
static_cast
<
int
>
(
tensor
.
data
<
int8_t
>
()[
i
])
<<
" "
;
}
else
if
(
tensor
.
type
()
==
typeid
(
int32_t
))
{
}
else
if
(
tensor
.
type
()
==
typeid
(
int32_t
))
{
printer
<<
tensor
.
data
<
int32_t
>
()[
i
]
<<
" "
;
printer
<<
tensor
.
data
<
int32_t
>
()[
i
]
<<
" "
;
}
else
if
(
tensor
.
type
()
==
typeid
(
bool
))
{
printer
<<
tensor
.
data
<
bool
>
()[
i
]
<<
" "
;
}
}
}
}
#endif // PADDLE_MOBILE_FPGA
#endif // PADDLE_MOBILE_FPGA
...
...
src/framework/op_registry.h
浏览文件 @
276ec6f9
...
@@ -58,8 +58,7 @@ struct OpInfoFiller {
...
@@ -58,8 +58,7 @@ struct OpInfoFiller {
void
operator
()(
const
std
::
string
&
op_type
,
OpInfo
<
Dtype
>*
info
)
const
{
void
operator
()(
const
std
::
string
&
op_type
,
OpInfo
<
Dtype
>*
info
)
const
{
info
->
creator_
=
[](
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
info
->
creator_
=
[](
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
{
std
::
shared_ptr
<
Scope
>
scope
)
{
return
new
T
(
type
,
inputs
,
outputs
,
attrs
,
scope
);
return
new
T
(
type
,
inputs
,
outputs
,
attrs
,
scope
);
};
};
}
}
...
@@ -91,7 +90,7 @@ class OpRegistry {
...
@@ -91,7 +90,7 @@ class OpRegistry {
static
std
::
shared_ptr
<
OperatorBase
<
Dtype
>>
CreateOp
(
static
std
::
shared_ptr
<
OperatorBase
<
Dtype
>>
CreateOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
attrs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
attrs
,
std
::
shared_ptr
<
paddle_mobile
::
framework
::
Scope
>
scope
)
{
paddle_mobile
::
framework
::
Scope
*
scope
)
{
auto
&
info
=
OpInfoMap
<
Dtype
>::
Instance
()
->
Get
(
type
);
auto
&
info
=
OpInfoMap
<
Dtype
>::
Instance
()
->
Get
(
type
);
auto
op
=
info
.
Creator
()(
type
,
inputs
,
outputs
,
attrs
,
scope
);
auto
op
=
info
.
Creator
()(
type
,
inputs
,
outputs
,
attrs
,
scope
);
return
std
::
shared_ptr
<
OperatorBase
<
Dtype
>>
(
op
);
return
std
::
shared_ptr
<
OperatorBase
<
Dtype
>>
(
op
);
...
...
src/framework/operator.cpp
浏览文件 @
276ec6f9
...
@@ -43,7 +43,7 @@ OperatorBase<Dtype>::OperatorBase(const std::string &type,
...
@@ -43,7 +43,7 @@ OperatorBase<Dtype>::OperatorBase(const std::string &type,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
AttributeMap
&
attrs
,
std
::
shared_ptr
<
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
type_
(
type
),
:
type_
(
type
),
inputs_
(
inputs
),
inputs_
(
inputs
),
outputs_
(
outputs
),
outputs_
(
outputs
),
...
...
src/framework/operator.h
浏览文件 @
276ec6f9
...
@@ -57,7 +57,7 @@ class OperatorBase {
...
@@ -57,7 +57,7 @@ class OperatorBase {
public:
public:
OperatorBase
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
OperatorBase
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
std
::
shared_ptr
<
Scope
>
scope
);
framework
::
Scope
*
scope
);
virtual
~
OperatorBase
()
{}
virtual
~
OperatorBase
()
{}
virtual
void
Init
()
=
0
;
virtual
void
Init
()
=
0
;
...
@@ -80,7 +80,7 @@ class OperatorBase {
...
@@ -80,7 +80,7 @@ class OperatorBase {
}
}
protected:
protected:
std
::
shared_ptr
<
Scope
>
scope_
;
framework
::
Scope
*
scope_
;
std
::
string
type_
;
std
::
string
type_
;
VariableNameMap
inputs_
;
VariableNameMap
inputs_
;
VariableNameMap
outputs_
;
VariableNameMap
outputs_
;
...
@@ -95,7 +95,7 @@ class OperatorWithKernel : public OperatorBase<Dtype> {
...
@@ -95,7 +95,7 @@ class OperatorWithKernel : public OperatorBase<Dtype> {
public:
public:
OperatorWithKernel
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
OperatorWithKernel
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
std
::
shared_ptr
<
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
OperatorBase
<
Dtype
>
(
type
,
inputs
,
outputs
,
attrs
,
scope
),
:
OperatorBase
<
Dtype
>
(
type
,
inputs
,
outputs
,
attrs
,
scope
),
param_
(
inputs
,
outputs
,
attrs
,
*
scope
)
{
param_
(
inputs
,
outputs
,
attrs
,
*
scope
)
{
#ifdef PADDLE_MOBILE_CL
#ifdef PADDLE_MOBILE_CL
...
@@ -182,8 +182,7 @@ class FusionOpMatcher {
...
@@ -182,8 +182,7 @@ class FusionOpMatcher {
public: \
public: \
OpName##Op(const std::string &type, const VariableNameMap &inputs, \
OpName##Op(const std::string &type, const VariableNameMap &inputs, \
const VariableNameMap &outputs, \
const VariableNameMap &outputs, \
const framework::AttributeMap &attrs, \
const framework::AttributeMap &attrs, framework::Scope *scope) \
std::shared_ptr<framework::Scope> scope) \
: framework::OperatorWithKernel<DeviceType, OpParam<DeviceType>, \
: framework::OperatorWithKernel<DeviceType, OpParam<DeviceType>, \
operators::OpKernel<DeviceType, T>>( \
operators::OpKernel<DeviceType, T>>( \
type, inputs, outputs, attrs, scope) {} \
type, inputs, outputs, attrs, scope) {} \
...
@@ -204,7 +203,7 @@ class FusionOpMatcher {
...
@@ -204,7 +203,7 @@ class FusionOpMatcher {
cls(const std::string &type, const ::paddle_mobile::VariableNameMap &inputs, \
cls(const std::string &type, const ::paddle_mobile::VariableNameMap &inputs, \
const ::paddle_mobile::VariableNameMap &outputs, \
const ::paddle_mobile::VariableNameMap &outputs, \
const ::paddle_mobile::framework::AttributeMap &attrs, \
const ::paddle_mobile::framework::AttributeMap &attrs, \
std::shared_ptr<::paddle_mobile::framework::Scope> scope)
\
::paddle_mobile::framework::Scope *scope)
\
: parent_cls<Dtype, T>(type, inputs, outputs, attrs, scope) {}
: parent_cls<Dtype, T>(type, inputs, outputs, attrs, scope) {}
}
// namespace framework
}
// namespace framework
...
...
src/framework/scope.h
浏览文件 @
276ec6f9
...
@@ -32,15 +32,7 @@ class Scope {
...
@@ -32,15 +32,7 @@ class Scope {
Scope
()
=
default
;
Scope
()
=
default
;
~
Scope
()
{
~
Scope
()
{
for
(
auto
&
var
:
vars_
)
{
DropKids
();
delete
var
.
second
;
}
vars_
.
clear
();
for
(
auto
kid
:
kids_
)
{
delete
kid
;
}
kids_
.
clear
();
#ifdef PADDLE_MOBILE_CL
#ifdef PADDLE_MOBILE_CL
delete
cl_scope_
;
delete
cl_scope_
;
#endif
#endif
...
...
src/operators/batchnorm_op.h
浏览文件 @
276ec6f9
...
@@ -32,8 +32,7 @@ class BatchNormOp
...
@@ -32,8 +32,7 @@ class BatchNormOp
public:
public:
BatchNormOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
BatchNormOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
BatchNormParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
BatchNormParam
<
DeviceType
>
,
BatchNormKernel
<
DeviceType
,
T
>>
(
BatchNormKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/bilinear_interp_op.h
浏览文件 @
276ec6f9
...
@@ -34,8 +34,7 @@ class BilinearOp : public framework::OperatorWithKernel<
...
@@ -34,8 +34,7 @@ class BilinearOp : public framework::OperatorWithKernel<
public:
public:
BilinearOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
BilinearOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
BilinearInterpParam
<
DeviceType
>
,
DeviceType
,
BilinearInterpParam
<
DeviceType
>
,
operators
::
BilinearInterpKernel
<
DeviceType
,
T
>>
(
operators
::
BilinearInterpKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/box_coder_op.h
浏览文件 @
276ec6f9
...
@@ -34,8 +34,7 @@ class BoxCoderOp : public framework::OperatorWithKernel<
...
@@ -34,8 +34,7 @@ class BoxCoderOp : public framework::OperatorWithKernel<
public:
public:
BoxCoderOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
BoxCoderOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
BoxCoderParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
BoxCoderParam
<
DeviceType
>
,
operators
::
BoxCoderKernel
<
DeviceType
,
T
>>
(
operators
::
BoxCoderKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/cast_op.h
浏览文件 @
276ec6f9
...
@@ -31,7 +31,7 @@ class CastOp : public framework::OperatorWithKernel<
...
@@ -31,7 +31,7 @@ class CastOp : public framework::OperatorWithKernel<
public:
public:
CastOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
CastOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
CastParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
CastParam
<
DeviceType
>
,
operators
::
CastKernel
<
DeviceType
,
T
>>
(
operators
::
CastKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/concat_op.h
浏览文件 @
276ec6f9
...
@@ -30,7 +30,7 @@ class ConcatOp : public framework::OperatorWithKernel<
...
@@ -30,7 +30,7 @@ class ConcatOp : public framework::OperatorWithKernel<
public:
public:
ConcatOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
ConcatOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
ConcatParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
ConcatParam
<
DeviceType
>
,
operators
::
ConcatKernel
<
DeviceType
,
T
>>
(
operators
::
ConcatKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/conv_op.h
浏览文件 @
276ec6f9
...
@@ -30,7 +30,7 @@ class ConvOp : public framework::OperatorWithKernel<
...
@@ -30,7 +30,7 @@ class ConvOp : public framework::OperatorWithKernel<
public:
public:
ConvOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
ConvOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
ConvParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
ConvParam
<
DeviceType
>
,
operators
::
ConvKernel
<
DeviceType
,
T
>>
(
operators
::
ConvKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/conv_transpose_op.h
浏览文件 @
276ec6f9
...
@@ -31,8 +31,7 @@ class ConvOpTranspose : public framework::OperatorWithKernel<
...
@@ -31,8 +31,7 @@ class ConvOpTranspose : public framework::OperatorWithKernel<
public:
public:
ConvOpTranspose
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
ConvOpTranspose
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
ConvTransposeParam
<
DeviceType
>
,
DeviceType
,
ConvTransposeParam
<
DeviceType
>
,
operators
::
ConvTransposeKernel
<
DeviceType
,
T
>>
(
operators
::
ConvTransposeKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/crf_op.h
浏览文件 @
276ec6f9
...
@@ -33,7 +33,7 @@ class CrfOp : public framework::OperatorWithKernel<
...
@@ -33,7 +33,7 @@ class CrfOp : public framework::OperatorWithKernel<
public:
public:
CrfOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
CrfOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
CrfParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
CrfParam
<
DeviceType
>
,
operators
::
CrfKernel
<
DeviceType
,
T
>>
(
operators
::
CrfKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/depthwise_conv_op.h
浏览文件 @
276ec6f9
...
@@ -30,8 +30,7 @@ class DepthwiseConvOp : public framework::OperatorWithKernel<
...
@@ -30,8 +30,7 @@ class DepthwiseConvOp : public framework::OperatorWithKernel<
public:
public:
DepthwiseConvOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
DepthwiseConvOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
ConvParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
ConvParam
<
DeviceType
>
,
operators
::
ConvKernel
<
DeviceType
,
T
>>
(
operators
::
ConvKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/dequantize_op.h
浏览文件 @
276ec6f9
...
@@ -32,8 +32,7 @@ class DequantizeOp
...
@@ -32,8 +32,7 @@ class DequantizeOp
public:
public:
DequantizeOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
DequantizeOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
DequantizeParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
DequantizeParam
<
DeviceType
>
,
DequantizeKernel
<
DeviceType
,
T
>>
(
DequantizeKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/dropout_op.h
浏览文件 @
276ec6f9
...
@@ -34,7 +34,7 @@ class DropoutOp : public framework::OperatorWithKernel<
...
@@ -34,7 +34,7 @@ class DropoutOp : public framework::OperatorWithKernel<
public:
public:
DropoutOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
DropoutOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
DropoutParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
DropoutParam
<
DeviceType
>
,
operators
::
DropoutKernel
<
DeviceType
,
T
>>
(
operators
::
DropoutKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/elementwise_add_op.h
浏览文件 @
276ec6f9
...
@@ -32,7 +32,7 @@ class ElementwiseAddOp : public framework::OperatorWithKernel<
...
@@ -32,7 +32,7 @@ class ElementwiseAddOp : public framework::OperatorWithKernel<
ElementwiseAddOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
ElementwiseAddOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
ElementwiseAddParam
<
DeviceType
>
,
DeviceType
,
ElementwiseAddParam
<
DeviceType
>
,
operators
::
ElementwiseAddKernel
<
DeviceType
,
T
>>
(
operators
::
ElementwiseAddKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/elementwise_mul_op.h
浏览文件 @
276ec6f9
...
@@ -32,7 +32,7 @@ class ElementwiseMulOp : public framework::OperatorWithKernel<
...
@@ -32,7 +32,7 @@ class ElementwiseMulOp : public framework::OperatorWithKernel<
ElementwiseMulOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
ElementwiseMulOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
ElementwiseMulParam
<
DeviceType
>
,
DeviceType
,
ElementwiseMulParam
<
DeviceType
>
,
operators
::
ElementwiseMulKernel
<
DeviceType
,
T
>>
(
operators
::
ElementwiseMulKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/elementwise_sub_op.h
浏览文件 @
276ec6f9
...
@@ -32,7 +32,7 @@ class ElementwiseSubOp : public framework::OperatorWithKernel<
...
@@ -32,7 +32,7 @@ class ElementwiseSubOp : public framework::OperatorWithKernel<
ElementwiseSubOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
ElementwiseSubOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
ElementwiseSubParam
<
DeviceType
>
,
DeviceType
,
ElementwiseSubParam
<
DeviceType
>
,
operators
::
ElementwiseSubKernel
<
DeviceType
,
T
>>
(
operators
::
ElementwiseSubKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/feed_op.h
浏览文件 @
276ec6f9
...
@@ -31,7 +31,7 @@ class FeedOp
...
@@ -31,7 +31,7 @@ class FeedOp
public:
public:
FeedOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
FeedOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
FeedParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
FeedParam
<
DeviceType
>
,
FeedKernel
<
DeviceType
,
T
>>
(
FeedKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/fetch_op.cpp
浏览文件 @
276ec6f9
...
@@ -18,8 +18,9 @@ namespace operators {
...
@@ -18,8 +18,9 @@ namespace operators {
template
<
typename
DeviceType
,
typename
T
>
template
<
typename
DeviceType
,
typename
T
>
void
FetchOp
<
DeviceType
,
T
>::
InferShape
()
const
{
void
FetchOp
<
DeviceType
,
T
>::
InferShape
()
const
{
int
col
=
this
->
param_
.
Col
();
auto
x_dims
=
this
->
param_
.
InputX
()
->
dims
();
auto
x_dims
=
this
->
param_
.
InputX
()
->
dims
();
this
->
param_
.
Out
()
->
Resize
(
x_dims
);
this
->
param_
.
Out
()
->
at
(
col
).
Resize
(
x_dims
);
}
}
}
// namespace operators
}
// namespace operators
...
...
src/operators/fetch_op.h
浏览文件 @
276ec6f9
...
@@ -30,7 +30,7 @@ class FetchOp
...
@@ -30,7 +30,7 @@ class FetchOp
public:
public:
FetchOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
FetchOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
FetchParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
FetchParam
<
DeviceType
>
,
FetchKernel
<
DeviceType
,
T
>>
(
FetchKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/fill_constant_op.h
浏览文件 @
276ec6f9
...
@@ -31,8 +31,7 @@ class FillConstantOp : public framework::OperatorBase<DeviceType> {
...
@@ -31,8 +31,7 @@ class FillConstantOp : public framework::OperatorBase<DeviceType> {
public:
public:
FillConstantOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
FillConstantOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
attrs
,
const
framework
::
AttributeMap
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorBase
<
DeviceType
>
(
type
,
inputs
,
outputs
,
attrs
,
:
framework
::
OperatorBase
<
DeviceType
>
(
type
,
inputs
,
outputs
,
attrs
,
scope
),
scope
),
param_
(
inputs
,
outputs
,
attrs
,
*
scope
)
{}
param_
(
inputs
,
outputs
,
attrs
,
*
scope
)
{}
...
...
src/operators/flatten_op.h
浏览文件 @
276ec6f9
...
@@ -49,8 +49,7 @@ class FlattenOp : public framework::OperatorWithKernel<
...
@@ -49,8 +49,7 @@ class FlattenOp : public framework::OperatorWithKernel<
public:
public:
FlattenOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
FlattenOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
FlattenParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
FlattenParam
<
DeviceType
>
,
operators
::
FlattenKernel
<
DeviceType
,
T
>>
(
operators
::
FlattenKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/fusion_conv_add_add_prelu_op.h
浏览文件 @
276ec6f9
...
@@ -63,7 +63,7 @@ class FusionConvAddAddPReluOp
...
@@ -63,7 +63,7 @@ class FusionConvAddAddPReluOp
FusionConvAddAddPReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionConvAddAddPReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionConvAddAddPReluParam
<
DeviceType
>
,
DeviceType
,
FusionConvAddAddPReluParam
<
DeviceType
>
,
operators
::
ConvAddAddPReluKernel
<
DeviceType
,
T
>>
(
operators
::
ConvAddAddPReluKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/fusion_conv_add_bn_op.h
浏览文件 @
276ec6f9
...
@@ -20,8 +20,8 @@ limitations under the License. */
...
@@ -20,8 +20,8 @@ limitations under the License. */
#include <vector>
#include <vector>
#include "framework/operator.h"
#include "framework/operator.h"
#include "framework/program/program-optimize/fusion_op_register.h"
#include "framework/program/program-optimize/fusion_op_register.h"
#include "op_param.h"
#include "operators/kernel/conv_add_bn_kernel.h"
#include "operators/kernel/conv_add_bn_kernel.h"
#include "operators/op_param.h"
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
...
@@ -59,7 +59,7 @@ class FusionConvAddBNOp : public framework::OperatorWithKernel<
...
@@ -59,7 +59,7 @@ class FusionConvAddBNOp : public framework::OperatorWithKernel<
FusionConvAddBNOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionConvAddBNOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionConvAddBNParam
<
DeviceType
>
,
DeviceType
,
FusionConvAddBNParam
<
DeviceType
>
,
operators
::
ConvAddBNKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
operators
::
ConvAddBNKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
...
...
src/operators/fusion_conv_add_bn_relu_op.h
浏览文件 @
276ec6f9
...
@@ -61,7 +61,7 @@ class FusionConvAddBNReluOp
...
@@ -61,7 +61,7 @@ class FusionConvAddBNReluOp
FusionConvAddBNReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionConvAddBNReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionConvAddBNReluParam
<
DeviceType
>
,
DeviceType
,
FusionConvAddBNReluParam
<
DeviceType
>
,
operators
::
ConvAddBNReluKernel
<
DeviceType
,
T
>>
(
operators
::
ConvAddBNReluKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/fusion_conv_add_op.h
浏览文件 @
276ec6f9
...
@@ -50,8 +50,7 @@ class FusionConvAddOp : public framework::OperatorWithKernel<
...
@@ -50,8 +50,7 @@ class FusionConvAddOp : public framework::OperatorWithKernel<
public:
public:
FusionConvAddOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionConvAddOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionConvAddParam
<
DeviceType
>
,
FusionConvAddParam
<
DeviceType
>
,
operators
::
ConvAddKernel
<
DeviceType
,
T
>>
(
operators
::
ConvAddKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/fusion_conv_add_prelu_op.h
浏览文件 @
276ec6f9
...
@@ -54,7 +54,7 @@ class FusionConvAddPReluOp
...
@@ -54,7 +54,7 @@ class FusionConvAddPReluOp
FusionConvAddPReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionConvAddPReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionConvAddPReluParam
<
DeviceType
>
,
DeviceType
,
FusionConvAddPReluParam
<
DeviceType
>
,
operators
::
ConvAddPReluKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
operators
::
ConvAddPReluKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
...
...
src/operators/fusion_conv_add_relu_op.h
浏览文件 @
276ec6f9
...
@@ -51,7 +51,7 @@ class FusionConvAddReluOp : public framework::OperatorWithKernel<
...
@@ -51,7 +51,7 @@ class FusionConvAddReluOp : public framework::OperatorWithKernel<
FusionConvAddReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionConvAddReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionConvAddReluParam
<
DeviceType
>
,
DeviceType
,
FusionConvAddReluParam
<
DeviceType
>
,
operators
::
ConvAddReluKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
operators
::
ConvAddReluKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
...
...
src/operators/fusion_conv_bn_add_relu_op.h
浏览文件 @
276ec6f9
...
@@ -67,7 +67,7 @@ class FusionConvBNAddReluOp
...
@@ -67,7 +67,7 @@ class FusionConvBNAddReluOp
FusionConvBNAddReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionConvBNAddReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionConvBNAddReluParam
<
DeviceType
>
,
DeviceType
,
FusionConvBNAddReluParam
<
DeviceType
>
,
operators
::
ConvBNAddReluKernel
<
DeviceType
,
T
>>
(
operators
::
ConvBNAddReluKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/fusion_conv_bn_op.h
浏览文件 @
276ec6f9
...
@@ -56,8 +56,7 @@ class FusionConvBNOp : public framework::OperatorWithKernel<
...
@@ -56,8 +56,7 @@ class FusionConvBNOp : public framework::OperatorWithKernel<
public:
public:
FusionConvBNOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionConvBNOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionConvBNParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionConvBNParam
<
DeviceType
>
,
operators
::
ConvBNKernel
<
DeviceType
,
T
>>
(
operators
::
ConvBNKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/fusion_conv_bn_relu_op.h
浏览文件 @
276ec6f9
...
@@ -58,7 +58,7 @@ class FusionConvBNReluOp : public framework::OperatorWithKernel<
...
@@ -58,7 +58,7 @@ class FusionConvBNReluOp : public framework::OperatorWithKernel<
FusionConvBNReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionConvBNReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionConvBNReluParam
<
DeviceType
>
,
DeviceType
,
FusionConvBNReluParam
<
DeviceType
>
,
operators
::
ConvBNReluKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
operators
::
ConvBNReluKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
...
...
src/operators/fusion_deconv_add_op.h
浏览文件 @
276ec6f9
...
@@ -49,7 +49,7 @@ class FusionDeconvAddOp : public framework::OperatorWithKernel<
...
@@ -49,7 +49,7 @@ class FusionDeconvAddOp : public framework::OperatorWithKernel<
FusionDeconvAddOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionDeconvAddOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionDeconvAddParam
<
DeviceType
>
,
DeviceType
,
FusionDeconvAddParam
<
DeviceType
>
,
operators
::
DeconvAddKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
operators
::
DeconvAddKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
...
...
src/operators/fusion_deconv_add_relu_op.h
浏览文件 @
276ec6f9
...
@@ -51,7 +51,7 @@ class FusionDeconvAddReluOp
...
@@ -51,7 +51,7 @@ class FusionDeconvAddReluOp
FusionDeconvAddReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionDeconvAddReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionDeconvAddReluParam
<
DeviceType
>
,
DeviceType
,
FusionDeconvAddReluParam
<
DeviceType
>
,
operators
::
DeconvAddReluKernel
<
DeviceType
,
T
>>
(
operators
::
DeconvAddReluKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/fusion_deconv_relu_op.h
浏览文件 @
276ec6f9
...
@@ -48,7 +48,7 @@ class FusionDeconvReluOp : public framework::OperatorWithKernel<
...
@@ -48,7 +48,7 @@ class FusionDeconvReluOp : public framework::OperatorWithKernel<
FusionDeconvReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionDeconvReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionDeconvReluParam
<
DeviceType
>
,
DeviceType
,
FusionDeconvReluParam
<
DeviceType
>
,
operators
::
DeconvReluKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
operators
::
DeconvReluKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
...
...
src/operators/fusion_dequant_add_bn_op.h
浏览文件 @
276ec6f9
...
@@ -60,7 +60,7 @@ class FusionDequantAddBNOp
...
@@ -60,7 +60,7 @@ class FusionDequantAddBNOp
FusionDequantAddBNOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionDequantAddBNOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionDequantAddBNParam
<
DeviceType
>
,
DeviceType
,
FusionDequantAddBNParam
<
DeviceType
>
,
operators
::
FusionDequantAddBNKernel
<
DeviceType
,
T
>>
(
operators
::
FusionDequantAddBNKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/fusion_dequant_add_bn_relu_op.h
浏览文件 @
276ec6f9
...
@@ -62,7 +62,7 @@ class FusionDequantAddBNReluOp
...
@@ -62,7 +62,7 @@ class FusionDequantAddBNReluOp
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionDequantAddBNParam
<
DeviceType
>
,
DeviceType
,
FusionDequantAddBNParam
<
DeviceType
>
,
operators
::
FusionDequantAddBNReluKernel
<
DeviceType
,
T
>>
(
operators
::
FusionDequantAddBNReluKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/fusion_dequant_add_bn_relu_quant_op.h
浏览文件 @
276ec6f9
...
@@ -62,7 +62,7 @@ class FusionDequantAddBNReluQuantOp
...
@@ -62,7 +62,7 @@ class FusionDequantAddBNReluQuantOp
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionDequantAddBNReluQuantParam
<
DeviceType
>
,
DeviceType
,
FusionDequantAddBNReluQuantParam
<
DeviceType
>
,
operators
::
FusionDequantAddBNReluQuantKernel
<
DeviceType
,
T
>>
(
operators
::
FusionDequantAddBNReluQuantKernel
<
DeviceType
,
T
>>
(
...
@@ -109,7 +109,7 @@ class FusionDequantAddBNQuantOp
...
@@ -109,7 +109,7 @@ class FusionDequantAddBNQuantOp
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionDequantAddBNQuantParam
<
DeviceType
>
,
DeviceType
,
FusionDequantAddBNQuantParam
<
DeviceType
>
,
operators
::
FusionDequantAddBNQuantKernel
<
DeviceType
,
T
>>
(
operators
::
FusionDequantAddBNQuantKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/fusion_dequant_bn_op.h
浏览文件 @
276ec6f9
...
@@ -58,7 +58,7 @@ class FusionDequantBNOp : public framework::OperatorWithKernel<
...
@@ -58,7 +58,7 @@ class FusionDequantBNOp : public framework::OperatorWithKernel<
FusionDequantBNOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionDequantBNOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionDequantBNParam
<
DeviceType
>
,
DeviceType
,
FusionDequantBNParam
<
DeviceType
>
,
operators
::
FusionDequantBNKernel
<
DeviceType
,
T
>>
(
operators
::
FusionDequantBNKernel
<
DeviceType
,
T
>>
(
...
@@ -87,7 +87,7 @@ class FusionDequantBNReluOp
...
@@ -87,7 +87,7 @@ class FusionDequantBNReluOp
FusionDequantBNReluOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionDequantBNReluOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionDequantBNParam
<
DeviceType
>
,
DeviceType
,
FusionDequantBNParam
<
DeviceType
>
,
operators
::
FusionDequantBNReluKernel
<
DeviceType
,
T
>>
(
operators
::
FusionDequantBNReluKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/fusion_dequant_bn_relu_op.h
浏览文件 @
276ec6f9
...
@@ -59,7 +59,7 @@ class FusionDequantBNReluOp
...
@@ -59,7 +59,7 @@ class FusionDequantBNReluOp
FusionDequantBNReluOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionDequantBNReluOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionDequantBNReluParam
<
DeviceType
>
,
DeviceType
,
FusionDequantBNReluParam
<
DeviceType
>
,
operators
::
FusionDequantBNReluKernel
<
DeviceType
,
T
>>
(
operators
::
FusionDequantBNReluKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/fusion_dwconv_bn_relu_op.h
浏览文件 @
276ec6f9
...
@@ -59,7 +59,7 @@ class FusionDWConvBNReluOp
...
@@ -59,7 +59,7 @@ class FusionDWConvBNReluOp
FusionDWConvBNReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionDWConvBNReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionDWConvBNReluParam
<
DeviceType
>
,
DeviceType
,
FusionDWConvBNReluParam
<
DeviceType
>
,
operators
::
DWConvBNReluKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
operators
::
DWConvBNReluKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
...
...
src/operators/fusion_elementwise_add_relu_op.h
浏览文件 @
276ec6f9
...
@@ -17,6 +17,7 @@ limitations under the License. */
...
@@ -17,6 +17,7 @@ limitations under the License. */
#pragma once
#pragma once
#include <string>
#include <string>
#include <vector>
#include "framework/operator.h"
#include "framework/operator.h"
#include "framework/program/program-optimize/fusion_op_register.h"
#include "framework/program/program-optimize/fusion_op_register.h"
#include "operators/kernel/elementwise_add_relu_kernel.h"
#include "operators/kernel/elementwise_add_relu_kernel.h"
...
@@ -50,7 +51,7 @@ class FusionElementwiseAddReluOp
...
@@ -50,7 +51,7 @@ class FusionElementwiseAddReluOp
FusionElementwiseAddReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionElementwiseAddReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
ElementwiseAddReluParam
<
DeviceType
>
,
DeviceType
,
ElementwiseAddReluParam
<
DeviceType
>
,
operators
::
ElementwiseAddReluKernel
<
DeviceType
,
T
>>
(
operators
::
ElementwiseAddReluKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/fusion_fc_op.h
浏览文件 @
276ec6f9
...
@@ -50,8 +50,7 @@ class FusionFcOp : public framework::OperatorWithKernel<
...
@@ -50,8 +50,7 @@ class FusionFcOp : public framework::OperatorWithKernel<
public:
public:
FusionFcOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionFcOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionFcParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionFcParam
<
DeviceType
>
,
operators
::
FusionFcKernel
<
DeviceType
,
T
>>
(
operators
::
FusionFcKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/fusion_fc_relu_op.h
浏览文件 @
276ec6f9
...
@@ -49,8 +49,7 @@ class FusionFcReluOp : public framework::OperatorWithKernel<
...
@@ -49,8 +49,7 @@ class FusionFcReluOp : public framework::OperatorWithKernel<
public:
public:
FusionFcReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
FusionFcReluOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
FusionFcReluParam
<
DeviceType
>
,
DeviceType
,
FusionFcReluParam
<
DeviceType
>
,
operators
::
FusionFcReluKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
operators
::
FusionFcReluKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
...
...
src/operators/gru_op.h
浏览文件 @
276ec6f9
...
@@ -33,7 +33,7 @@ class GruOp : public framework::OperatorWithKernel<
...
@@ -33,7 +33,7 @@ class GruOp : public framework::OperatorWithKernel<
public:
public:
GruOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
GruOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
GruParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
GruParam
<
DeviceType
>
,
operators
::
GruKernel
<
DeviceType
,
T
>>
(
operators
::
GruKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/gru_unit_op.h
浏览文件 @
276ec6f9
...
@@ -16,6 +16,7 @@ limitations under the License. */
...
@@ -16,6 +16,7 @@ limitations under the License. */
#pragma once
#pragma once
#include <string>
#include "framework/operator.h"
#include "framework/operator.h"
#include "operators/kernel/gru_unit_kernel.h"
#include "operators/kernel/gru_unit_kernel.h"
#include "operators/op_param.h"
#include "operators/op_param.h"
...
@@ -30,10 +31,10 @@ class GruUnitOp : public framework::OperatorWithKernel<
...
@@ -30,10 +31,10 @@ class GruUnitOp : public framework::OperatorWithKernel<
public:
public:
GruUnitOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
GruUnitOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
std
::
shared_ptr
<
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
GruUnitParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
GruUnitParam
<
DeviceType
>
,
operators
::
GruUnitKernel
<
DeviceType
,
T
>>
(
operators
::
GruUnitKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{};
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
void
InferShape
()
const
override
;
void
InferShape
()
const
override
;
};
};
...
...
src/operators/im2sequence_op.h
浏览文件 @
276ec6f9
...
@@ -31,8 +31,7 @@ class Im2SequenceOp : public framework::OperatorWithKernel<
...
@@ -31,8 +31,7 @@ class Im2SequenceOp : public framework::OperatorWithKernel<
public:
public:
Im2SequenceOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
Im2SequenceOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
Im2SequenceParam
<
DeviceType
>
,
DeviceType
,
Im2SequenceParam
<
DeviceType
>
,
operators
::
Im2SequenceKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
operators
::
Im2SequenceKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
...
...
src/operators/increment_op.h
浏览文件 @
276ec6f9
...
@@ -32,8 +32,7 @@ class IncrementOp
...
@@ -32,8 +32,7 @@ class IncrementOp
public:
public:
IncrementOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
IncrementOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
IncrementParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
IncrementParam
<
DeviceType
>
,
IncrementKernel
<
DeviceType
,
T
>>
(
IncrementKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/is_empty_op.h
浏览文件 @
276ec6f9
...
@@ -31,8 +31,7 @@ class IsEmptyOp
...
@@ -31,8 +31,7 @@ class IsEmptyOp
public:
public:
IsEmptyOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
IsEmptyOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
IsEmptyParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
IsEmptyParam
<
DeviceType
>
,
IsEmptyKernel
<
DeviceType
,
T
>>
(
IsEmptyKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/kernel/arm/beam_search_decode_kernel.cpp
浏览文件 @
276ec6f9
...
@@ -29,6 +29,13 @@ template <>
...
@@ -29,6 +29,13 @@ template <>
void
BeamSearchDecodeKernel
<
CPU
,
float
>::
Compute
(
void
BeamSearchDecodeKernel
<
CPU
,
float
>::
Compute
(
const
BeamSearchDecodeParam
<
CPU
>
&
param
)
{
const
BeamSearchDecodeParam
<
CPU
>
&
param
)
{
// TODO(hjchen2)
// TODO(hjchen2)
DLOG
<<
"BeamSearchDecodeKernel"
;
param
.
sentence_scores_
->
Resize
(
framework
::
make_ddim
({
10
}));
param
.
sentence_scores_
->
mutable_data
<
float
>
();
DLOG
<<
"BeamSearchDecodeKernel"
;
param
.
sentence_ids_
->
Resize
(
framework
::
make_ddim
({
10
}));
param
.
sentence_ids_
->
mutable_data
<
int64_t
>
();
}
}
}
// namespace operators
}
// namespace operators
...
...
src/operators/kernel/arm/fetch_kernel.cpp
浏览文件 @
276ec6f9
...
@@ -8,17 +8,24 @@ distributed under the License is distributed on an "AS IS" BASIS,
...
@@ -8,17 +8,24 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
See the License for the specific language governing permissions and
limitations under the License. */
limitations under the License. */
#include "operators/kernel/fetch_kernel.h"
#include "operators/kernel/fetch_kernel.h"
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
template
<
>
template
<
>
bool
FetchKernel
<
CPU
,
float
>::
Init
(
FetchParam
<
CPU
>
*
param
)
{
bool
FetchKernel
<
CPU
,
float
>::
Init
(
FetchParam
<
CPU
>
*
param
)
{
return
true
;
return
true
;
}
}
template
<
>
template
<
>
void
FetchKernel
<
CPU
,
float
>::
Compute
(
const
FetchParam
<
CPU
>
&
param
)
{
void
FetchKernel
<
CPU
,
float
>::
Compute
(
const
FetchParam
<
CPU
>
&
param
)
{
param
.
Out
()
->
ShareDataWith
(
*
(
param
.
InputX
()));
int
col
=
param
.
Col
();
param
.
Out
()
->
at
(
col
).
ShareDataWith
(
*
(
param
.
InputX
()));
}
}
template
class
FetchKernel
<
CPU
,
float
>;
template
class
FetchKernel
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
src/operators/kernel/arm/sequence_expand_kernel.cpp
浏览文件 @
276ec6f9
...
@@ -100,8 +100,8 @@ class SequenceExpandKernel<CPU, T>
...
@@ -100,8 +100,8 @@ class SequenceExpandKernel<CPU, T>
out_lod
.
push_back
(
out_lod
.
back
()
+
x_seq_len
);
out_lod
.
push_back
(
out_lod
.
back
()
+
x_seq_len
);
}
}
}
}
}
output
->
set_lod
({
out_lod
});
output
->
set_lod
({
out_lod
});
}
SequenceExpandImpl
<
T
>
(
*
input_x
,
y_lod
[
ref_level
],
output
);
SequenceExpandImpl
<
T
>
(
*
input_x
,
y_lod
[
ref_level
],
output
);
}
}
};
};
...
...
src/operators/kernel/arm/sequence_softmax_kernel.cpp
浏览文件 @
276ec6f9
...
@@ -28,10 +28,13 @@ class SequenceSoftmaxKernel<CPU, T>
...
@@ -28,10 +28,13 @@ class SequenceSoftmaxKernel<CPU, T>
bool
Init
(
SoftmaxParam
<
CPU
>
*
param
)
{
return
true
;
}
bool
Init
(
SoftmaxParam
<
CPU
>
*
param
)
{
return
true
;
}
void
Compute
(
const
SoftmaxParam
<
CPU
>
&
param
)
{
void
Compute
(
const
SoftmaxParam
<
CPU
>
&
param
)
{
param
.
Out
()
->
mutable_data
<
float
>
();
/*
const framework::LoDTensor *input = param.InputX();
const framework::LoDTensor *input = param.InputX();
framework::LoDTensor *output = param.Out();
framework::LoDTensor *output = param.Out();
math::SequenceSoftmaxFuntor<CPU, T> sequence_softmax;
math::SequenceSoftmaxFuntor<CPU, T> sequence_softmax;
sequence_softmax(input, output);
sequence_softmax(input, output);
*/
}
}
};
};
...
...
src/operators/kernel/arm/tensor_array_read_write_kernel.cpp
浏览文件 @
276ec6f9
...
@@ -51,6 +51,11 @@ void ReadFromArrayKernel<CPU, float>::Compute(
...
@@ -51,6 +51,11 @@ void ReadFromArrayKernel<CPU, float>::Compute(
int64_t
offset
=
param
.
index_
->
data
<
int64_t
>
()[
0
];
int64_t
offset
=
param
.
index_
->
data
<
int64_t
>
()[
0
];
if
(
offset
<
param
.
input_
->
size
())
{
if
(
offset
<
param
.
input_
->
size
())
{
TensorCopy
(
param
.
input_
->
at
(
offset
),
param
.
output_
);
TensorCopy
(
param
.
input_
->
at
(
offset
),
param
.
output_
);
param
.
output_
->
set_lod
(
param
.
input_
->
at
(
offset
).
lod
());
}
else
{
PADDLE_MOBILE_THROW_EXCEPTION
(
"Can not read tensor which index is `%d` since it only has `%d` inputs"
,
offset
,
param
.
input_
->
size
());
}
}
}
}
#endif // READ_FROM_ARRAY_OP
#endif // READ_FROM_ARRAY_OP
...
...
src/operators/kernel/arm/while_kernel.cpp
浏览文件 @
276ec6f9
...
@@ -26,11 +26,12 @@ class StepExecutor {
...
@@ -26,11 +26,12 @@ class StepExecutor {
public:
public:
StepExecutor
(
const
framework
::
BlockDesc
*
block
,
framework
::
Scope
*
scope
)
StepExecutor
(
const
framework
::
BlockDesc
*
block
,
framework
::
Scope
*
scope
)
:
scope_
(
s
td
::
shared_ptr
<
framework
::
Scope
>
(
scope
)
)
{
:
scope_
(
s
cope
)
{
std
::
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
ops
=
block
->
Ops
();
std
::
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
ops
=
block
->
Ops
();
ops_of_block_
.
resize
(
ops
.
size
());
ops_of_block_
.
resize
(
ops
.
size
());
for
(
int
i
=
0
;
i
<
ops
.
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
ops
.
size
();
++
i
)
{
std
::
shared_ptr
<
framework
::
OpDesc
>
op_desc
=
ops
[
i
];
std
::
shared_ptr
<
framework
::
OpDesc
>
op_desc
=
ops
[
i
];
DLOG
<<
"create op: "
<<
op_desc
->
Type
();
auto
op_handler
=
framework
::
OpRegistry
<
CPU
>::
CreateOp
(
auto
op_handler
=
framework
::
OpRegistry
<
CPU
>::
CreateOp
(
op_desc
->
Type
(),
op_desc
->
GetInputs
(),
op_desc
->
GetOutputs
(),
op_desc
->
Type
(),
op_desc
->
GetInputs
(),
op_desc
->
GetOutputs
(),
op_desc
->
GetAttrMap
(),
scope_
);
op_desc
->
GetAttrMap
(),
scope_
);
...
@@ -40,15 +41,13 @@ class StepExecutor {
...
@@ -40,15 +41,13 @@ class StepExecutor {
void
Run
()
{
void
Run
()
{
for
(
auto
&
op_handler
:
ops_of_block_
)
{
for
(
auto
&
op_handler
:
ops_of_block_
)
{
DLOG
<<
"run op: "
<<
op_handler
->
Type
();
op_handler
->
InferShape
();
op_handler
->
InferShape
();
op_handler
->
Run
();
op_handler
->
Run
();
DLOG
<<
"run op finish"
;
}
}
}
}
private:
private:
std
::
shared_ptr
<
framework
::
Scope
>
scope_
;
framework
::
Scope
*
scope_
;
std
::
vector
<
OperatorPtr
>
ops_of_block_
;
std
::
vector
<
OperatorPtr
>
ops_of_block_
;
};
};
...
@@ -59,7 +58,6 @@ bool WhileKernel<CPU, float>::Init(WhileParam<CPU> *param) {
...
@@ -59,7 +58,6 @@ bool WhileKernel<CPU, float>::Init(WhileParam<CPU> *param) {
template
<
>
template
<
>
void
WhileKernel
<
CPU
,
float
>::
Compute
(
const
WhileParam
<
CPU
>
&
param
)
{
void
WhileKernel
<
CPU
,
float
>::
Compute
(
const
WhileParam
<
CPU
>
&
param
)
{
// TODO(hjchen2)
auto
&
current_scope
=
param
.
scope_
->
NewScope
();
auto
&
current_scope
=
param
.
scope_
->
NewScope
();
StepExecutor
executor
(
param
.
sub_block_
,
&
current_scope
);
StepExecutor
executor
(
param
.
sub_block_
,
&
current_scope
);
while
(
param
.
cond_
->
data
<
bool
>
()[
0
])
{
while
(
param
.
cond_
->
data
<
bool
>
()[
0
])
{
...
...
src/operators/kernel/central-arm-func/increment_arm_func.h
浏览文件 @
276ec6f9
...
@@ -25,11 +25,11 @@ template <typename P>
...
@@ -25,11 +25,11 @@ template <typename P>
void
IncrementCompute
(
const
IncrementParam
<
CPU
>
&
param
)
{
void
IncrementCompute
(
const
IncrementParam
<
CPU
>
&
param
)
{
const
framework
::
Tensor
*
input
=
param
.
InputX
();
const
framework
::
Tensor
*
input
=
param
.
InputX
();
framework
::
Tensor
*
out
=
param
.
Out
();
framework
::
Tensor
*
out
=
param
.
Out
();
in
t
step
=
param
.
Step
();
floa
t
step
=
param
.
Step
();
out
->
mutable_data
<
P
>
();
out
->
mutable_data
<
int64_t
>
();
const
P
*
input_data
=
input
->
data
<
P
>
();
const
int64_t
*
input_data
=
input
->
data
<
int64_t
>
();
P
*
out_data
=
out
->
data
<
P
>
();
int64_t
*
out_data
=
out
->
data
<
int64_t
>
();
*
out_data
=
*
input_data
+
step
;
*
out_data
=
*
input_data
+
step
;
}
}
...
...
src/operators/lookup_op.h
浏览文件 @
276ec6f9
...
@@ -33,7 +33,7 @@ class LookupOp : public framework::OperatorWithKernel<
...
@@ -33,7 +33,7 @@ class LookupOp : public framework::OperatorWithKernel<
public:
public:
LookupOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
LookupOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
LookupParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
LookupParam
<
DeviceType
>
,
operators
::
LookupKernel
<
DeviceType
,
T
>>
(
operators
::
LookupKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/lrn_op.h
浏览文件 @
276ec6f9
...
@@ -31,7 +31,7 @@ class LrnOp : public framework::OperatorWithKernel<
...
@@ -31,7 +31,7 @@ class LrnOp : public framework::OperatorWithKernel<
public:
public:
LrnOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
LrnOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
LrnParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
LrnParam
<
DeviceType
>
,
operators
::
LrnKernel
<
DeviceType
,
T
>>
(
operators
::
LrnKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/math/depthwise_conv3x3.cpp
浏览文件 @
276ec6f9
...
@@ -47,26 +47,27 @@ void DepthwiseConv3x3(const framework::Tensor *input,
...
@@ -47,26 +47,27 @@ void DepthwiseConv3x3(const framework::Tensor *input,
const
int
output_channel_stride
=
output_height
*
output_width
;
const
int
output_channel_stride
=
output_height
*
output_width
;
const
int
filter_channel_stride
=
9
;
const
int
filter_channel_stride
=
9
;
const
float
*
input_
data
=
input
->
data
<
float
>
();
const
float
*
input_
ptr
=
input
->
data
<
float
>
();
const
float
*
filter_
data
=
filter
->
data
<
float
>
();
const
float
*
filter_
ptr
=
filter
->
data
<
float
>
();
if
(
if_bias
)
{
if
(
if_bias
)
{
math
::
expand_bias
(
*
bias
,
1
,
output
->
dims
());
math
::
expand_bias
(
*
bias
,
1
,
output
->
dims
());
output
->
ShareDataWith
(
*
bias
);
output
->
ShareDataWith
(
*
bias
);
}
}
float
*
output_
data
=
output
->
mutable_data
<
float
>
();
float
*
output_
ptr
=
output
->
mutable_data
<
float
>
();
const
int
input_batch_stride
=
output_channels
*
input_channel_stride
;
const
float
*
pos1
,
*
pos2
,
*
pos3
,
*
filter1
,
*
filter2
,
*
filter3
,
*
output_ptr2
;
const
int
output_batch_stride
=
output_channels
*
output_channel_stride
;
const
int
filter_batch_stride
=
output_channels
*
output_channel_stride
;
const
float
*
pos1
,
*
pos2
,
*
pos3
,
*
filter1
,
*
filter2
,
*
filter3
,
*
output_ptr
;
int
hstart
,
wstart
,
hend
,
wend
;
int
hstart
,
wstart
,
hend
,
wend
;
float
result
;
float
result
;
for
(
int
i
=
0
;
i
<
batch_size
;
++
i
)
{
for
(
int
i
=
0
;
i
<
batch_size
;
++
i
)
{
#pragma omp parallel for
for
(
int
c
=
0
;
c
<
output_channels
;
++
c
)
{
for
(
int
c
=
0
;
c
<
output_channels
;
++
c
)
{
filter1
=
filter_data
;
const
float
*
input_data
=
input_ptr
+
(
i
*
output_channels
+
c
)
*
input_channel_stride
;
float
*
output_data
=
output_ptr
+
(
i
*
output_channels
+
c
)
*
output_channel_stride
;
filter1
=
filter_ptr
+
c
*
filter_channel_stride
;
filter2
=
filter1
+
3
;
filter2
=
filter1
+
3
;
filter3
=
filter2
+
3
;
filter3
=
filter2
+
3
;
for
(
int
ph
=
0
;
ph
<
output_height
;
ph
++
)
{
for
(
int
ph
=
0
;
ph
<
output_height
;
ph
++
)
{
for
(
int
pw
=
0
;
pw
<
output_width
;
pw
++
)
{
for
(
int
pw
=
0
;
pw
<
output_width
;
pw
++
)
{
hstart
=
ph
*
stride_height
-
padding_height
;
hstart
=
ph
*
stride_height
-
padding_height
;
...
@@ -80,7 +81,7 @@ void DepthwiseConv3x3(const framework::Tensor *input,
...
@@ -80,7 +81,7 @@ void DepthwiseConv3x3(const framework::Tensor *input,
pos1
=
input_data
+
hstart
*
input_width
+
wstart
;
pos1
=
input_data
+
hstart
*
input_width
+
wstart
;
pos2
=
input_data
+
(
hstart
+
1
)
*
input_width
+
wstart
;
pos2
=
input_data
+
(
hstart
+
1
)
*
input_width
+
wstart
;
pos3
=
input_data
+
(
hstart
+
2
)
*
input_width
+
wstart
;
pos3
=
input_data
+
(
hstart
+
2
)
*
input_width
+
wstart
;
output_ptr
=
output_data
+
ph
*
output_width
+
pw
;
output_ptr
2
=
output_data
+
ph
*
output_width
+
pw
;
if
(
hend
-
hstart
!=
3
||
wend
-
wstart
!=
3
)
{
if
(
hend
-
hstart
!=
3
||
wend
-
wstart
!=
3
)
{
result
=
0
;
result
=
0
;
...
@@ -230,7 +231,7 @@ void DepthwiseConv3x3(const framework::Tensor *input,
...
@@ -230,7 +231,7 @@ void DepthwiseConv3x3(const framework::Tensor *input,
:
[
input_data
]
"r"
(
input_data
),
[
pos1
]
"r"
(
pos1
),
:
[
input_data
]
"r"
(
input_data
),
[
pos1
]
"r"
(
pos1
),
[
pos2
]
"r"
(
pos2
),
[
pos3
]
"r"
(
pos3
),
[
filter1
]
"r"
(
filter1
),
[
pos2
]
"r"
(
pos2
),
[
pos3
]
"r"
(
pos3
),
[
filter1
]
"r"
(
filter1
),
[
filter2
]
"r"
(
filter2
),
[
filter3
]
"r"
(
filter3
),
[
filter2
]
"r"
(
filter2
),
[
filter3
]
"r"
(
filter3
),
[
output_ptr
]
"r"
(
output_ptr
),
[
zero
]
"r"
(
zero
)
[
output_ptr
]
"r"
(
output_ptr
2
),
[
zero
]
"r"
(
zero
)
:
"memory"
,
"q0"
,
"q1"
,
"q2"
,
"q3"
,
"q4"
,
"q5"
,
"q6"
);
:
"memory"
,
"q0"
,
"q1"
,
"q2"
,
"q3"
,
"q4"
,
"q5"
,
"q6"
);
#endif // __aarch64__
#endif // __aarch64__
#else
#else
...
@@ -239,12 +240,7 @@ void DepthwiseConv3x3(const framework::Tensor *input,
...
@@ -239,12 +240,7 @@ void DepthwiseConv3x3(const framework::Tensor *input,
}
}
}
}
}
}
input_data
+=
input_channel_stride
;
output_data
+=
output_channel_stride
;
filter_data
+=
filter_channel_stride
;
}
}
input_data
+=
input_batch_stride
;
output_data
+=
output_batch_stride
;
}
}
}
}
...
...
src/operators/mul_op.h
浏览文件 @
276ec6f9
...
@@ -31,7 +31,7 @@ class MulOp : public framework::OperatorWithKernel<
...
@@ -31,7 +31,7 @@ class MulOp : public framework::OperatorWithKernel<
public:
public:
MulOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
MulOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
MulParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
MulParam
<
DeviceType
>
,
operators
::
MulKernel
<
DeviceType
,
T
>>
(
operators
::
MulKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/multiclass_nms_op.h
浏览文件 @
276ec6f9
...
@@ -34,8 +34,7 @@ class MultiClassNMSOp : public framework::OperatorWithKernel<
...
@@ -34,8 +34,7 @@ class MultiClassNMSOp : public framework::OperatorWithKernel<
public:
public:
MultiClassNMSOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
MultiClassNMSOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
MultiClassNMSParam
<
DeviceType
>
,
DeviceType
,
MultiClassNMSParam
<
DeviceType
>
,
operators
::
MultiClassNMSKernel
<
DeviceType
,
T
>>
(
operators
::
MultiClassNMSKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/norm_op.h
浏览文件 @
276ec6f9
...
@@ -31,7 +31,7 @@ class NormOp
...
@@ -31,7 +31,7 @@ class NormOp
public:
public:
NormOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
NormOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
NormParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
NormParam
<
DeviceType
>
,
NormKernel
<
DeviceType
,
T
>>
(
NormKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/op_param.h
浏览文件 @
276ec6f9
...
@@ -1198,20 +1198,19 @@ class FetchParam : public OpParam {
...
@@ -1198,20 +1198,19 @@ class FetchParam : public OpParam {
public:
public:
FetchParam
(
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
FetchParam
(
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
Scope
&
scope
)
{
const
AttributeMap
&
attrs
,
const
Scope
&
scope
)
{
input_x_
=
InputXFrom
<
GType
>
(
inputs
,
scope
);
input_x_
=
InputXFrom
<
framework
::
LoDTensor
>
(
inputs
,
scope
);
out_
=
OutFrom
(
outputs
,
scope
);
out_
=
OutFrom
<
framework
::
LoDTensorArray
>
(
outputs
,
scope
);
col_
=
GetAttr
<
int
>
(
"col"
,
attrs
);
}
}
const
RType
*
InputX
()
const
{
return
input_x_
;
}
const
framework
::
LoDTensor
*
InputX
()
const
{
return
input_x_
;
}
Tensor
*
Out
()
const
{
return
out_
;
}
framework
::
LoDTensorArray
*
Out
()
const
{
return
out_
;
}
const
int
Col
()
const
{
return
col_
;
}
static
Tensor
*
OutFrom
(
const
VariableNameMap
&
outputs
,
const
Scope
&
scope
)
{
return
GetVarValue
<
LoDTensor
>
(
"Out"
,
outputs
,
scope
);
}
private:
private:
RType
*
input_x_
;
framework
::
LoDTensor
*
input_x_
;
Tensor
*
out_
;
framework
::
LoDTensorArray
*
out_
;
int
col_
;
#ifdef PADDLE_MOBILE_FPGA
#ifdef PADDLE_MOBILE_FPGA
private:
private:
...
@@ -2664,9 +2663,9 @@ class TopKParam : public OpParam {
...
@@ -2664,9 +2663,9 @@ class TopKParam : public OpParam {
}
}
public:
public:
R
Type
*
input_
;
G
Type
*
input_
;
R
Type
*
output_
;
G
Type
*
output_
;
R
Type
*
indices_
;
G
Type
*
indices_
;
int
k_
;
int
k_
;
};
};
#endif // TOP_K_OP
#endif // TOP_K_OP
...
...
src/operators/polygon_box_transform_op.h
浏览文件 @
276ec6f9
...
@@ -36,7 +36,7 @@ class PolygonBoxTransformOp
...
@@ -36,7 +36,7 @@ class PolygonBoxTransformOp
PolygonBoxTransformOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
PolygonBoxTransformOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
PolygonBoxTransformParam
<
DeviceType
>
,
DeviceType
,
PolygonBoxTransformParam
<
DeviceType
>
,
operators
::
PolygonBoxTransformKernel
<
DeviceType
,
T
>>
(
operators
::
PolygonBoxTransformKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/pool_op.h
浏览文件 @
276ec6f9
...
@@ -24,18 +24,16 @@ limitations under the License. */
...
@@ -24,18 +24,16 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
using
framework
::
AttributeMap
;
using
framework
::
OperatorWithKernel
;
using
framework
::
Scope
;
using
std
::
string
;
template
<
typename
DeviceType
,
typename
T
>
template
<
typename
DeviceType
,
typename
T
>
class
PoolOp
:
public
OperatorWithKernel
<
DeviceType
,
PoolParam
<
DeviceType
>
,
class
PoolOp
:
public
framework
::
OperatorWithKernel
<
DeviceType
,
PoolParam
<
DeviceType
>
,
operators
::
PoolKernel
<
DeviceType
,
T
>>
{
operators
::
PoolKernel
<
DeviceType
,
T
>>
{
public:
public:
PoolOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
PoolOp
(
const
st
d
::
st
ring
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
std
::
shared_ptr
<
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
OperatorWithKernel
<
DeviceType
,
PoolParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
PoolParam
<
DeviceType
>
,
operators
::
PoolKernel
<
DeviceType
,
T
>>
(
operators
::
PoolKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
void
InferShape
()
const
override
;
void
InferShape
()
const
override
;
...
...
src/operators/prelu_op.h
浏览文件 @
276ec6f9
...
@@ -34,7 +34,7 @@ class PReluOp : public framework::OperatorWithKernel<
...
@@ -34,7 +34,7 @@ class PReluOp : public framework::OperatorWithKernel<
public:
public:
PReluOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
PReluOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
PReluParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
PReluParam
<
DeviceType
>
,
operators
::
PReluKernel
<
DeviceType
,
T
>>
(
operators
::
PReluKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/prior_box_op.h
浏览文件 @
276ec6f9
...
@@ -34,8 +34,7 @@ class PriorBoxOp : public framework::OperatorWithKernel<
...
@@ -34,8 +34,7 @@ class PriorBoxOp : public framework::OperatorWithKernel<
public:
public:
PriorBoxOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
PriorBoxOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
PriorBoxParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
PriorBoxParam
<
DeviceType
>
,
operators
::
PriorBoxKernel
<
DeviceType
,
T
>>
(
operators
::
PriorBoxKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/quantize_op.h
浏览文件 @
276ec6f9
...
@@ -31,8 +31,7 @@ class QuantizeOp : public framework::OperatorWithKernel<
...
@@ -31,8 +31,7 @@ class QuantizeOp : public framework::OperatorWithKernel<
public:
public:
QuantizeOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
QuantizeOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
QuantizeParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
QuantizeParam
<
DeviceType
>
,
operators
::
QuantizeKernel
<
DeviceType
,
T
>>
(
operators
::
QuantizeKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/reshape2_op.h
浏览文件 @
276ec6f9
...
@@ -34,8 +34,7 @@ class Reshape2Op : public framework::OperatorWithKernel<
...
@@ -34,8 +34,7 @@ class Reshape2Op : public framework::OperatorWithKernel<
public:
public:
Reshape2Op
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
Reshape2Op
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
Reshape2Param
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
Reshape2Param
<
DeviceType
>
,
operators
::
Reshape2Kernel
<
DeviceType
,
T
>>
(
operators
::
Reshape2Kernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/reshape_op.h
浏览文件 @
276ec6f9
...
@@ -34,8 +34,7 @@ class ReshapeOp : public framework::OperatorWithKernel<
...
@@ -34,8 +34,7 @@ class ReshapeOp : public framework::OperatorWithKernel<
public:
public:
ReshapeOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
ReshapeOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
ReshapeParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
ReshapeParam
<
DeviceType
>
,
operators
::
ReshapeKernel
<
DeviceType
,
T
>>
(
operators
::
ReshapeKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/resize_op.h
浏览文件 @
276ec6f9
...
@@ -34,7 +34,7 @@ class ResizeOp : public framework::OperatorWithKernel<
...
@@ -34,7 +34,7 @@ class ResizeOp : public framework::OperatorWithKernel<
public:
public:
ResizeOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
ResizeOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
ResizeParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
ResizeParam
<
DeviceType
>
,
operators
::
ResizeKernel
<
DeviceType
,
T
>>
(
operators
::
ResizeKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/scale_op.h
浏览文件 @
276ec6f9
...
@@ -34,7 +34,7 @@ class ScaleOp : public framework::OperatorWithKernel<
...
@@ -34,7 +34,7 @@ class ScaleOp : public framework::OperatorWithKernel<
public:
public:
ScaleOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
ScaleOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
ScaleParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
ScaleParam
<
DeviceType
>
,
operators
::
ScaleKernel
<
DeviceType
,
T
>>
(
operators
::
ScaleKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/sequence_ops/sequence_expand_op.h
浏览文件 @
276ec6f9
...
@@ -32,7 +32,7 @@ class SequenceExpandOp : public framework::OperatorWithKernel<
...
@@ -32,7 +32,7 @@ class SequenceExpandOp : public framework::OperatorWithKernel<
SequenceExpandOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
SequenceExpandOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
SequenceExpandParam
<
DeviceType
>
,
DeviceType
,
SequenceExpandParam
<
DeviceType
>
,
operators
::
SequenceExpandKernel
<
DeviceType
,
T
>>
(
operators
::
SequenceExpandKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/sequence_ops/sequence_pool_op.h
浏览文件 @
276ec6f9
...
@@ -31,8 +31,7 @@ class SequencePoolOp : public framework::OperatorWithKernel<
...
@@ -31,8 +31,7 @@ class SequencePoolOp : public framework::OperatorWithKernel<
public:
public:
SequencePoolOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
SequencePoolOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
SequencePoolParam
<
DeviceType
>
,
DeviceType
,
SequencePoolParam
<
DeviceType
>
,
operators
::
SequencePoolKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
operators
::
SequencePoolKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
...
...
src/operators/sequence_ops/sequence_softmax_op.h
浏览文件 @
276ec6f9
...
@@ -32,7 +32,7 @@ class SequenceSoftmaxOp : public framework::OperatorWithKernel<
...
@@ -32,7 +32,7 @@ class SequenceSoftmaxOp : public framework::OperatorWithKernel<
SequenceSoftmaxOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
SequenceSoftmaxOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
SoftmaxParam
<
DeviceType
>
,
DeviceType
,
SoftmaxParam
<
DeviceType
>
,
operators
::
SequenceSoftmaxKernel
<
DeviceType
,
T
>>
(
operators
::
SequenceSoftmaxKernel
<
DeviceType
,
T
>>
(
...
...
src/operators/shape_op.h
浏览文件 @
276ec6f9
...
@@ -34,7 +34,7 @@ class ShapeOp : public framework::OperatorWithKernel<
...
@@ -34,7 +34,7 @@ class ShapeOp : public framework::OperatorWithKernel<
public:
public:
ShapeOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
ShapeOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
ShapeParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
ShapeParam
<
DeviceType
>
,
operators
::
ShapeKernel
<
DeviceType
,
T
>>
(
operators
::
ShapeKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/slice_op.h
浏览文件 @
276ec6f9
...
@@ -34,7 +34,7 @@ class SliceOp : public framework::OperatorWithKernel<
...
@@ -34,7 +34,7 @@ class SliceOp : public framework::OperatorWithKernel<
public:
public:
SliceOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
SliceOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
SliceParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
SliceParam
<
DeviceType
>
,
operators
::
SliceKernel
<
DeviceType
,
T
>>
(
operators
::
SliceKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/softmax_op.h
浏览文件 @
276ec6f9
...
@@ -31,8 +31,7 @@ class SoftmaxOp : public framework::OperatorWithKernel<
...
@@ -31,8 +31,7 @@ class SoftmaxOp : public framework::OperatorWithKernel<
public:
public:
SoftmaxOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
SoftmaxOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
SoftmaxParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
SoftmaxParam
<
DeviceType
>
,
operators
::
SoftmaxKernel
<
DeviceType
,
T
>>
(
operators
::
SoftmaxKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/split_op.h
浏览文件 @
276ec6f9
...
@@ -34,7 +34,7 @@ class SplitOp : public framework::OperatorWithKernel<
...
@@ -34,7 +34,7 @@ class SplitOp : public framework::OperatorWithKernel<
public:
public:
SplitOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
SplitOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
SplitParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
SplitParam
<
DeviceType
>
,
operators
::
SplitKernel
<
DeviceType
,
T
>>
(
operators
::
SplitKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/sum_op.h
浏览文件 @
276ec6f9
...
@@ -30,7 +30,7 @@ class SumOp : public framework::OperatorWithKernel<
...
@@ -30,7 +30,7 @@ class SumOp : public framework::OperatorWithKernel<
public:
public:
SumOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
SumOp
(
const
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
SumParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
SumParam
<
DeviceType
>
,
operators
::
SumKernel
<
DeviceType
,
T
>>
(
operators
::
SumKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/top_k_op.cpp
浏览文件 @
276ec6f9
...
@@ -26,7 +26,11 @@ void TopKOp<DeviceType, T>::InferShape() const {
...
@@ -26,7 +26,11 @@ void TopKOp<DeviceType, T>::InferShape() const {
// should check k <= dims[-1] && k >= 1
// should check k <= dims[-1] && k >= 1
dims
[
dims
.
size
()
-
1
]
=
k
;
dims
[
dims
.
size
()
-
1
]
=
k
;
this
->
param_
.
output_
->
Resize
(
dims
);
this
->
param_
.
output_
->
Resize
(
dims
);
// this->param_.output_->set_lod(this->param_.input_->lod());
this
->
param_
.
output_
->
set_lod
({{
0
,
1
}});
this
->
param_
.
indices_
->
Resize
(
dims
);
this
->
param_
.
indices_
->
Resize
(
dims
);
// this->param_.indices_->set_lod(this->param_.input_->lod());
this
->
param_
.
indices_
->
set_lod
({{
0
,
1
}});
}
}
}
// namespace operators
}
// namespace operators
...
...
src/operators/top_k_op.h
浏览文件 @
276ec6f9
...
@@ -31,7 +31,7 @@ class TopKOp : public framework::OperatorWithKernel<
...
@@ -31,7 +31,7 @@ class TopKOp : public framework::OperatorWithKernel<
public:
public:
TopKOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
TopKOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
framework
::
Scope
*
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
TopKParam
<
DeviceType
>
,
:
framework
::
OperatorWithKernel
<
DeviceType
,
TopKParam
<
DeviceType
>
,
operators
::
TopKKernel
<
DeviceType
,
T
>>
(
operators
::
TopKKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
...
...
src/operators/transpose2_op.h
浏览文件 @
276ec6f9
...
@@ -34,8 +34,7 @@ class Transpose2Op : public framework::OperatorWithKernel<
...
@@ -34,8 +34,7 @@ class Transpose2Op : public framework::OperatorWithKernel<
public:
public:
Transpose2Op
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
Transpose2Op
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
Transpose2Param
<
DeviceType
>
,
DeviceType
,
Transpose2Param
<
DeviceType
>
,
operators
::
Transpose2Kernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
operators
::
Transpose2Kernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
...
...
src/operators/transpose_op.h
浏览文件 @
276ec6f9
...
@@ -34,8 +34,7 @@ class TransposeOp : public framework::OperatorWithKernel<
...
@@ -34,8 +34,7 @@ class TransposeOp : public framework::OperatorWithKernel<
public:
public:
TransposeOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
TransposeOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
framework
::
AttributeMap
&
attrs
,
framework
::
Scope
*
scope
)
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
:
framework
::
OperatorWithKernel
<
DeviceType
,
TransposeParam
<
DeviceType
>
,
DeviceType
,
TransposeParam
<
DeviceType
>
,
operators
::
TransposeKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
operators
::
TransposeKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
...
...
test/executor_for_test.h
浏览文件 @
276ec6f9
...
@@ -69,7 +69,7 @@ class Executor4Test : public Executor<DeviceType> {
...
@@ -69,7 +69,7 @@ class Executor4Test : public Executor<DeviceType> {
std
::
shared_ptr
<
paddle_mobile
::
framework
::
OperatorBase
<
DeviceType
>>
std
::
shared_ptr
<
paddle_mobile
::
framework
::
OperatorBase
<
DeviceType
>>
op_ptr
=
paddle_mobile
::
framework
::
OpRegistry
<
DeviceType
>::
CreateOp
(
op_ptr
=
paddle_mobile
::
framework
::
OpRegistry
<
DeviceType
>::
CreateOp
(
op
->
Type
(),
op
->
GetInputs
(),
op
->
GetOutputs
(),
op
->
GetAttrMap
(),
op
->
Type
(),
op
->
GetInputs
(),
op
->
GetOutputs
(),
op
->
GetAttrMap
(),
this
->
program_
.
scope
);
this
->
program_
.
scope
.
get
()
);
this
->
ops_of_block0_
.
push_back
(
op_ptr
);
this
->
ops_of_block0_
.
push_back
(
op_ptr
);
break
;
break
;
}
}
...
@@ -86,7 +86,7 @@ class Executor4Test : public Executor<DeviceType> {
...
@@ -86,7 +86,7 @@ class Executor4Test : public Executor<DeviceType> {
const
vector
<
string
>
&
input_names
,
const
vector
<
string
>
&
input_names
,
const
vector
<
string
>
&
output_names
,
const
vector
<
string
>
&
output_names
,
const
vector
<
DDim
>
&
ddims
)
{
const
vector
<
DDim
>
&
ddims
)
{
auto
scope
=
this
->
program_
.
scope
;
auto
scope
=
this
->
program_
.
scope
.
get
()
;
size_t
input_size
=
input_names
.
size
();
size_t
input_size
=
input_names
.
size
();
size_t
out_size
=
output_names
.
size
();
size_t
out_size
=
output_names
.
size
();
...
@@ -119,7 +119,7 @@ class Executor4Test : public Executor<DeviceType> {
...
@@ -119,7 +119,7 @@ class Executor4Test : public Executor<DeviceType> {
std
::
shared_ptr
<
Tensor
>
Predict
(
const
Tensor
&
t
,
string
input
,
string
output
,
std
::
shared_ptr
<
Tensor
>
Predict
(
const
Tensor
&
t
,
string
input
,
string
output
,
const
DDim
&
dDim
)
{
const
DDim
&
dDim
)
{
auto
scope
=
this
->
program_
.
scope
;
auto
scope
=
this
->
program_
.
scope
.
get
()
;
Variable
*
g_feed_value
=
scope
->
Var
(
input
);
Variable
*
g_feed_value
=
scope
->
Var
(
input
);
auto
tensor
=
g_feed_value
->
GetMutable
<
LoDTensor
>
();
auto
tensor
=
g_feed_value
->
GetMutable
<
LoDTensor
>
();
tensor
->
ShareDataWith
(
t
);
tensor
->
ShareDataWith
(
t
);
...
...
test/operators/test_batchnorm_op.cpp
浏览文件 @
276ec6f9
...
@@ -88,8 +88,8 @@ int TestBatchNormOp(const std::vector<int> input_shape) {
...
@@ -88,8 +88,8 @@ int TestBatchNormOp(const std::vector<int> input_shape) {
attrs
[
"epsilon"
].
Set
<
float
>
(
eps
);
attrs
[
"epsilon"
].
Set
<
float
>
(
eps
);
attrs
[
"momentum"
].
Set
<
float
>
(
0.
f
);
attrs
[
"momentum"
].
Set
<
float
>
(
0.
f
);
auto
*
op
=
new
operators
::
BatchNormOp
<
CPU
,
float
>
(
"batch_norm"
,
inputs
,
auto
*
op
=
new
operators
::
BatchNormOp
<
CPU
,
float
>
(
outputs
,
attrs
,
scope
);
"batch_norm"
,
inputs
,
outputs
,
attrs
,
scope
.
get
()
);
op
->
InferShape
();
op
->
InferShape
();
op
->
Init
();
op
->
Init
();
op
->
Run
();
op
->
Run
();
...
...
test/operators/test_box_coder_op.cpp
浏览文件 @
276ec6f9
...
@@ -49,7 +49,7 @@ class TestBoxCoderOp {
...
@@ -49,7 +49,7 @@ class TestBoxCoderOp {
std
::
shared_ptr
<
operators
::
BoxCoderOp
<
Dtype
,
float
>>
boxcoder
=
std
::
shared_ptr
<
operators
::
BoxCoderOp
<
Dtype
,
float
>>
boxcoder
=
std
::
make_shared
<
operators
::
BoxCoderOp
<
Dtype
,
float
>>
(
std
::
make_shared
<
operators
::
BoxCoderOp
<
Dtype
,
float
>>
(
op
->
Type
(),
op
->
GetInputs
(),
op
->
GetOutputs
(),
op
->
Type
(),
op
->
GetInputs
(),
op
->
GetOutputs
(),
op
->
GetAttrMap
(),
program_
.
scope
);
op
->
GetAttrMap
(),
program_
.
scope
.
get
()
);
ops_of_block_
[
*
block_desc
.
get
()].
push_back
(
boxcoder
);
ops_of_block_
[
*
block_desc
.
get
()].
push_back
(
boxcoder
);
}
}
}
}
...
@@ -59,7 +59,7 @@ class TestBoxCoderOp {
...
@@ -59,7 +59,7 @@ class TestBoxCoderOp {
std
::
shared_ptr
<
Tensor
>
predict_boxcoder
(
const
Tensor
&
t1
,
const
Tensor
&
t2
,
std
::
shared_ptr
<
Tensor
>
predict_boxcoder
(
const
Tensor
&
t1
,
const
Tensor
&
t2
,
const
Tensor
&
t3
)
{
const
Tensor
&
t3
)
{
// feed
// feed
auto
scope
=
program_
.
scope
;
auto
scope
=
program_
.
scope
.
get
()
;
Variable
*
prior_box
=
scope
->
Var
(
"concat_0.tmp_0"
);
Variable
*
prior_box
=
scope
->
Var
(
"concat_0.tmp_0"
);
auto
tensor_x1
=
prior_box
->
GetMutable
<
LoDTensor
>
();
auto
tensor_x1
=
prior_box
->
GetMutable
<
LoDTensor
>
();
tensor_x1
->
ShareDataWith
(
t1
);
tensor_x1
->
ShareDataWith
(
t1
);
...
...
test/operators/test_cast_op.cpp
浏览文件 @
276ec6f9
...
@@ -81,8 +81,8 @@ int TestCastOp(const std::vector<int> input_shape) {
...
@@ -81,8 +81,8 @@ int TestCastOp(const std::vector<int> input_shape) {
framework
::
AttributeMap
attrs
;
framework
::
AttributeMap
attrs
;
attrs
[
"in_dtype"
].
Set
<
int
>
(
TypeInt
<
Itype
>
());
attrs
[
"in_dtype"
].
Set
<
int
>
(
TypeInt
<
Itype
>
());
attrs
[
"out_dtype"
].
Set
<
int
>
(
TypeInt
<
Otype
>
());
attrs
[
"out_dtype"
].
Set
<
int
>
(
TypeInt
<
Otype
>
());
auto
*
op
=
auto
*
op
=
new
operators
::
CastOp
<
CPU
,
float
>
(
"cast"
,
inputs
,
outputs
,
attrs
,
new
operators
::
CastOp
<
CPU
,
float
>
(
"cast"
,
inputs
,
outputs
,
attrs
,
scope
);
scope
.
get
()
);
op
->
InferShape
();
op
->
InferShape
();
op
->
Init
();
op
->
Init
();
op
->
Run
();
op
->
Run
();
...
...
test/operators/test_concat_op.cpp
浏览文件 @
276ec6f9
...
@@ -27,7 +27,7 @@ using framework::Scope;
...
@@ -27,7 +27,7 @@ using framework::Scope;
using
framework
::
make_ddim
;
using
framework
::
make_ddim
;
template
<
typename
T
>
template
<
typename
T
>
void
concat
(
const
std
::
vector
<
LoDTensor
>
&
input
,
LoDTensor
&
output
,
int
axis
)
{
void
concat
(
const
std
::
vector
<
LoDTensor
>
&
input
,
LoDTensor
*
output
,
int
axis
)
{
int
num
=
input
.
size
();
int
num
=
input
.
size
();
int
rows
=
1
;
int
rows
=
1
;
...
@@ -45,7 +45,7 @@ void concat(const std::vector<LoDTensor> &input, LoDTensor &output, int axis) {
...
@@ -45,7 +45,7 @@ void concat(const std::vector<LoDTensor> &input, LoDTensor &output, int axis) {
}
}
// computation
// computation
auto
output_data
=
output
.
data
<
T
>
();
auto
output_data
=
output
->
data
<
T
>
();
int
col_idx
=
0
;
int
col_idx
=
0
;
for
(
int
j
=
0
;
j
<
num
;
++
j
)
{
for
(
int
j
=
0
;
j
<
num
;
++
j
)
{
int
col_len
=
input_cols
[
j
];
int
col_len
=
input_cols
[
j
];
...
@@ -99,14 +99,14 @@ int TestConcatOP() {
...
@@ -99,14 +99,14 @@ int TestConcatOP() {
attrs
[
"axis"
].
Set
<
int
>
(
axis_v
);
attrs
[
"axis"
].
Set
<
int
>
(
axis_v
);
auto
*
op
=
new
operators
::
ConcatOp
<
CPU
,
float
>
(
"concat"
,
inputs
,
outputs
,
auto
*
op
=
new
operators
::
ConcatOp
<
CPU
,
float
>
(
"concat"
,
inputs
,
outputs
,
attrs
,
scope
);
attrs
,
scope
.
get
()
);
op
->
InferShape
();
op
->
InferShape
();
op
->
Run
();
op
->
Run
();
auto
output
=
output_var
->
template
Get
<
framework
::
LoDTensor
>();
auto
output
=
output_var
->
template
Get
<
framework
::
LoDTensor
>();
const
T
*
output_data
=
output
->
data
<
T
>
();
const
T
*
output_data
=
output
->
data
<
T
>
();
LoDTensor
output_cmp
;
LoDTensor
output_cmp
;
output_cmp
.
mutable_data
<
T
>
(
output_shape
);
output_cmp
.
mutable_data
<
T
>
(
output_shape
);
concat
<
T
>
(
input_tensors
,
output_cmp
,
axis_v
);
concat
<
T
>
(
input_tensors
,
&
output_cmp
,
axis_v
);
const
T
*
output_cmp_data
=
output_cmp
.
data
<
T
>
();
const
T
*
output_cmp_data
=
output_cmp
.
data
<
T
>
();
// compare
// compare
int
eq
=
0
;
int
eq
=
0
;
...
...
test/operators/test_conv_bn_relu_op.cpp
浏览文件 @
276ec6f9
...
@@ -84,7 +84,7 @@ int TestConvBnReluOp(int in_channels, int in_height, int in_width,
...
@@ -84,7 +84,7 @@ int TestConvBnReluOp(int in_channels, int in_height, int in_width,
attrs
[
"epsilon"
].
Set
<
float
>
(
1e-6
);
attrs
[
"epsilon"
].
Set
<
float
>
(
1e-6
);
attrs
[
"momentum"
].
Set
<
float
>
(
0.
f
);
attrs
[
"momentum"
].
Set
<
float
>
(
0.
f
);
auto
*
op
=
new
operators
::
FusionConvBNReluOp
<
CPU
,
float
>
(
auto
*
op
=
new
operators
::
FusionConvBNReluOp
<
CPU
,
float
>
(
"fusion_conv_bn_relu"
,
inputs
,
outputs
,
attrs
,
scope
);
"fusion_conv_bn_relu"
,
inputs
,
outputs
,
attrs
,
scope
.
get
()
);
op
->
InferShape
();
op
->
InferShape
();
op
->
Init
();
op
->
Init
();
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
...
...
test/operators/test_conv_op.cpp
浏览文件 @
276ec6f9
...
@@ -182,7 +182,7 @@ int TestConvOp(int in_channels, int in_height, int in_width, int out_channels,
...
@@ -182,7 +182,7 @@ int TestConvOp(int in_channels, int in_height, int in_width, int out_channels,
attrs
[
"groups"
].
Set
<
int
>
(
groups
);
attrs
[
"groups"
].
Set
<
int
>
(
groups
);
auto
*
op
=
new
operators
::
ConvOp
<
CPU
,
float
>
(
"conv2d"
,
inputs
,
outputs
,
attrs
,
auto
*
op
=
new
operators
::
ConvOp
<
CPU
,
float
>
(
"conv2d"
,
inputs
,
outputs
,
attrs
,
scope
);
scope
.
get
()
);
op
->
InferShape
();
op
->
InferShape
();
op
->
Init
();
op
->
Init
();
// struct timespec ts_begin, ts_end;
// struct timespec ts_begin, ts_end;
...
...
test/operators/test_dequantize_op.cpp
浏览文件 @
276ec6f9
...
@@ -50,8 +50,8 @@ int TestDequqntizeOp() {
...
@@ -50,8 +50,8 @@ int TestDequqntizeOp() {
framework
::
AttributeMap
attrs
;
framework
::
AttributeMap
attrs
;
attrs
[
"weight_scale"
].
Set
<
float
>
(
1.74
);
attrs
[
"weight_scale"
].
Set
<
float
>
(
1.74
);
auto
*
op
=
new
operators
::
DequantizeOp
<
CPU
,
float
>
(
"dequantize"
,
inputs
,
auto
*
op
=
new
operators
::
DequantizeOp
<
CPU
,
float
>
(
outputs
,
attrs
,
scope
);
"dequantize"
,
inputs
,
outputs
,
attrs
,
scope
.
get
()
);
op
->
InferShape
();
op
->
InferShape
();
op
->
Run
();
op
->
Run
();
auto
output
=
output_var
->
template
Get
<
framework
::
LoDTensor
>();
auto
output
=
output_var
->
template
Get
<
framework
::
LoDTensor
>();
...
...
test/operators/test_dwconv_bn_relu_op.cpp
浏览文件 @
276ec6f9
...
@@ -87,7 +87,7 @@ int TestDWConvAddBnReluOp(int in_channels, int in_height, int in_width,
...
@@ -87,7 +87,7 @@ int TestDWConvAddBnReluOp(int in_channels, int in_height, int in_width,
attrs
[
"momentum"
].
Set
<
float
>
(
0.
f
);
attrs
[
"momentum"
].
Set
<
float
>
(
0.
f
);
auto
*
op
=
new
operators
::
FusionDWConvBNReluOp
<
CPU
,
float
>
(
auto
*
op
=
new
operators
::
FusionDWConvBNReluOp
<
CPU
,
float
>
(
"fusion_dwconv_bn_relu"
,
inputs
,
outputs
,
attrs
,
scope
);
"fusion_dwconv_bn_relu"
,
inputs
,
outputs
,
attrs
,
scope
.
get
()
);
op
->
InferShape
();
op
->
InferShape
();
op
->
Init
();
op
->
Init
();
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
...
...
test/operators/test_elementwise_sub_op.cpp
浏览文件 @
276ec6f9
...
@@ -47,7 +47,7 @@ class TestElementwiseSubOp {
...
@@ -47,7 +47,7 @@ class TestElementwiseSubOp {
std
::
shared_ptr
<
operators
::
ElementwiseSubOp
<
Dtype
,
float
>>
lrn
=
std
::
shared_ptr
<
operators
::
ElementwiseSubOp
<
Dtype
,
float
>>
lrn
=
std
::
make_shared
<
operators
::
ElementwiseSubOp
<
Dtype
,
float
>>
(
std
::
make_shared
<
operators
::
ElementwiseSubOp
<
Dtype
,
float
>>
(
op
->
Type
(),
op
->
GetInputs
(),
op
->
GetOutputs
(),
op
->
Type
(),
op
->
GetInputs
(),
op
->
GetOutputs
(),
op
->
GetAttrMap
(),
program_
.
scope
);
op
->
GetAttrMap
(),
program_
.
scope
.
get
()
);
ops_of_block_
[
*
block_desc
.
get
()].
push_back
(
lrn
);
ops_of_block_
[
*
block_desc
.
get
()].
push_back
(
lrn
);
}
}
}
}
...
@@ -56,7 +56,7 @@ class TestElementwiseSubOp {
...
@@ -56,7 +56,7 @@ class TestElementwiseSubOp {
std
::
shared_ptr
<
Tensor
>
predict_bn
(
const
Tensor
&
t1
,
const
Tensor
&
t2
)
{
std
::
shared_ptr
<
Tensor
>
predict_bn
(
const
Tensor
&
t1
,
const
Tensor
&
t2
)
{
// feed
// feed
auto
scope
=
program_
.
scope
;
auto
scope
=
program_
.
scope
.
get
()
;
Variable
*
x1_feed_value
=
scope
->
Var
(
"tmp_0"
);
Variable
*
x1_feed_value
=
scope
->
Var
(
"tmp_0"
);
auto
tensor_x1
=
x1_feed_value
->
GetMutable
<
LoDTensor
>
();
auto
tensor_x1
=
x1_feed_value
->
GetMutable
<
LoDTensor
>
();
tensor_x1
->
ShareDataWith
(
t1
);
tensor_x1
->
ShareDataWith
(
t1
);
...
...
test/operators/test_fill_constant_op.cpp
浏览文件 @
276ec6f9
...
@@ -47,7 +47,7 @@ class TestFillConstantOp {
...
@@ -47,7 +47,7 @@ class TestFillConstantOp {
std
::
shared_ptr
<
operators
::
FillConstantOp
<
Dtype
,
float
>>
op_ptr
=
std
::
shared_ptr
<
operators
::
FillConstantOp
<
Dtype
,
float
>>
op_ptr
=
std
::
make_shared
<
operators
::
FillConstantOp
<
Dtype
,
float
>>
(
std
::
make_shared
<
operators
::
FillConstantOp
<
Dtype
,
float
>>
(
op
->
Type
(),
op
->
GetInputs
(),
op
->
GetOutputs
(),
op
->
Type
(),
op
->
GetInputs
(),
op
->
GetOutputs
(),
op
->
GetAttrMap
(),
program_
.
scope
);
op
->
GetAttrMap
(),
program_
.
scope
.
get
()
);
ops_of_block_
[
*
block_desc
.
get
()].
push_back
(
op_ptr
);
ops_of_block_
[
*
block_desc
.
get
()].
push_back
(
op_ptr
);
}
}
}
}
...
@@ -55,7 +55,7 @@ class TestFillConstantOp {
...
@@ -55,7 +55,7 @@ class TestFillConstantOp {
}
}
std
::
shared_ptr
<
Tensor
>
predict
()
{
std
::
shared_ptr
<
Tensor
>
predict
()
{
auto
scope
=
program_
.
scope
;
auto
scope
=
program_
.
scope
.
get
()
;
Variable
*
output
=
scope
->
Var
(
output_var_name
);
Variable
*
output
=
scope
->
Var
(
output_var_name
);
auto
*
output_tensor
=
output
->
GetMutable
<
LoDTensor
>
();
auto
*
output_tensor
=
output
->
GetMutable
<
LoDTensor
>
();
...
...
test/operators/test_fusion_fc_op.cpp
浏览文件 @
276ec6f9
...
@@ -103,7 +103,7 @@ int TestFcOP() {
...
@@ -103,7 +103,7 @@ int TestFcOP() {
attrs
[
"axis"
].
Set
<
int
>
(
1
);
attrs
[
"axis"
].
Set
<
int
>
(
1
);
operators
::
OperatorBase
<
CPU
>
*
op
=
nullptr
;
operators
::
OperatorBase
<
CPU
>
*
op
=
nullptr
;
op
=
new
operators
::
FusionFcOp
<
CPU
,
T
>
(
"fusion_fc"
,
inputs
,
outputs
,
attrs
,
op
=
new
operators
::
FusionFcOp
<
CPU
,
T
>
(
"fusion_fc"
,
inputs
,
outputs
,
attrs
,
scope
);
scope
.
get
()
);
op
->
InferShape
();
op
->
InferShape
();
op
->
Run
();
op
->
Run
();
auto
output
=
output_var
->
template
Get
<
framework
::
LoDTensor
>();
auto
output
=
output_var
->
template
Get
<
framework
::
LoDTensor
>();
...
...
test/operators/test_gru_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_im2sequence_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_increment_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_is_empty_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_less_than_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_log_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_logical_and_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_logical_not_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_logical_or_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_logical_xor_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_mul_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_multiclass_nms_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_polygon_box_transform_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_pool_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_prior_box_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_quantize_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_relu6_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_relu_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_reshape2_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_sequence_expand_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_sequence_pool_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_sequence_softmax_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_sigmoid_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_softmax_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_sum_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_tanh_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_topk_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
test/operators/test_transpose2_op.cpp
浏览文件 @
276ec6f9
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录