Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
094623ee
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看板
提交
094623ee
编写于
7月 02, 2018
作者:
Y
Yao,kun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add op init
上级
9b60c8ee
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
48 addition
and
17 deletion
+48
-17
src/operators/dropout_op.cpp
src/operators/dropout_op.cpp
+9
-0
src/operators/dropout_op.h
src/operators/dropout_op.h
+9
-8
src/operators/im2sequence_op.cpp
src/operators/im2sequence_op.cpp
+10
-0
src/operators/im2sequence_op.h
src/operators/im2sequence_op.h
+8
-9
src/operators/kernel/arm/dropout_kernel.cpp
src/operators/kernel/arm/dropout_kernel.cpp
+5
-0
src/operators/kernel/arm/im2sequence_kernel.cpp
src/operators/kernel/arm/im2sequence_kernel.cpp
+5
-0
src/operators/kernel/dropout_kernel.h
src/operators/kernel/dropout_kernel.h
+1
-0
src/operators/kernel/im2sequence_kernel.h
src/operators/kernel/im2sequence_kernel.h
+1
-0
未找到文件。
src/operators/dropout_op.cpp
浏览文件 @
094623ee
...
@@ -12,6 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
@@ -12,6 +12,7 @@ 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. */
#ifdef DROPOUT_OP
#include "operators/dropout_op.h"
#include "operators/dropout_op.h"
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
...
@@ -26,5 +27,13 @@ template class DropoutOp<CPU, float>;
...
@@ -26,5 +27,13 @@ template class DropoutOp<CPU, float>;
}
// namespace paddle_mobile
}
// namespace paddle_mobile
namespace
ops
=
paddle_mobile
::
operators
;
namespace
ops
=
paddle_mobile
::
operators
;
#ifdef PADDLE_MOBILE_CPU
USE_OP
(
Dropout
);
USE_OP
(
Dropout
);
REGISTER_OPERATOR
(
dropout
,
ops
::
DropoutOp
);
REGISTER_OPERATOR
(
dropout
,
ops
::
DropoutOp
);
#endif
#ifdef PADDLE_MOBILE_MALI_GPU
#endif
#ifdef PADDLE_MOBILE_FPGA
#endif
#endif
src/operators/dropout_op.h
浏览文件 @
094623ee
...
@@ -12,6 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
@@ -12,6 +12,8 @@ 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. */
#ifdef DROPOUT_OP
#pragma once
#pragma once
#include <string>
#include <string>
...
@@ -26,7 +28,8 @@ namespace operators {
...
@@ -26,7 +28,8 @@ namespace operators {
using
paddle_mobile
::
framework
::
Tensor
;
using
paddle_mobile
::
framework
::
Tensor
;
template
<
typename
DeviceType
,
typename
T
>
template
<
typename
DeviceType
,
typename
T
>
class
DropoutOp
:
public
framework
::
OperatorWithKernel
<
DeviceType
>
{
class
DropoutOp
:
public
framework
::
OperatorWithKernel
<
DeviceType
,
DropoutParam
,
operators
::
DropoutKernal
<
DeviceType
,
T
>>
{
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
,
...
@@ -35,17 +38,15 @@ class DropoutOp : public framework::OperatorWithKernel<DeviceType> {
...
@@ -35,17 +38,15 @@ class DropoutOp : public framework::OperatorWithKernel<DeviceType> {
scope
),
scope
),
param_
(
inputs
,
outputs
,
attrs
,
*
scope
)
{}
param_
(
inputs
,
outputs
,
attrs
,
*
scope
)
{}
void
Run
()
const
{
using
framework
::
OperatorWithKernel
<
DeviceType
,
DropoutParam
,
operators
::
DropoutKernel
<
DeviceType
,
T
>
kernel
;
operators
::
DropoutKernel
<
DeviceType
,
T
>>
;
kernel
.
Compute
(
param_
);
}
using
framework
::
OperatorWithKernel
<
DeviceType
>::
OperatorWithKernel
;
void
InferShape
()
const
override
;
void
InferShape
()
const
override
;
protected:
protected:
DropoutParam
param_
;
};
};
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
#endif
src/operators/im2sequence_op.cpp
浏览文件 @
094623ee
...
@@ -12,6 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
@@ -12,6 +12,8 @@ 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. */
#ifdef IM2SEQUENCE_OP
#include "operators/im2sequence_op.h"
#include "operators/im2sequence_op.h"
namespace
paddle_mobile
{
namespace
paddle_mobile
{
...
@@ -51,5 +53,13 @@ template class Im2SequenceOp<CPU, float>;
...
@@ -51,5 +53,13 @@ template class Im2SequenceOp<CPU, float>;
}
// namespace paddle_mobile
}
// namespace paddle_mobile
namespace
ops
=
paddle_mobile
::
operators
;
namespace
ops
=
paddle_mobile
::
operators
;
#ifdef PADDLE_MOBILE_CPU
USE_OP
(
im2sequence
);
USE_OP
(
im2sequence
);
REGISTER_OPERATOR
(
im2sequence
,
ops
::
Im2SequenceOp
);
REGISTER_OPERATOR
(
im2sequence
,
ops
::
Im2SequenceOp
);
#endif
#ifdef PADDLE_MOBILE_MALI_GPU
#endif
#ifdef PADDLE_MOBILE_FPGA
#endif
#endif
src/operators/im2sequence_op.h
浏览文件 @
094623ee
...
@@ -12,6 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
@@ -12,6 +12,8 @@ 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. */
#ifdef IM2SEQUENCE_OP
#pragma once
#pragma once
#include <operators/op_param.h>
#include <operators/op_param.h>
...
@@ -24,7 +26,8 @@ namespace operators {
...
@@ -24,7 +26,8 @@ namespace operators {
using
namespace
framework
;
using
namespace
framework
;
template
<
typename
DeviceType
,
typename
T
>
template
<
typename
DeviceType
,
typename
T
>
class
Im2SequenceOp
:
public
framework
::
OperatorWithKernel
<
DeviceType
>
{
class
Im2SequenceOp
:
public
framework
::
OperatorWithKernel
<
DeviceType
,
Im2SequenceParam
,
operators
::
Im2SequenceKernal
<
DeviceType
,
T
>>
{
public:
public:
Im2SequenceOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
Im2SequenceOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
VariableNameMap
&
outputs
,
...
@@ -34,18 +37,14 @@ class Im2SequenceOp : public framework::OperatorWithKernel<DeviceType> {
...
@@ -34,18 +37,14 @@ class Im2SequenceOp : public framework::OperatorWithKernel<DeviceType> {
scope
),
scope
),
param_
(
inputs
,
outputs
,
attrs
,
*
scope
)
{}
param_
(
inputs
,
outputs
,
attrs
,
*
scope
)
{}
using
framework
::
OperatorWithKernel
<
DeviceType
>::
OperatorWithKernel
;
using
framework
::
OperatorWithKernel
<
DeviceType
,
Im2SequenceParam
,
operators
::
Im2SequenceKernel
<
DeviceType
,
T
>>::
OperatorWithKernel
;
void
InferShape
()
const
override
;
void
InferShape
()
const
override
;
void
RunImpl
()
const
{
operators
::
Im2SequenceKernel
<
DeviceType
,
T
>
kernel
;
kernel
.
Compute
(
param_
);
this
->
ClearVariables
({
"X"
});
}
private:
private:
Im2SequenceParam
param_
;
};
};
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
#endif
src/operators/kernel/arm/dropout_kernel.cpp
浏览文件 @
094623ee
...
@@ -20,6 +20,11 @@ limitations under the License. */
...
@@ -20,6 +20,11 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
template
<
>
bool
DropoutKernel
<
CPU
,
float
>::
Init
(
const
DropoutParam
&
para
)
const
{
return
true
;
}
template
<
typename
T
>
template
<
typename
T
>
struct
DropoutFunctor
{
struct
DropoutFunctor
{
inline
T
operator
()(
T
in
)
const
{
return
in
;
}
inline
T
operator
()(
T
in
)
const
{
return
in
;
}
...
...
src/operators/kernel/arm/im2sequence_kernel.cpp
浏览文件 @
094623ee
...
@@ -17,6 +17,11 @@ limitations under the License. */
...
@@ -17,6 +17,11 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
template
<
>
bool
Im2SequenceKernel
<
CPU
,
float
>::
Init
(
const
Im2SequenceParam
&
para
)
const
{
return
true
;
}
inline
int
Im2SeqOutputSize
(
int
input_size
,
int
filter_size
,
int
padding_0
,
inline
int
Im2SeqOutputSize
(
int
input_size
,
int
filter_size
,
int
padding_0
,
int
padding_1
,
int
stride
)
{
int
padding_1
,
int
stride
)
{
const
int
output_size
=
const
int
output_size
=
...
...
src/operators/kernel/dropout_kernel.h
浏览文件 @
094623ee
...
@@ -24,6 +24,7 @@ template <typename DeviceType, typename T>
...
@@ -24,6 +24,7 @@ template <typename DeviceType, typename T>
class
DropoutKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
DropoutParam
>
{
class
DropoutKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
DropoutParam
>
{
public:
public:
void
Compute
(
const
DropoutParam
&
param
)
const
;
void
Compute
(
const
DropoutParam
&
param
)
const
;
bool
Init
(
const
DropoutParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
src/operators/kernel/im2sequence_kernel.h
浏览文件 @
094623ee
...
@@ -30,6 +30,7 @@ class Im2SequenceKernel
...
@@ -30,6 +30,7 @@ class Im2SequenceKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
Im2SequenceParam
>
{
:
public
framework
::
OpKernelBase
<
DeviceType
,
Im2SequenceParam
>
{
public:
public:
void
Compute
(
const
Im2SequenceParam
&
param
)
const
;
void
Compute
(
const
Im2SequenceParam
&
param
)
const
;
bool
Init
(
const
Im2SequenceParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录