Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
d7aeb376
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看板
提交
d7aeb376
编写于
11月 19, 2019
作者:
Z
zhupengyang
提交者:
石晓伟
11月 19, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add search_seq_softmax op; regist search_seq_softmax x86 kernel and cuda kernel (#2445)
test=develop
上级
7c6a9495
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
124 addition
and
0 deletion
+124
-0
lite/kernels/cuda/softmax_compute.cu
lite/kernels/cuda/softmax_compute.cu
+15
-0
lite/kernels/x86/softmax_compute.cc
lite/kernels/x86/softmax_compute.cc
+9
-0
lite/operators/CMakeLists.txt
lite/operators/CMakeLists.txt
+1
-0
lite/operators/search_seq_softmax_op.cc
lite/operators/search_seq_softmax_op.cc
+52
-0
lite/operators/search_seq_softmax_op.h
lite/operators/search_seq_softmax_op.h
+47
-0
未找到文件。
lite/kernels/cuda/softmax_compute.cu
浏览文件 @
d7aeb376
...
@@ -244,3 +244,18 @@ REGISTER_LITE_KERNEL(softmax,
...
@@ -244,3 +244,18 @@ REGISTER_LITE_KERNEL(softmax,
PRECISION
(
kFloat
),
PRECISION
(
kFloat
),
DATALAYOUT
(
kNCHW
))})
DATALAYOUT
(
kNCHW
))})
.
Finalize
();
.
Finalize
();
REGISTER_LITE_KERNEL
(
search_seq_softmax
,
kCUDA
,
kFloat
,
kNCHW
,
paddle
::
lite
::
kernels
::
cuda
::
SoftmaxCompute
,
def
)
.
BindInput
(
"X"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kCUDA
),
PRECISION
(
kFloat
),
DATALAYOUT
(
kNCHW
))})
.
BindOutput
(
"Out"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kCUDA
),
PRECISION
(
kFloat
),
DATALAYOUT
(
kNCHW
))})
.
Finalize
();
lite/kernels/x86/softmax_compute.cc
浏览文件 @
d7aeb376
...
@@ -23,3 +23,12 @@ REGISTER_LITE_KERNEL(softmax,
...
@@ -23,3 +23,12 @@ REGISTER_LITE_KERNEL(softmax,
.
BindInput
(
"X"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kX86
))})
.
BindInput
(
"X"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kX86
))})
.
BindOutput
(
"Out"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kX86
))})
.
BindOutput
(
"Out"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kX86
))})
.
Finalize
();
.
Finalize
();
REGISTER_LITE_KERNEL
(
search_seq_softmax
,
kX86
,
kFloat
,
kNCHW
,
paddle
::
lite
::
kernels
::
x86
::
SoftmaxCompute
<
float
>
,
def
)
.
BindInput
(
"X"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kX86
))})
.
BindOutput
(
"Out"
,
{
LiteType
::
GetTensorTy
(
TARGET
(
kX86
))})
.
Finalize
();
lite/operators/CMakeLists.txt
浏览文件 @
d7aeb376
...
@@ -84,6 +84,7 @@ add_operator(reduce_sum_op_lite extra SRCS reduce_ops.cc DEPS ${op_DEPS})
...
@@ -84,6 +84,7 @@ add_operator(reduce_sum_op_lite extra SRCS reduce_ops.cc DEPS ${op_DEPS})
add_operator
(
match_matrix_tensor_op_lite extra SRCS match_matrix_tensor_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
match_matrix_tensor_op_lite extra SRCS match_matrix_tensor_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
search_seq_depadding_op_lite extra SRCS search_seq_depadding_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
search_seq_depadding_op_lite extra SRCS search_seq_depadding_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
search_grnn_op_lite extra SRCS search_grnn_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
search_grnn_op_lite extra SRCS search_grnn_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
search_seq_softmax_op_lite extra SRCS search_seq_softmax_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
sequence_concat_op_lite extra SRCS sequence_concat_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
sequence_concat_op_lite extra SRCS sequence_concat_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
var_conv_2d_op_lite extra SRCS var_conv_2d_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
var_conv_2d_op_lite extra SRCS var_conv_2d_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
attention_padding_mask_op_lite extra SRCS attention_padding_mask_op.cc DEPS
${
op_DEPS
}
)
add_operator
(
attention_padding_mask_op_lite extra SRCS attention_padding_mask_op.cc DEPS
${
op_DEPS
}
)
...
...
lite/operators/search_seq_softmax_op.cc
0 → 100644
浏览文件 @
d7aeb376
// Copyright (c) 2019 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.
#include "lite/operators/search_seq_softmax_op.h"
#include "lite/core/op_registry.h"
namespace
paddle
{
namespace
lite
{
namespace
operators
{
bool
SearchSeqSoftmaxOp
::
CheckShape
()
const
{
CHECK_OR_FALSE
(
param_
.
x
);
CHECK_OR_FALSE
(
param_
.
output
);
return
true
;
}
bool
SearchSeqSoftmaxOp
::
InferShape
()
const
{
param_
.
output
->
Resize
(
param_
.
x
->
dims
());
param_
.
output
->
set_lod
(
param_
.
x
->
lod
());
return
true
;
}
bool
SearchSeqSoftmaxOp
::
AttachImpl
(
const
cpp
::
OpDesc
&
opdesc
,
lite
::
Scope
*
scope
)
{
param_
.
x
=
const_cast
<
lite
::
Tensor
*>
(
&
scope
->
FindVar
(
opdesc
.
Input
(
"X"
).
front
())
->
Get
<
lite
::
Tensor
>
());
param_
.
output
=
scope
->
FindVar
(
opdesc
.
Output
(
"Out"
).
front
())
->
GetMutable
<
lite
::
Tensor
>
();
param_
.
axis
=
1
;
CHECK
(
param_
.
x
);
CHECK
(
param_
.
output
);
return
true
;
}
}
// namespace operators
}
// namespace lite
}
// namespace paddle
REGISTER_LITE_OP
(
search_seq_softmax
,
paddle
::
lite
::
operators
::
SearchSeqSoftmaxOp
);
lite/operators/search_seq_softmax_op.h
0 → 100644
浏览文件 @
d7aeb376
// Copyright (c) 2019 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 <string>
#include <vector>
#include "lite/core/op_lite.h"
#include "lite/core/scope.h"
#include "lite/utils/all.h"
namespace
paddle
{
namespace
lite
{
namespace
operators
{
class
SearchSeqSoftmaxOp
:
public
OpLite
{
public:
SearchSeqSoftmaxOp
()
{}
explicit
SearchSeqSoftmaxOp
(
const
std
::
string
&
op_type
)
:
OpLite
(
op_type
)
{}
bool
CheckShape
()
const
override
;
bool
InferShape
()
const
override
;
bool
AttachImpl
(
const
cpp
::
OpDesc
&
opdesc
,
lite
::
Scope
*
scope
)
override
;
void
AttachKernel
(
KernelBase
*
kernel
)
override
{
kernel
->
SetParam
(
param_
);
}
std
::
string
DebugString
()
const
override
{
return
"search_seq_softmax_op"
;
}
private:
mutable
SoftmaxParam
param_
;
};
}
// namespace operators
}
// namespace lite
}
// namespace paddle
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录