Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
a256d413
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a256d413
编写于
5月 26, 2018
作者:
Z
zhaojiaying01
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update op registry
上级
fbd23d7f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
21 deletion
+18
-21
src/framework/op_info.h
src/framework/op_info.h
+5
-11
src/framework/op_registry.h
src/framework/op_registry.h
+5
-5
src/operators/math/softmax.cpp
src/operators/math/softmax.cpp
+0
-1
test/executor_for_test.h
test/executor_for_test.h
+8
-4
未找到文件。
src/framework/op_info.h
浏览文件 @
a256d413
...
@@ -33,21 +33,15 @@ struct OpInfo {
...
@@ -33,21 +33,15 @@ struct OpInfo {
}
}
};
};
template
<
typename
Dtype
>
class
OpInfoMap
;
template
<
typename
Dtype
>
static
OpInfoMap
<
Dtype
>
*
g_op_info_map
=
nullptr
;
template
<
typename
Dtype
>
template
<
typename
Dtype
>
class
OpInfoMap
{
class
OpInfoMap
{
public:
public:
static
OpInfoMap
&
Instance
()
{
static
OpInfoMap
<
Dtype
>
*
Instance
()
{
LOG
(
paddle_mobile
::
kLOG_DEBUG1
)
<<
" TODO: fix bug"
;
static
OpInfoMap
<
Dtype
>
*
s_instance
=
nullptr
;
if
(
g_op_info_map
<
Dtype
>
==
nullptr
)
{
if
(
s_instance
==
nullptr
)
{
g_op_info_map
<
Dtype
>
=
new
OpInfoMap
();
s_instance
=
new
OpInfoMap
();
}
}
return
*
g_op_info_map
<
Dtype
>
;
return
s_instance
;
}
}
bool
Has
(
const
std
::
string
&
op_type
)
const
{
bool
Has
(
const
std
::
string
&
op_type
)
const
{
...
...
src/framework/op_registry.h
浏览文件 @
a256d413
...
@@ -35,7 +35,7 @@ class OperatorRegistrarRecursive;
...
@@ -35,7 +35,7 @@ class OperatorRegistrarRecursive;
template
<
typename
Dtype
,
typename
...
ARGS
>
template
<
typename
Dtype
,
typename
...
ARGS
>
struct
OperatorRegistrar
:
public
Registrar
{
struct
OperatorRegistrar
:
public
Registrar
{
explicit
OperatorRegistrar
(
const
std
::
string
&
op_type
)
{
explicit
OperatorRegistrar
(
const
std
::
string
&
op_type
)
{
if
(
OpInfoMap
<
Dtype
>::
Instance
()
.
Has
(
op_type
))
{
if
(
OpInfoMap
<
Dtype
>::
Instance
()
->
Has
(
op_type
))
{
LOG
(
paddle_mobile
::
kLOG_DEBUG1
)
LOG
(
paddle_mobile
::
kLOG_DEBUG1
)
<<
op_type
<<
" is registered more than once."
;
<<
op_type
<<
" is registered more than once."
;
return
;
return
;
...
@@ -47,7 +47,7 @@ struct OperatorRegistrar : public Registrar {
...
@@ -47,7 +47,7 @@ struct OperatorRegistrar : public Registrar {
}
}
OpInfo
<
Dtype
>
info
;
OpInfo
<
Dtype
>
info
;
OperatorRegistrarRecursive
<
Dtype
,
0
,
false
,
ARGS
...
>
(
op_type
,
&
info
);
OperatorRegistrarRecursive
<
Dtype
,
0
,
false
,
ARGS
...
>
(
op_type
,
&
info
);
OpInfoMap
<
Dtype
>::
Instance
()
.
Insert
(
op_type
,
info
);
OpInfoMap
<
Dtype
>::
Instance
()
->
Insert
(
op_type
,
info
);
}
}
};
};
...
@@ -95,10 +95,10 @@ class OpRegistry {
...
@@ -95,10 +95,10 @@ class OpRegistry {
LOG
(
paddle_mobile
::
kLOG_DEBUG1
)
<<
" output size: "
<<
outputs
.
size
();
LOG
(
paddle_mobile
::
kLOG_DEBUG1
)
<<
" output size: "
<<
outputs
.
size
();
LOG
(
paddle_mobile
::
kLOG_DEBUG1
)
<<
" attr size: "
<<
attrs
.
size
();
LOG
(
paddle_mobile
::
kLOG_DEBUG1
)
<<
" attr size: "
<<
attrs
.
size
();
LOG
(
paddle_mobile
::
kLOG_DEBUG1
)
LOG
(
paddle_mobile
::
kLOG_DEBUG1
)
<<
" OpInfoMap size: "
<<
OpInfoMap
<
Dtype
>::
Instance
()
.
map
().
size
();
<<
" OpInfoMap size: "
<<
OpInfoMap
<
Dtype
>::
Instance
()
->
map
().
size
();
LOG
(
paddle_mobile
::
kLOG_DEBUG1
)
<<
" has type: "
<<
type
<<
" "
LOG
(
paddle_mobile
::
kLOG_DEBUG1
)
<<
" has type: "
<<
type
<<
" "
<<
OpInfoMap
<
Dtype
>::
Instance
()
.
Has
(
type
);
<<
OpInfoMap
<
Dtype
>::
Instance
()
->
Has
(
type
);
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/operators/math/softmax.cpp
浏览文件 @
a256d413
...
@@ -11,7 +11,6 @@ distributed under the License is distributed on an "AS IS" BASIS,
...
@@ -11,7 +11,6 @@ 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. */
#define __ARM_NEON true
#include "operators/math/softmax.h"
#include "operators/math/softmax.h"
#include "common/types.h"
#include "common/types.h"
#if __ARM_NEON
#if __ARM_NEON
...
...
test/executor_for_test.h
浏览文件 @
a256d413
...
@@ -17,8 +17,9 @@ limitations under the License. */
...
@@ -17,8 +17,9 @@ limitations under the License. */
#include <string>
#include <string>
#include <vector>
#include <vector>
#include "./io.h"
#include "common/log.h"
#include "common/log.h"
#include "
io
.h"
#include "
framework/op_registry
.h"
#include "operators/conv_op.h"
#include "operators/conv_op.h"
#include "operators/pool_op.h"
#include "operators/pool_op.h"
#include "operators/reshape_op.h"
#include "operators/reshape_op.h"
...
@@ -57,9 +58,12 @@ class Executor4Test : public Executor<DeviceType> {
...
@@ -57,9 +58,12 @@ class Executor4Test : public Executor<DeviceType> {
std
::
vector
<
std
::
shared_ptr
<
OpDesc
>>
ops
=
block_desc
->
Ops
();
std
::
vector
<
std
::
shared_ptr
<
OpDesc
>>
ops
=
block_desc
->
Ops
();
for
(
std
::
shared_ptr
<
OpDesc
>
op
:
ops
)
{
for
(
std
::
shared_ptr
<
OpDesc
>
op
:
ops
)
{
if
(
op
->
Type
()
==
op_type
)
{
if
(
op
->
Type
()
==
op_type
)
{
std
::
shared_ptr
<
OpType
>
op_ptr
=
std
::
make_shared
<
OpType
>
(
std
::
shared_ptr
<
paddle_mobile
::
framework
::
OperatorBase
<
DeviceType
>>
op
->
Type
(),
op
->
GetInputs
(),
op
->
GetOutputs
(),
op
->
GetAttrMap
(),
op_ptr
=
paddle_mobile
::
framework
::
OpRegistry
<
this
->
program_
.
scope
);
paddle_mobile
::
CPU
>::
CreateOp
(
op
->
Type
(),
op
->
GetInputs
(),
op
->
GetOutputs
(),
op
->
GetAttrMap
(),
this
->
program_
.
scope
);
this
->
ops_of_block_
[
*
block_desc
.
get
()].
push_back
(
op_ptr
);
this
->
ops_of_block_
[
*
block_desc
.
get
()].
push_back
(
op_ptr
);
break
;
break
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录