Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
dab2445d
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
332
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
dab2445d
编写于
10月 23, 2018
作者:
H
hjchen2
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of
https://github.com/PaddlePaddle/paddle-mobile
into dev-latest
上级
d7b691c8
5fa55ac1
变更
16
展开全部
隐藏空白更改
内联
并排
Showing
16 changed file
with
918 addition
and
371 deletion
+918
-371
src/common/types.cpp
src/common/types.cpp
+2
-0
src/fpga/bias_scale.cpp
src/fpga/bias_scale.cpp
+0
-3
src/framework/load_ops.h
src/framework/load_ops.h
+3
-0
src/operators/kernel/arm/polygon_box_transform_kernel.cpp
src/operators/kernel/arm/polygon_box_transform_kernel.cpp
+38
-0
src/operators/kernel/central-arm-func/polygon_box_transform_arm_func.h
.../kernel/central-arm-func/polygon_box_transform_arm_func.h
+53
-0
src/operators/kernel/polygon_box_transform_kernel.h
src/operators/kernel/polygon_box_transform_kernel.h
+36
-0
src/operators/math/gemm.cpp
src/operators/math/gemm.cpp
+1
-1
src/operators/math/gemm.h
src/operators/math/gemm.h
+6
-0
src/operators/math/gemm_int8.cpp
src/operators/math/gemm_int8.cpp
+517
-366
src/operators/op_param.h
src/operators/op_param.h
+26
-0
src/operators/polygon_box_transform_op.cpp
src/operators/polygon_box_transform_op.cpp
+45
-0
src/operators/polygon_box_transform_op.h
src/operators/polygon_box_transform_op.h
+56
-0
test/CMakeLists.txt
test/CMakeLists.txt
+4
-0
test/operators/test_mul_op.cpp
test/operators/test_mul_op.cpp
+0
-1
test/operators/test_polygon_box_transform_op.cpp
test/operators/test_polygon_box_transform_op.cpp
+126
-0
tools/op.cmake
tools/op.cmake
+5
-0
未找到文件。
src/common/types.cpp
浏览文件 @
dab2445d
...
...
@@ -34,6 +34,7 @@ const char *G_OP_TYPE_FUSION_CONV_ADD = "fusion_conv_add";
const
char
*
G_OP_TYPE_LRN
=
"lrn"
;
const
char
*
G_OP_TYPE_MUL
=
"mul"
;
const
char
*
G_OP_TYPE_MULTICLASS_NMS
=
"multiclass_nms"
;
const
char
*
G_OP_TYPE_POLYGON_BOX_TRANSFORM
=
"polygon_box_transform"
;
const
char
*
G_OP_TYPE_POOL2D
=
"pool2d"
;
const
char
*
G_OP_TYPE_PRIOR_BOX
=
"prior_box"
;
const
char
*
G_OP_TYPE_RELU
=
"relu"
;
...
...
@@ -94,6 +95,7 @@ std::unordered_map<
{
G_OP_TYPE_FUSION_CONV_BN_ADD_RELU
,
{{
"Input"
},
{
"Out"
}}},
{
G_OP_TYPE_PRIOR_BOX
,
{{
"Image"
,
"Input"
},
{
"Boxes"
,
"Variances"
}}},
{
G_OP_TYPE_MULTICLASS_NMS
,
{{
"BBoxes"
,
"Scores"
},
{
"Out"
}}},
{
G_OP_TYPE_POLYGON_BOX_TRANSFORM
,
{{
"Input"
},
{
"Output"
}}},
{
G_OP_TYPE_FC
,
{{
"X"
,
"Y"
,
"Z"
},
{
"Out"
}}},
{
G_OP_TYPE_RESHAPE
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_DEPTHWISE_CONV
,
{{
"Input"
},
{
"Output"
}}},
...
...
src/fpga/bias_scale.cpp
浏览文件 @
dab2445d
...
...
@@ -27,9 +27,6 @@ void align_element(float **data_in, int num_per_div_before_alignment, int num) {
(
num
+
num_per_div_before_alignment
-
1
)
/
num_per_div_before_alignment
;
int
num_per_div_after_alignment
=
align_to_x
(
num_per_div_before_alignment
,
BS_NUM_ALIGNMENT
);
if
(
num_per_div_before_alignment
==
num_per_div_after_alignment
)
{
return
;
}
int
num_element
=
2
*
div_num
*
num_per_div_after_alignment
;
// including bias & scale
float
*
ptr_aligned
=
...
...
src/framework/load_ops.h
浏览文件 @
dab2445d
...
...
@@ -199,6 +199,9 @@ LOAD_OP3(pool2d, CPU, MALI_GPU, FPGA);
#ifdef MULTICLASSNMS_OP
LOAD_OP1
(
multiclass_nms
,
CPU
);
#endif
#ifdef POLYGONBOXTRANSFORM_OP
LOAD_OP1
(
polygon_box_transform
,
CPU
);
#endif
#ifdef SUM_OP
LOAD_OP1
(
sum
,
CPU
);
#endif
...
...
src/operators/kernel/arm/polygon_box_transform_kernel.cpp
0 → 100644
浏览文件 @
dab2445d
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#ifdef POLYGONBOXTRANSFORM_OP
#include "operators/kernel/polygon_box_transform_kernel.h"
#include "operators/kernel/central-arm-func/polygon_box_transform_arm_func.h"
namespace
paddle_mobile
{
namespace
operators
{
template
<
>
bool
PolygonBoxTransformKernel
<
CPU
,
float
>::
Init
(
PolygonBoxTransformParam
<
CPU
>
*
param
)
{
return
true
;
}
template
<
>
void
PolygonBoxTransformKernel
<
CPU
,
float
>::
Compute
(
const
PolygonBoxTransformParam
<
CPU
>
&
param
)
const
{
PolygonBoxTransformCompute
<
float
>
(
param
);
}
}
// namespace operators
}
// namespace paddle_mobile
#endif
src/operators/kernel/central-arm-func/polygon_box_transform_arm_func.h
0 → 100644
浏览文件 @
dab2445d
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#ifdef POLYGONBOXTRANSFORM_OP
#pragma once
#include "operators/op_param.h"
namespace
paddle_mobile
{
namespace
operators
{
template
<
typename
P
>
void
PolygonBoxTransformCompute
(
const
PolygonBoxTransformParam
<
CPU
>&
param
)
{
const
auto
*
input
=
param
.
Input
();
const
auto
&
input_dims
=
input
->
dims
();
const
auto
*
input_data
=
input
->
data
<
float
>
();
auto
*
output
=
param
.
Output
();
auto
*
output_data
=
output
->
mutable_data
<
float
>
();
int64_t
batch_size
=
input_dims
[
0
];
int64_t
geo_channel
=
input_dims
[
1
];
int64_t
height
=
input_dims
[
2
];
int64_t
width
=
input_dims
[
3
];
int64_t
id
=
0
;
for
(
int64_t
id_n
=
0
;
id_n
<
batch_size
*
geo_channel
;
++
id_n
)
{
for
(
int64_t
id_h
=
0
;
id_h
<
height
;
++
id_h
)
{
for
(
int64_t
id_w
=
0
;
id_w
<
width
;
++
id_w
)
{
id
=
id_n
*
height
*
width
+
width
*
id_h
+
id_w
;
if
(
id_n
%
2
==
0
)
{
output_data
[
id
]
=
id_w
*
4
-
input_data
[
id
];
}
else
{
output_data
[
id
]
=
id_h
*
4
-
input_data
[
id
];
}
}
}
}
}
}
// namespace operators
}
// namespace paddle_mobile
#endif
src/operators/kernel/polygon_box_transform_kernel.h
0 → 100644
浏览文件 @
dab2445d
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#ifdef POLYGONBOXTRANSFORM_OP
#pragma once
#include "framework/operator.h"
#include "operators/op_param.h"
namespace
paddle_mobile
{
namespace
operators
{
template
<
typename
DeviceType
,
typename
T
>
class
PolygonBoxTransformKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
PolygonBoxTransformParam
<
DeviceType
>>
{
public:
void
Compute
(
const
PolygonBoxTransformParam
<
DeviceType
>&
param
)
const
;
bool
Init
(
PolygonBoxTransformParam
<
DeviceType
>*
param
);
};
}
// namespace operators
}
// namespace paddle_mobile
#endif
src/operators/math/gemm.cpp
浏览文件 @
dab2445d
...
...
@@ -3379,7 +3379,7 @@ void Gemm::SgemmWithBn_omp(int m, int n, int k, float alpha, const float *A,
// 对 B 分块
NC
=
L1
/
(
KC
*
sizeof
(
float
));
if
(
NC
==
0
)
{
NC
=
=
NR
;
NC
=
NR
;
}
else
{
int
nblock_num
=
(
n
+
NC
-
1
)
/
NC
;
NC
=
(
n
+
nblock_num
-
1
)
/
nblock_num
;
...
...
src/operators/math/gemm.h
浏览文件 @
dab2445d
...
...
@@ -22,9 +22,11 @@ limitations under the License. */
#define C(i, j) C[(i)*ldc + (j)]
#if __aarch64__
#define MR_INT8 4
#define MR 6
#define NR 16
#else
#define MR_INT8 4
#define MR 6
#define NR 8
#endif
...
...
@@ -189,6 +191,8 @@ void PackMatrixB(int k, int n, int n_tail, const float *B, int ldb,
// 8 bits function cluster begins
// 8 bits int small block inner product
void
AddDot4x8
(
int32_t
k
,
const
int8_t
*
a
,
const
int8_t
*
b
,
int32_t
*
c
,
int32_t
ldc
);
void
AddDot6x8
(
int32_t
k
,
const
int8_t
*
a
,
const
int8_t
*
b
,
int32_t
*
c
,
int32_t
ldc
);
...
...
@@ -199,6 +203,8 @@ void PackMatrixB(int k, int n, int n_tail, const float *B, int ldb,
int8_t
*
bias
);
// 8 bits int pack function
void
PackMatrixA_4r
(
int32_t
m
,
int32_t
k
,
int32_t
m_tail
,
const
int8_t
*
A
,
int32_t
lda
,
int8_t
*
buffer
);
void
PackMatrixA_6r
(
int32_t
m
,
int32_t
k
,
int32_t
m_tail
,
const
int8_t
*
A
,
int32_t
lda
,
int8_t
*
buffer
);
void
PackMatrixB_8c
(
int32_t
k
,
int32_t
n
,
int32_t
n_tail
,
const
int8_t
*
B
,
...
...
src/operators/math/gemm_int8.cpp
浏览文件 @
dab2445d
此差异已折叠。
点击以展开。
src/operators/op_param.h
浏览文件 @
dab2445d
...
...
@@ -999,6 +999,28 @@ class MultiClassNMSParam : public OpParam {
};
#endif
#ifdef POLYGONBOXTRANSFORM_OP
template
<
typename
Dtype
>
class
PolygonBoxTransformParam
:
public
OpParam
{
typedef
typename
DtypeTensorTrait
<
Dtype
>::
gtype
GType
;
typedef
typename
DtypeTensorTrait
<
Dtype
>::
rtype
RType
;
public:
PolygonBoxTransformParam
(
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
Scope
&
scope
)
{
input_
=
InputFrom
<
GType
>
(
inputs
,
scope
);
output_
=
OutputFrom
<
GType
>
(
outputs
,
scope
);
}
const
RType
*
Input
()
const
{
return
input_
;
}
RType
*
Output
()
const
{
return
output_
;
}
private:
RType
*
input_
;
RType
*
output_
;
};
#endif
template
<
typename
Dtype
>
class
FeedParam
:
public
OpParam
{
typedef
typename
DtypeTensorTrait
<
Dtype
>::
gtype
GType
;
...
...
@@ -2272,6 +2294,7 @@ class ShapeParam : public OpParam {
};
#endif
#ifdef QUANT_OP
template
<
typename
Dtype
>
class
QuantizeParam
:
public
OpParam
{
typedef
typename
DtypeTensorTrait
<
Dtype
>::
gtype
GType
;
...
...
@@ -2311,7 +2334,9 @@ class QuantizeParam : public OpParam {
// nearest_zero and nearest_even is valid currently
RoundType
round_type_
=
ROUND_NEAREST_AWAY_ZERO
;
};
#endif
#ifdef DEQUANT_OP
template
<
typename
Dtype
>
class
DequantizeParam
:
public
OpParam
{
typedef
typename
DtypeTensorTrait
<
Dtype
>::
gtype
GType
;
...
...
@@ -2339,6 +2364,7 @@ class DequantizeParam : public OpParam {
RType
*
activation_scale_
;
float
weight_scale_
;
};
#endif
}
// namespace operators
}
// namespace paddle_mobile
src/operators/polygon_box_transform_op.cpp
0 → 100644
浏览文件 @
dab2445d
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#ifdef POLYGONBOXTRANSFORM_OP
#include "operators/polygon_box_transform_op.h"
namespace
paddle_mobile
{
namespace
operators
{
template
<
typename
Dtype
,
typename
T
>
void
PolygonBoxTransformOp
<
Dtype
,
T
>::
InferShape
()
const
{
PADDLE_MOBILE_ENFORCE
(
this
->
param_
.
Input
()
!=
nullptr
,
"Input (Input) of get_shape op should not be null."
);
PADDLE_MOBILE_ENFORCE
(
this
->
param_
.
Output
()
!=
nullptr
,
"Output (Output) of get_shape op should not be null."
);
auto
input_dims
=
this
->
param_
.
Input
()
->
dims
();
PADDLE_MOBILE_ENFORCE
(
input_dims
.
size
()
==
4
,
"input's rank must be 4."
);
PADDLE_MOBILE_ENFORCE
(
input_dims
[
1
]
%
2
==
0
,
"input's second dimension must be even."
);
this
->
param_
.
Output
()
->
Resize
(
input_dims
);
}
}
// namespace operators
}
// namespace paddle_mobile
namespace
ops
=
paddle_mobile
::
operators
;
#ifdef PADDLE_MOBILE_CPU
REGISTER_OPERATOR_CPU
(
polygon_box_transform
,
ops
::
PolygonBoxTransformOp
);
#endif
#endif
src/operators/polygon_box_transform_op.h
0 → 100644
浏览文件 @
dab2445d
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#ifdef POLYGONBOXTRANSFORM_OP
#pragma once
#include <string>
#include "framework/operator.h"
#include "operators/kernel/polygon_box_transform_kernel.h"
#include "operators/op_param.h"
namespace
paddle_mobile
{
namespace
operators
{
using
paddle_mobile
::
framework
::
Tensor
;
template
<
typename
DeviceType
,
typename
T
>
class
PolygonBoxTransformOp
:
public
framework
::
OperatorWithKernel
<
DeviceType
,
PolygonBoxTransformParam
<
DeviceType
>
,
operators
::
PolygonBoxTransformKernel
<
DeviceType
,
T
>>
{
public:
PolygonBoxTransformOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
,
PolygonBoxTransformParam
<
DeviceType
>
,
operators
::
PolygonBoxTransformKernel
<
DeviceType
,
T
>>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
using
framework
::
OperatorWithKernel
<
DeviceType
,
PolygonBoxTransformParam
<
DeviceType
>
,
operators
::
PolygonBoxTransformKernel
<
DeviceType
,
T
>>::
OperatorWithKernel
;
void
InferShape
()
const
override
;
protected:
};
}
// namespace operators
}
// namespace paddle_mobile
#endif
test/CMakeLists.txt
浏览文件 @
dab2445d
...
...
@@ -181,6 +181,10 @@ if (NOT FOUND_MATCH)
ADD_EXECUTABLE
(
test-multiclassnms-op operators/test_multiclass_nms_op.cpp test_helper.h test_include.h
)
target_link_libraries
(
test-multiclassnms-op paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-polygon-box-transform-op operators/test_polygon_box_transform_op.cpp test_helper.h test_include.h
)
target_link_libraries
(
test-polygon-box-transform-op paddle-mobile
)
# gen test
ADD_EXECUTABLE
(
test-reshape-op operators/test_reshape_op.cpp test_helper.h test_include.h
)
target_link_libraries
(
test-reshape-op paddle-mobile
)
...
...
test/operators/test_mul_op.cpp
浏览文件 @
dab2445d
...
...
@@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include <stdint-gcc.h>
#include "../test_helper.h"
#include "../test_include.h"
#include "operators/mul_op.h"
...
...
test/operators/test_polygon_box_transform_op.cpp
0 → 100644
浏览文件 @
dab2445d
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#pragma once
#include "../test_include.h"
#include "operators/polygon_box_transform_op.h"
namespace
paddle_mobile
{
namespace
framework
{
template
<
typename
Dtype
>
class
TestPolygonBoxTransformOp
{
public:
explicit
TestPolygonBoxTransformOp
(
const
Program
<
Dtype
>
p
)
:
program_
(
p
)
{
if
(
use_optimize_
)
{
to_predict_program_
=
program_
.
optimizeProgram
;
}
else
{
to_predict_program_
=
program_
.
originProgram
;
}
const
std
::
vector
<
std
::
shared_ptr
<
BlockDesc
>>
blocks
=
to_predict_program_
->
Blocks
();
for
(
auto
block_desc
:
blocks
)
{
std
::
vector
<
std
::
shared_ptr
<
OpDesc
>>
ops
=
block_desc
->
Ops
();
for
(
auto
op
:
ops
)
{
if
(
op
->
Type
()
==
"polygon_box_transform"
)
{
DLOG
<<
" attr size: "
<<
op
->
GetAttrMap
().
size
();
DLOG
<<
" inputs size: "
<<
op
->
GetInputs
().
size
();
DLOG
<<
" input is : "
<<
op
->
Input
(
"Input"
)[
0
];
input_var_name
=
op
->
Input
(
"Input"
)[
0
];
DLOG
<<
" outputs size: "
<<
op
->
GetOutputs
().
size
();
DLOG
<<
" output is : "
<<
op
->
Output
(
"Output"
)[
0
];
output_var_name
=
op
->
Output
(
"Output"
)[
0
];
std
::
shared_ptr
<
operators
::
PolygonBoxTransformOp
<
Dtype
,
float
>>
op_ptr
=
std
::
make_shared
<
operators
::
PolygonBoxTransformOp
<
Dtype
,
float
>>
(
op
->
Type
(),
op
->
GetInputs
(),
op
->
GetOutputs
(),
op
->
GetAttrMap
(),
program_
.
scope
);
ops_of_block_
[
*
block_desc
.
get
()].
push_back
(
op_ptr
);
return
;
}
}
}
}
std
::
shared_ptr
<
Tensor
>
predict
(
const
Tensor
&
t
)
{
auto
scope
=
program_
.
scope
;
Variable
*
input_feed_value
=
scope
->
Var
(
input_var_name
);
auto
tensor_input
=
input_feed_value
->
GetMutable
<
LoDTensor
>
();
tensor_input
->
ShareDataWith
(
t
);
Variable
*
output
=
scope
->
Var
(
output_var_name
);
auto
*
output_tensor
=
output
->
GetMutable
<
LoDTensor
>
();
std
::
shared_ptr
<
Tensor
>
out_tensor
=
std
::
make_shared
<
LoDTensor
>
();
out_tensor
.
reset
(
output_tensor
);
predict
(
t
,
0
);
return
out_tensor
;
}
private:
const
framework
::
Program
<
Dtype
>
program_
;
std
::
shared_ptr
<
ProgramDesc
>
to_predict_program_
;
std
::
map
<
framework
::
BlockDesc
,
std
::
vector
<
std
::
shared_ptr
<
OperatorBase
<
Dtype
>>>>
ops_of_block_
;
bool
use_optimize_
=
false
;
string
input_var_name
;
string
output_var_name
;
void
predict
(
const
Tensor
&
t
,
int
block_id
)
{
std
::
shared_ptr
<
BlockDesc
>
to_predict_block
=
to_predict_program_
->
Block
(
block_id
);
for
(
int
j
=
0
;
j
<
ops_of_block_
[
*
to_predict_block
.
get
()].
size
();
++
j
)
{
auto
op
=
ops_of_block_
[
*
to_predict_block
.
get
()][
j
];
op
->
Run
();
}
}
};
template
class
TestPolygonBoxTransformOp
<
CPU
>;
}
// namespace framework
}
// namespace paddle_mobile
int
main
()
{
DLOG
<<
"----------**********----------"
;
DLOG
<<
"begin to run PolygonBoxTransform Test"
;
paddle_mobile
::
Loader
<
paddle_mobile
::
CPU
>
loader
;
auto
program
=
loader
.
Load
(
std
::
string
(
g_ocr
));
paddle_mobile
::
framework
::
Tensor
input
;
SetupTensor
<
float
>
(
&
input
,
{
1
,
8
,
1
,
2
},
static_cast
<
float
>
(
0
),
static_cast
<
float
>
(
1
));
auto
*
input_ptr
=
input
.
data
<
float
>
();
for
(
int
i
=
0
;
i
<
16
;
++
i
)
{
*
(
input_ptr
+
i
)
=
i
;
}
DLOG
<<
"input : "
;
for
(
int
i
=
0
;
i
<
input
.
numel
();
++
i
)
{
DLOG
<<
" index "
<<
i
<<
" : "
<<
input_ptr
[
i
];
}
paddle_mobile
::
framework
::
TestPolygonBoxTransformOp
<
paddle_mobile
::
CPU
>
testPolygonBoxTransformOp
(
program
);
auto
output
=
testPolygonBoxTransformOp
.
predict
(
input
);
auto
*
output_ptr
=
output
->
data
<
float
>
();
DLOG
<<
"output : "
;
for
(
int
i
=
0
;
i
<
output
->
numel
();
++
i
)
{
DLOG
<<
" index "
<<
i
<<
" : "
<<
output_ptr
[
i
];
}
return
0
;
}
tools/op.cmake
浏览文件 @
dab2445d
...
...
@@ -195,6 +195,7 @@ if(NOT FOUND_MATCH)
set
(
LRN_OP ON
)
set
(
MUL_OP ON
)
set
(
MULTICLASSNMS_OP ON
)
set
(
POLYGONBOXTRANSFORM_OP ON
)
set
(
POOL_OP ON
)
set
(
PRIORBOX_OP ON
)
set
(
RELU_OP ON
)
...
...
@@ -238,6 +239,7 @@ endif()
# option(LRN_OP "" ON)
# option(MUL_OP "" ON)
# option(MULTICLASSNMS_OP "" ON)
# option(POLYGONBOXTRANSFORM_OP "" ON)
# option(POOL_OP "" ON)
# option(PRIORBOX_OP "" ON)
# option(RELU_OP "" ON)
...
...
@@ -292,6 +294,9 @@ endif()
if
(
MULTICLASSNMS_OP
)
add_definitions
(
-DMULTICLASSNMS_OP
)
endif
()
if
(
POLYGONBOXTRANSFORM_OP
)
add_definitions
(
-DPOLYGONBOXTRANSFORM_OP
)
endif
()
if
(
POOL_OP
)
add_definitions
(
-DPOOL_OP
)
endif
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录