Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
1d2db85e
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看板
提交
1d2db85e
编写于
5月 17, 2018
作者:
E
eclipsycn
提交者:
GitHub
5月 17, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into develop
上级
aeb856fc
fc7b380e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
68 deletion
+28
-68
src/framework/operator.cpp
src/framework/operator.cpp
+0
-3
src/framework/operator.h
src/framework/operator.h
+25
-60
src/framework/variable.h
src/framework/variable.h
+0
-3
src/operators/conv_op.h
src/operators/conv_op.h
+3
-2
未找到文件。
src/framework/operator.cpp
浏览文件 @
1d2db85e
...
...
@@ -32,9 +32,6 @@ namespace paddle_mobile {
scope_
(
scope
)
{
CheckAllInputOutputSet
();
}
template
<
typename
Dtype
>
void
OperatorBase
<
Dtype
>::
Run
()
{
RunImpl
();
}
template
<
typename
Dtype
>
void
OperatorBase
<
Dtype
>::
CheckAllInputOutputSet
()
const
{}
...
...
src/framework/operator.h
浏览文件 @
1d2db85e
...
...
@@ -18,72 +18,37 @@ SOFTWARE.
#pragma once
#include <map>
#include "attribute.h"
#include "block_desc.h"
#include "common/type_define.h"
#include "common/types.h"
#include "common/variant.h"
#include "op_info.h"
#include "op_kernel_type.h"
#include "paddle_mobile_object.h"
#include "scope.h"
#include "tensor.h"
#include "variable.h"
#include "framework/operator.h"
#include "operators/kernel/pool_kernel.h"
namespace
paddle_mobile
{
namespace
framework
{
template
<
typename
Dtype
>
class
OperatorBase
:
PaddleMobileObject
{
public:
OperatorBase
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
std
::
shared_ptr
<
Scope
>
scope
);
virtual
~
OperatorBase
()
{}
virtual
void
Run
();
const
VariableNameMap
&
Inputs
()
const
{
return
inputs_
;
}
const
VariableNameMap
&
Outputs
()
const
{
return
outputs_
;
}
const
std
::
string
&
Type
()
const
{
return
type_
;
}
const
AttributeMap
&
Attrs
()
const
{
return
attrs_
;
}
namespace
operators
{
protected:
std
::
shared_ptr
<
Scope
>
scope_
;
std
::
string
type_
;
VariableNameMap
inputs_
;
VariableNameMap
outputs_
;
AttributeMap
attrs_
;
private:
void
CheckAllInputOutputSet
()
const
;
virtual
void
RunImpl
()
const
=
0
;
};
using
namespace
framework
;
template
<
typename
D
type
>
class
OperatorWithKernel
:
public
OperatorBase
<
Dt
ype
>
{
template
<
typename
D
eviceType
,
typename
T
>
class
ConvOp
:
public
framework
::
OperatorWithKernel
<
DeviceT
ype
>
{
public:
OperatorWithKernel
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
std
::
shared_ptr
<
Scope
>
scope
)
:
OperatorBase
<
Dtype
>
(
type
,
inputs
,
outputs
,
attrs
,
scope
)
{}
virtual
void
InferShape
()
const
=
0
;
protected:
virtual
void
RunImpl
()
const
=
0
;
ConvOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
>
(
type
,
inputs
,
outputs
,
attrs
,
scope
),
param_
(
inputs
,
outputs
,
attrs
,
*
scope
)
{}
using
framework
::
OperatorWithKernel
<
DeviceType
>::
OperatorWithKernel
;
void
InferShape
()
const
override
;
void
Run
()
const
{
operators
::
ConvKernel
<
DeviceType
,
T
,
ConvParam
>
kernel
;
kernel
.
Compute
(
param_
);
this
->
ClearVariables
();
}
private:
ConvParam
param_
;
};
template
<
typename
Dtype
,
typename
P
>
class
OpKernelBase
:
PaddleMobileObject
{
public:
virtual
void
Compute
(
const
P
&
para
)
const
=
0
;
virtual
~
OpKernelBase
()
=
default
;
};
}
// namespace framework
}
// namespace paddle_mobile
}
// operators
}
// paddle_mobile
src/framework/variable.h
浏览文件 @
1d2db85e
...
...
@@ -29,9 +29,6 @@ namespace paddle_mobile {
namespace
framework
{
class
Variable
:
public
PaddleMobileObject
{
public:
Variable
()
{}
~
Variable
()
{}
template
<
typename
T
>
const
T
*
Get
()
const
{
return
static_cast
<
const
T
*>
(
holder_
->
Ptr
());
}
...
...
src/operators/conv_op.h
浏览文件 @
1d2db85e
...
...
@@ -40,12 +40,13 @@ namespace paddle_mobile {
using
framework
::
OperatorWithKernel
<
DeviceType
>::
OperatorWithKernel
;
void
InferShape
()
const
override
;
protected:
void
RunImpl
()
const
{
void
Run
()
const
{
operators
::
ConvKernel
<
DeviceType
,
T
,
ConvParam
>
kernel
;
kernel
.
Compute
(
param_
);
this
->
ClearVariables
();
}
private:
ConvParam
param_
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录