Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
a176a07e
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
a176a07e
编写于
4月 19, 2023
作者:
H
huangjiyi
提交者:
GitHub
4月 19, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Register fluid kerenls to phi [part 8] (#53032)
* update * fix bug
上级
e0c14fdf
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
135 addition
and
91 deletion
+135
-91
paddle/fluid/operators/sequence_ops/sequence_conv_op.cc
paddle/fluid/operators/sequence_ops/sequence_conv_op.cc
+8
-6
paddle/fluid/operators/sequence_ops/sequence_conv_op.cu.cc
paddle/fluid/operators/sequence_ops/sequence_conv_op.cu.cc
+8
-6
paddle/fluid/operators/sequence_ops/sequence_conv_op.h
paddle/fluid/operators/sequence_ops/sequence_conv_op.h
+2
-2
paddle/fluid/operators/sequence_ops/sequence_enumerate_op.cc
paddle/fluid/operators/sequence_ops/sequence_enumerate_op.cc
+6
-3
paddle/fluid/operators/sequence_ops/sequence_enumerate_op.cu
paddle/fluid/operators/sequence_ops/sequence_enumerate_op.cu
+8
-5
paddle/fluid/operators/sequence_ops/sequence_enumerate_op.h
paddle/fluid/operators/sequence_ops/sequence_enumerate_op.h
+1
-1
paddle/fluid/operators/sequence_ops/sequence_erase_op.cc
paddle/fluid/operators/sequence_ops/sequence_erase_op.cc
+6
-3
paddle/fluid/operators/sequence_ops/sequence_erase_op.cu
paddle/fluid/operators/sequence_ops/sequence_erase_op.cu
+8
-4
paddle/fluid/operators/sequence_ops/sequence_erase_op.h
paddle/fluid/operators/sequence_ops/sequence_erase_op.h
+1
-1
paddle/fluid/operators/sequence_ops/sequence_expand_as_op.cc
paddle/fluid/operators/sequence_ops/sequence_expand_as_op.cc
+16
-11
paddle/fluid/operators/sequence_ops/sequence_expand_as_op.cu
paddle/fluid/operators/sequence_ops/sequence_expand_as_op.cu
+16
-11
paddle/fluid/operators/sequence_ops/sequence_expand_as_op.h
paddle/fluid/operators/sequence_ops/sequence_expand_as_op.h
+2
-2
paddle/fluid/operators/sequence_ops/sequence_expand_op.cc
paddle/fluid/operators/sequence_ops/sequence_expand_op.cc
+16
-10
paddle/fluid/operators/sequence_ops/sequence_expand_op.cu
paddle/fluid/operators/sequence_ops/sequence_expand_op.cu
+16
-11
paddle/fluid/operators/sequence_ops/sequence_expand_op.h
paddle/fluid/operators/sequence_ops/sequence_expand_op.h
+2
-2
paddle/fluid/operators/sequence_ops/sequence_mask_op.cc
paddle/fluid/operators/sequence_ops/sequence_mask_op.cc
+9
-6
paddle/fluid/operators/sequence_ops/sequence_mask_op.cu
paddle/fluid/operators/sequence_ops/sequence_mask_op.cu
+9
-6
paddle/fluid/operators/sequence_ops/sequence_mask_op.h
paddle/fluid/operators/sequence_ops/sequence_mask_op.h
+1
-1
未找到文件。
paddle/fluid/operators/sequence_ops/sequence_conv_op.cc
浏览文件 @
a176a07e
...
...
@@ -269,9 +269,11 @@ REGISTER_OPERATOR(sequence_conv_grad,
ops
::
SequenceConvGradOp
,
ops
::
SequenceConvGradNoNeedBufferVarsInference
);
REGISTER_OP_CPU_KERNEL
(
sequence_conv
,
ops
::
SequenceConvKernel
<
phi
::
CPUContext
,
float
>
,
ops
::
SequenceConvKernel
<
phi
::
CPUContext
,
double
>
);
REGISTER_OP_CPU_KERNEL
(
sequence_conv_grad
,
ops
::
SequenceConvGradKernel
<
phi
::
CPUContext
,
float
>
,
ops
::
SequenceConvGradKernel
<
phi
::
CPUContext
,
double
>
);
PD_REGISTER_STRUCT_KERNEL
(
sequence_conv
,
CPU
,
ALL_LAYOUT
,
ops
::
SequenceConvKernel
,
float
,
double
)
{}
PD_REGISTER_STRUCT_KERNEL
(
sequence_conv_grad
,
CPU
,
ALL_LAYOUT
,
ops
::
SequenceConvGradKernel
,
float
,
double
)
{}
paddle/fluid/operators/sequence_ops/sequence_conv_op.cu.cc
浏览文件 @
a176a07e
...
...
@@ -15,9 +15,11 @@ limitations under the License. */
#include "paddle/fluid/operators/sequence_ops/sequence_conv_op.h"
namespace
ops
=
paddle
::
operators
;
REGISTER_OP_CUDA_KERNEL
(
sequence_conv
,
ops
::
SequenceConvKernel
<
phi
::
GPUContext
,
float
>
,
ops
::
SequenceConvKernel
<
phi
::
GPUContext
,
double
>
);
REGISTER_OP_CUDA_KERNEL
(
sequence_conv_grad
,
ops
::
SequenceConvGradKernel
<
phi
::
GPUContext
,
float
>
,
ops
::
SequenceConvGradKernel
<
phi
::
GPUContext
,
double
>
);
PD_REGISTER_STRUCT_KERNEL
(
sequence_conv
,
GPU
,
ALL_LAYOUT
,
ops
::
SequenceConvKernel
,
float
,
double
)
{}
PD_REGISTER_STRUCT_KERNEL
(
sequence_conv_grad
,
GPU
,
ALL_LAYOUT
,
ops
::
SequenceConvGradKernel
,
float
,
double
)
{}
paddle/fluid/operators/sequence_ops/sequence_conv_op.h
浏览文件 @
a176a07e
...
...
@@ -22,7 +22,7 @@ limitations under the License. */
namespace
paddle
{
namespace
operators
{
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SequenceConvKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
...
@@ -85,7 +85,7 @@ class SequenceConvKernel : public framework::OpKernel<T> {
}
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SequenceConvGradKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
...
paddle/fluid/operators/sequence_ops/sequence_enumerate_op.cc
浏览文件 @
a176a07e
...
...
@@ -88,6 +88,9 @@ namespace ops = paddle::operators;
REGISTER_OP_WITHOUT_GRADIENT
(
sequence_enumerate
,
ops
::
SequenceEnumerateOp
,
ops
::
SequenceEnumerateOpMaker
);
REGISTER_OP_CPU_KERNEL
(
sequence_enumerate
,
ops
::
SequenceEnumerateKernel
<
phi
::
CPUContext
,
int32_t
>
,
ops
::
SequenceEnumerateKernel
<
phi
::
CPUContext
,
int64_t
>
);
PD_REGISTER_STRUCT_KERNEL
(
sequence_enumerate
,
CPU
,
ALL_LAYOUT
,
ops
::
SequenceEnumerateKernel
,
int32_t
,
int64_t
)
{}
paddle/fluid/operators/sequence_ops/sequence_enumerate_op.cu
浏览文件 @
a176a07e
...
...
@@ -47,7 +47,7 @@ __global__ void CalcOutPut(const T* in_data,
}
}
template
<
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SequenceEnumerateOpCUDAKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
...
@@ -91,7 +91,10 @@ class SequenceEnumerateOpCUDAKernel : public framework::OpKernel<T> {
}
// namespace operators
}
// namespace paddle
REGISTER_OP_CUDA_KERNEL
(
sequence_enumerate
,
paddle
::
operators
::
SequenceEnumerateOpCUDAKernel
<
int32_t
>
,
paddle
::
operators
::
SequenceEnumerateOpCUDAKernel
<
int64_t
>
);
namespace
ops
=
paddle
::
operators
;
PD_REGISTER_STRUCT_KERNEL
(
sequence_enumerate
,
GPU
,
ALL_LAYOUT
,
ops
::
SequenceEnumerateOpCUDAKernel
,
int32_t
,
int64_t
)
{}
paddle/fluid/operators/sequence_ops/sequence_enumerate_op.h
浏览文件 @
a176a07e
...
...
@@ -19,7 +19,7 @@
namespace
paddle
{
namespace
operators
{
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SequenceEnumerateKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
...
paddle/fluid/operators/sequence_ops/sequence_erase_op.cc
浏览文件 @
a176a07e
...
...
@@ -98,6 +98,9 @@ namespace ops = paddle::operators;
REGISTER_OP_WITHOUT_GRADIENT
(
sequence_erase
,
ops
::
SequenceEraseOp
,
ops
::
SequenceEraseOpMaker
);
REGISTER_OP_CPU_KERNEL
(
sequence_erase
,
ops
::
SequenceEraseKernel
<
phi
::
CPUContext
,
int32_t
>
,
ops
::
SequenceEraseKernel
<
phi
::
CPUContext
,
int64_t
>
);
PD_REGISTER_STRUCT_KERNEL
(
sequence_erase
,
CPU
,
ALL_LAYOUT
,
ops
::
SequenceEraseKernel
,
int32_t
,
int64_t
)
{}
paddle/fluid/operators/sequence_ops/sequence_erase_op.cu
浏览文件 @
a176a07e
...
...
@@ -62,7 +62,7 @@ __global__ void SetOutput(const T* in_dat,
}
}
template
<
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SequenceEraseOpCUDAKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
...
...
@@ -129,6 +129,10 @@ class SequenceEraseOpCUDAKernel : public framework::OpKernel<T> {
}
// namespace operators
}
// namespace paddle
REGISTER_OP_CUDA_KERNEL
(
sequence_erase
,
paddle
::
operators
::
SequenceEraseOpCUDAKernel
<
int32_t
>
,
paddle
::
operators
::
SequenceEraseOpCUDAKernel
<
int64_t
>
);
namespace
ops
=
paddle
::
operators
;
PD_REGISTER_STRUCT_KERNEL
(
sequence_erase
,
GPU
,
ALL_LAYOUT
,
ops
::
SequenceEraseOpCUDAKernel
,
int32_t
,
int64_t
)
{}
paddle/fluid/operators/sequence_ops/sequence_erase_op.h
浏览文件 @
a176a07e
...
...
@@ -21,7 +21,7 @@ limitations under the License. */
namespace
paddle
{
namespace
operators
{
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SequenceEraseKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
...
...
paddle/fluid/operators/sequence_ops/sequence_expand_as_op.cc
浏览文件 @
a176a07e
...
...
@@ -209,14 +209,19 @@ REGISTER_OPERATOR(
REGISTER_OPERATOR
(
sequence_expand_as_grad
,
ops
::
SequenceExpandAsOpGrad
,
ops
::
SequenceExpandAsGradOpNoNeedBufferVarsInferer
);
REGISTER_OP_CPU_KERNEL
(
sequence_expand_as
,
ops
::
SequenceExpandAsKernel
<
phi
::
CPUContext
,
float
>
,
ops
::
SequenceExpandAsKernel
<
phi
::
CPUContext
,
double
>
,
ops
::
SequenceExpandAsKernel
<
phi
::
CPUContext
,
int
>
,
ops
::
SequenceExpandAsKernel
<
phi
::
CPUContext
,
int64_t
>
);
REGISTER_OP_CPU_KERNEL
(
sequence_expand_as_grad
,
ops
::
SequenceExpandAsGradKernel
<
phi
::
CPUContext
,
float
>
,
ops
::
SequenceExpandAsGradKernel
<
phi
::
CPUContext
,
double
>
,
ops
::
SequenceExpandAsGradKernel
<
phi
::
CPUContext
,
int
>
,
ops
::
SequenceExpandAsGradKernel
<
phi
::
CPUContext
,
int64_t
>
);
PD_REGISTER_STRUCT_KERNEL
(
sequence_expand_as
,
CPU
,
ALL_LAYOUT
,
ops
::
SequenceExpandAsKernel
,
float
,
double
,
int
,
int64_t
)
{}
PD_REGISTER_STRUCT_KERNEL
(
sequence_expand_as_grad
,
CPU
,
ALL_LAYOUT
,
ops
::
SequenceExpandAsGradKernel
,
float
,
double
,
int
,
int64_t
)
{}
paddle/fluid/operators/sequence_ops/sequence_expand_as_op.cu
浏览文件 @
a176a07e
...
...
@@ -130,14 +130,19 @@ struct SequenceExpandAsGradFunctor<phi::GPUContext, T> {
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
REGISTER_OP_CUDA_KERNEL
(
sequence_expand_as
,
ops
::
SequenceExpandAsKernel
<
phi
::
GPUContext
,
float
>
,
ops
::
SequenceExpandAsKernel
<
phi
::
GPUContext
,
double
>
,
ops
::
SequenceExpandAsKernel
<
phi
::
GPUContext
,
int
>
,
ops
::
SequenceExpandAsKernel
<
phi
::
GPUContext
,
int64_t
>
);
REGISTER_OP_CUDA_KERNEL
(
sequence_expand_as_grad
,
ops
::
SequenceExpandAsGradKernel
<
phi
::
GPUContext
,
float
>
,
ops
::
SequenceExpandAsGradKernel
<
phi
::
GPUContext
,
double
>
,
ops
::
SequenceExpandAsGradKernel
<
phi
::
GPUContext
,
int
>
,
ops
::
SequenceExpandAsGradKernel
<
phi
::
GPUContext
,
int64_t
>
);
PD_REGISTER_STRUCT_KERNEL
(
sequence_expand_as
,
GPU
,
ALL_LAYOUT
,
ops
::
SequenceExpandAsKernel
,
float
,
double
,
int
,
int64_t
)
{}
PD_REGISTER_STRUCT_KERNEL
(
sequence_expand_as_grad
,
GPU
,
ALL_LAYOUT
,
ops
::
SequenceExpandAsGradKernel
,
float
,
double
,
int
,
int64_t
)
{}
paddle/fluid/operators/sequence_ops/sequence_expand_as_op.h
浏览文件 @
a176a07e
...
...
@@ -67,7 +67,7 @@ struct SequenceExpandAsFunctor<phi::CPUContext, T> {
}
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SequenceExpandAsKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
...
@@ -144,7 +144,7 @@ struct SequenceExpandAsGradFunctor<phi::CPUContext, T> {
}
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SequenceExpandAsGradKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
...
paddle/fluid/operators/sequence_ops/sequence_expand_op.cc
浏览文件 @
a176a07e
...
...
@@ -281,13 +281,19 @@ REGISTER_OPERATOR(sequence_expand,
REGISTER_OPERATOR
(
sequence_expand_grad
,
ops
::
SequenceExpandOpGrad
,
ops
::
SequenceExpandGradOpNoNeedBufferVarsInferer
);
REGISTER_OP_CPU_KERNEL
(
sequence_expand
,
ops
::
SequenceExpandKernel
<
phi
::
CPUContext
,
float
>
,
ops
::
SequenceExpandKernel
<
phi
::
CPUContext
,
double
>
,
ops
::
SequenceExpandKernel
<
phi
::
CPUContext
,
int
>
,
ops
::
SequenceExpandKernel
<
phi
::
CPUContext
,
int64_t
>
);
REGISTER_OP_CPU_KERNEL
(
sequence_expand_grad
,
ops
::
SequenceExpandGradKernel
<
phi
::
CPUContext
,
float
>
,
ops
::
SequenceExpandGradKernel
<
phi
::
CPUContext
,
double
>
,
ops
::
SequenceExpandGradKernel
<
phi
::
CPUContext
,
int
>
,
ops
::
SequenceExpandGradKernel
<
phi
::
CPUContext
,
int64_t
>
);
PD_REGISTER_STRUCT_KERNEL
(
sequence_expand
,
CPU
,
ALL_LAYOUT
,
ops
::
SequenceExpandKernel
,
float
,
double
,
int
,
int64_t
)
{}
PD_REGISTER_STRUCT_KERNEL
(
sequence_expand_grad
,
CPU
,
ALL_LAYOUT
,
ops
::
SequenceExpandGradKernel
,
float
,
double
,
int
,
int64_t
)
{}
paddle/fluid/operators/sequence_ops/sequence_expand_op.cu
浏览文件 @
a176a07e
...
...
@@ -227,14 +227,19 @@ struct SequenceExpandGradFunctor<phi::GPUContext, T> {
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
REGISTER_OP_CUDA_KERNEL
(
sequence_expand
,
ops
::
SequenceExpandKernel
<
phi
::
GPUContext
,
float
>
,
ops
::
SequenceExpandKernel
<
phi
::
GPUContext
,
double
>
,
ops
::
SequenceExpandKernel
<
phi
::
GPUContext
,
int
>
,
ops
::
SequenceExpandKernel
<
phi
::
GPUContext
,
int64_t
>
);
REGISTER_OP_CUDA_KERNEL
(
sequence_expand_grad
,
ops
::
SequenceExpandGradKernel
<
phi
::
GPUContext
,
float
>
,
ops
::
SequenceExpandGradKernel
<
phi
::
GPUContext
,
double
>
,
ops
::
SequenceExpandGradKernel
<
phi
::
GPUContext
,
int
>
,
ops
::
SequenceExpandGradKernel
<
phi
::
GPUContext
,
int64_t
>
);
PD_REGISTER_STRUCT_KERNEL
(
sequence_expand
,
GPU
,
ALL_LAYOUT
,
ops
::
SequenceExpandKernel
,
float
,
double
,
int
,
int64_t
)
{}
PD_REGISTER_STRUCT_KERNEL
(
sequence_expand_grad
,
GPU
,
ALL_LAYOUT
,
ops
::
SequenceExpandGradKernel
,
float
,
double
,
int
,
int64_t
)
{}
paddle/fluid/operators/sequence_ops/sequence_expand_op.h
浏览文件 @
a176a07e
...
...
@@ -81,7 +81,7 @@ struct SequenceExpandFunctor<phi::CPUContext, T> {
}
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SequenceExpandKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
...
@@ -185,7 +185,7 @@ struct SequenceExpandGradFunctor<phi::CPUContext, T> {
}
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SequenceExpandGradKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
...
paddle/fluid/operators/sequence_ops/sequence_mask_op.cc
浏览文件 @
a176a07e
...
...
@@ -102,9 +102,12 @@ REGISTER_OPERATOR(
paddle
::
framework
::
EmptyGradOpMaker
<
paddle
::
framework
::
OpDesc
>
,
paddle
::
framework
::
EmptyGradOpMaker
<
paddle
::
imperative
::
OpBase
>
);
REGISTER_OP_CPU_KERNEL
(
sequence_mask
,
paddle
::
operators
::
SequenceMaskKernel
<
phi
::
CPUContext
,
int
>
,
paddle
::
operators
::
SequenceMaskKernel
<
phi
::
CPUContext
,
int64_t
>
,
paddle
::
operators
::
SequenceMaskKernel
<
phi
::
CPUContext
,
float
>
,
paddle
::
operators
::
SequenceMaskKernel
<
phi
::
CPUContext
,
double
>
);
namespace
ops
=
paddle
::
operators
;
PD_REGISTER_STRUCT_KERNEL
(
sequence_mask
,
CPU
,
ALL_LAYOUT
,
ops
::
SequenceMaskKernel
,
float
,
double
,
int
,
int64_t
)
{}
paddle/fluid/operators/sequence_ops/sequence_mask_op.cu
浏览文件 @
a176a07e
...
...
@@ -14,9 +14,12 @@
#include "paddle/fluid/operators/sequence_ops/sequence_mask_op.h"
REGISTER_OP_CUDA_KERNEL
(
sequence_mask
,
paddle
::
operators
::
SequenceMaskKernel
<
phi
::
GPUContext
,
int
>
,
paddle
::
operators
::
SequenceMaskKernel
<
phi
::
GPUContext
,
int64_t
>
,
paddle
::
operators
::
SequenceMaskKernel
<
phi
::
GPUContext
,
float
>
,
paddle
::
operators
::
SequenceMaskKernel
<
phi
::
GPUContext
,
double
>
);
namespace
ops
=
paddle
::
operators
;
PD_REGISTER_STRUCT_KERNEL
(
sequence_mask
,
GPU
,
ALL_LAYOUT
,
ops
::
SequenceMaskKernel
,
float
,
double
,
int
,
int64_t
)
{}
paddle/fluid/operators/sequence_ops/sequence_mask_op.h
浏览文件 @
a176a07e
...
...
@@ -69,7 +69,7 @@ struct SequenceMaskFunctor {
int
maxlen_
;
};
template
<
typename
DeviceContext
,
typename
Tx
>
template
<
typename
Tx
,
typename
DeviceContext
>
class
SequenceMaskKernel
:
public
framework
::
OpKernel
<
Tx
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录