Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
abc44b40
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 2 年 前同步成功
通知
2325
Star
20933
Fork
5424
代码
文件
提交
分支
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看板
未验证
提交
abc44b40
编写于
4月 19, 2023
作者:
H
huangjiyi
提交者:
GitHub
4月 19, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Register fluid kerenls to phi [part 11] (#53035)
* update * fix bug * fix bug * fix bug * fix bug
上级
01de2fc9
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
132 addition
and
97 deletion
+132
-97
paddle/fluid/operators/detection/sigmoid_focal_loss_op.cc
paddle/fluid/operators/detection/sigmoid_focal_loss_op.cc
+12
-7
paddle/fluid/operators/detection/sigmoid_focal_loss_op.cu
paddle/fluid/operators/detection/sigmoid_focal_loss_op.cu
+14
-10
paddle/fluid/operators/detection/sigmoid_focal_loss_op.h
paddle/fluid/operators/detection/sigmoid_focal_loss_op.h
+2
-2
paddle/fluid/operators/fused/skip_layernorm_op.cu
paddle/fluid/operators/fused/skip_layernorm_op.cu
+10
-7
paddle/fluid/operators/optimizers/sparse_momentum_op.cc
paddle/fluid/operators/optimizers/sparse_momentum_op.cc
+6
-3
paddle/fluid/operators/optimizers/sparse_momentum_op.cu
paddle/fluid/operators/optimizers/sparse_momentum_op.cu
+8
-5
paddle/fluid/operators/optimizers/sparse_momentum_op.h
paddle/fluid/operators/optimizers/sparse_momentum_op.h
+1
-1
paddle/fluid/operators/similarity_focus_op.cc
paddle/fluid/operators/similarity_focus_op.cc
+6
-3
paddle/fluid/operators/similarity_focus_op.h
paddle/fluid/operators/similarity_focus_op.h
+1
-1
paddle/fluid/operators/smooth_l1_loss_op.cc
paddle/fluid/operators/smooth_l1_loss_op.cc
+4
-4
paddle/fluid/operators/smooth_l1_loss_op.cu
paddle/fluid/operators/smooth_l1_loss_op.cu
+4
-4
paddle/fluid/operators/smooth_l1_loss_op.h
paddle/fluid/operators/smooth_l1_loss_op.h
+2
-2
paddle/fluid/operators/space_to_depth_op.cc
paddle/fluid/operators/space_to_depth_op.cc
+16
-10
paddle/fluid/operators/space_to_depth_op.cu
paddle/fluid/operators/space_to_depth_op.cu
+16
-11
paddle/fluid/operators/space_to_depth_op.h
paddle/fluid/operators/space_to_depth_op.h
+2
-2
paddle/fluid/operators/sparse_attention_op.cu
paddle/fluid/operators/sparse_attention_op.cu
+16
-11
paddle/fluid/operators/spp_op.cc
paddle/fluid/operators/spp_op.cc
+5
-6
paddle/fluid/operators/spp_op.cu.cc
paddle/fluid/operators/spp_op.cu.cc
+5
-6
paddle/fluid/operators/spp_op.h
paddle/fluid/operators/spp_op.h
+2
-2
未找到文件。
paddle/fluid/operators/detection/sigmoid_focal_loss_op.cc
浏览文件 @
abc44b40
...
@@ -262,10 +262,15 @@ REGISTER_OPERATOR(sigmoid_focal_loss,
...
@@ -262,10 +262,15 @@ REGISTER_OPERATOR(sigmoid_focal_loss,
ops
::
SigmoidFocalLossGradOpMaker
<
paddle
::
framework
::
OpDesc
>
,
ops
::
SigmoidFocalLossGradOpMaker
<
paddle
::
framework
::
OpDesc
>
,
ops
::
SigmoidFocalLossGradOpMaker
<
paddle
::
imperative
::
OpBase
>
);
ops
::
SigmoidFocalLossGradOpMaker
<
paddle
::
imperative
::
OpBase
>
);
REGISTER_OPERATOR
(
sigmoid_focal_loss_grad
,
ops
::
SigmoidFocalLossGradOp
);
REGISTER_OPERATOR
(
sigmoid_focal_loss_grad
,
ops
::
SigmoidFocalLossGradOp
);
REGISTER_OP_CPU_KERNEL
(
sigmoid_focal_loss
,
PD_REGISTER_STRUCT_KERNEL
(
sigmoid_focal_loss
,
ops
::
SigmoidFocalLossKernel
<
phi
::
CPUContext
,
float
>
,
CPU
,
ops
::
SigmoidFocalLossKernel
<
phi
::
CPUContext
,
double
>
);
ALL_LAYOUT
,
REGISTER_OP_CPU_KERNEL
(
ops
::
SigmoidFocalLossKernel
,
sigmoid_focal_loss_grad
,
float
,
ops
::
SigmoidFocalLossGradKernel
<
phi
::
CPUContext
,
float
>
,
double
)
{}
ops
::
SigmoidFocalLossGradKernel
<
phi
::
CPUContext
,
double
>
);
PD_REGISTER_STRUCT_KERNEL
(
sigmoid_focal_loss_grad
,
CPU
,
ALL_LAYOUT
,
ops
::
SigmoidFocalLossGradKernel
,
float
,
double
)
{}
paddle/fluid/operators/detection/sigmoid_focal_loss_op.cu
浏览文件 @
abc44b40
...
@@ -117,7 +117,7 @@ __global__ void GPUSigmoidFocalLossBackward(const T *x_data,
...
@@ -117,7 +117,7 @@ __global__ void GPUSigmoidFocalLossBackward(const T *x_data,
}
}
}
}
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
GPUSigmoidFocalLossKernel
:
public
framework
::
OpKernel
<
T
>
{
class
GPUSigmoidFocalLossKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
@@ -148,7 +148,7 @@ class GPUSigmoidFocalLossKernel : public framework::OpKernel<T> {
...
@@ -148,7 +148,7 @@ class GPUSigmoidFocalLossKernel : public framework::OpKernel<T> {
}
}
};
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
GPUSigmoidFocalLossGradKernel
:
public
framework
::
OpKernel
<
T
>
{
class
GPUSigmoidFocalLossGradKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
@@ -187,11 +187,15 @@ class GPUSigmoidFocalLossGradKernel : public framework::OpKernel<T> {
...
@@ -187,11 +187,15 @@ class GPUSigmoidFocalLossGradKernel : public framework::OpKernel<T> {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP_CUDA_KERNEL
(
PD_REGISTER_STRUCT_KERNEL
(
sigmoid_focal_loss
,
sigmoid_focal_loss
,
GPU
,
ops
::
GPUSigmoidFocalLossKernel
<
phi
::
GPUContext
,
float
>
,
ALL_LAYOUT
,
ops
::
GPUSigmoidFocalLossKernel
<
phi
::
GPUContext
,
double
>
);
ops
::
GPUSigmoidFocalLossKernel
,
REGISTER_OP_CUDA_KERNEL
(
float
,
sigmoid_focal_loss_grad
,
double
)
{}
ops
::
GPUSigmoidFocalLossGradKernel
<
phi
::
GPUContext
,
float
>
,
PD_REGISTER_STRUCT_KERNEL
(
sigmoid_focal_loss_grad
,
ops
::
GPUSigmoidFocalLossGradKernel
<
phi
::
GPUContext
,
double
>
);
GPU
,
ALL_LAYOUT
,
ops
::
GPUSigmoidFocalLossGradKernel
,
float
,
double
)
{}
paddle/fluid/operators/detection/sigmoid_focal_loss_op.h
浏览文件 @
abc44b40
...
@@ -22,7 +22,7 @@ limitations under the License. */
...
@@ -22,7 +22,7 @@ limitations under the License. */
namespace
paddle
{
namespace
paddle
{
namespace
operators
{
namespace
operators
{
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SigmoidFocalLossKernel
:
public
framework
::
OpKernel
<
T
>
{
class
SigmoidFocalLossKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
@@ -73,7 +73,7 @@ class SigmoidFocalLossKernel : public framework::OpKernel<T> {
...
@@ -73,7 +73,7 @@ class SigmoidFocalLossKernel : public framework::OpKernel<T> {
}
}
};
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SigmoidFocalLossGradKernel
:
public
framework
::
OpKernel
<
T
>
{
class
SigmoidFocalLossGradKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
...
paddle/fluid/operators/fused/skip_layernorm_op.cu
浏览文件 @
abc44b40
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
namespace
paddle
{
namespace
paddle
{
namespace
operators
{
namespace
operators
{
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SkipLayerNormKernel
:
public
framework
::
OpKernel
<
T
>
{
class
SkipLayerNormKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
@@ -89,13 +89,16 @@ class SkipLayerNormKernel : public framework::OpKernel<T> {
...
@@ -89,13 +89,16 @@ class SkipLayerNormKernel : public framework::OpKernel<T> {
}
// namespace paddle
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
namespace
plat
=
paddle
::
platform
;
#if defined(PADDLE_WITH_CUDA) && CUDA_VERSION >= 10000
#if defined(PADDLE_WITH_CUDA) && CUDA_VERSION >= 10000
REGISTER_OP_CUDA_KERNEL
(
PD_REGISTER_STRUCT_KERNEL
(
skip_layernorm
,
skip_layernorm
,
GPU
,
ops
::
SkipLayerNormKernel
<
phi
::
GPUContext
,
float
>
,
ALL_LAYOUT
,
ops
::
SkipLayerNormKernel
<
phi
::
GPUContext
,
paddle
::
platform
::
float16
>
);
ops
::
SkipLayerNormKernel
,
float
,
plat
::
float16
)
{}
#else
#else
REGISTER_OP_CUDA_KERNEL
(
skip_layernorm
,
PD_REGISTER_STRUCT_KERNEL
(
ops
::
SkipLayerNormKernel
<
phi
::
GPUContext
,
float
>
);
skip_layernorm
,
GPU
,
ALL_LAYOUT
,
ops
::
SkipLayerNormKernel
,
float
)
{}
#endif
#endif
paddle/fluid/operators/optimizers/sparse_momentum_op.cc
浏览文件 @
abc44b40
...
@@ -118,6 +118,9 @@ REGISTER_OPERATOR(
...
@@ -118,6 +118,9 @@ REGISTER_OPERATOR(
paddle
::
framework
::
EmptyGradOpMaker
<
paddle
::
framework
::
OpDesc
>
,
paddle
::
framework
::
EmptyGradOpMaker
<
paddle
::
framework
::
OpDesc
>
,
paddle
::
framework
::
EmptyGradOpMaker
<
paddle
::
imperative
::
OpBase
>
,
paddle
::
framework
::
EmptyGradOpMaker
<
paddle
::
imperative
::
OpBase
>
,
ops
::
SparseMomentumOpInferVarType
);
ops
::
SparseMomentumOpInferVarType
);
REGISTER_OP_CPU_KERNEL
(
sparse_momentum
,
PD_REGISTER_STRUCT_KERNEL
(
sparse_momentum
,
ops
::
SparseMomentumOpKernel
<
phi
::
CPUContext
,
float
>
,
CPU
,
ops
::
SparseMomentumOpKernel
<
phi
::
CPUContext
,
double
>
);
ALL_LAYOUT
,
ops
::
SparseMomentumOpKernel
,
float
,
double
)
{}
paddle/fluid/operators/optimizers/sparse_momentum_op.cu
浏览文件 @
abc44b40
...
@@ -17,8 +17,11 @@
...
@@ -17,8 +17,11 @@
#include "paddle/fluid/platform/float16.h"
#include "paddle/fluid/platform/float16.h"
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP_CUDA_KERNEL
(
namespace
plat
=
paddle
::
platform
;
sparse_momentum
,
PD_REGISTER_STRUCT_KERNEL
(
sparse_momentum
,
ops
::
SparseMomentumOpKernel
<
phi
::
GPUContext
,
float
>
,
GPU
,
ops
::
SparseMomentumOpKernel
<
phi
::
GPUContext
,
double
>
,
ALL_LAYOUT
,
ops
::
SparseMomentumOpKernel
<
phi
::
GPUContext
,
paddle
::
platform
::
float16
>
);
ops
::
SparseMomentumOpKernel
,
float
,
double
,
plat
::
float16
)
{}
paddle/fluid/operators/optimizers/sparse_momentum_op.h
浏览文件 @
abc44b40
...
@@ -295,7 +295,7 @@ class IndexMomentumFunctor {
...
@@ -295,7 +295,7 @@ class IndexMomentumFunctor {
}
}
};
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SparseMomentumOpKernel
:
public
framework
::
OpKernel
<
T
>
{
class
SparseMomentumOpKernel
:
public
framework
::
OpKernel
<
T
>
{
using
MPDType
=
MultiPrecisionType
<
T
>
;
using
MPDType
=
MultiPrecisionType
<
T
>
;
...
...
paddle/fluid/operators/similarity_focus_op.cc
浏览文件 @
abc44b40
...
@@ -91,6 +91,9 @@ REGISTER_OPERATOR(
...
@@ -91,6 +91,9 @@ REGISTER_OPERATOR(
ops
::
SimilarityFocusOpMaker
,
ops
::
SimilarityFocusOpMaker
,
paddle
::
framework
::
EmptyGradOpMaker
<
paddle
::
framework
::
OpDesc
>
,
paddle
::
framework
::
EmptyGradOpMaker
<
paddle
::
framework
::
OpDesc
>
,
paddle
::
framework
::
EmptyGradOpMaker
<
paddle
::
imperative
::
OpBase
>
);
paddle
::
framework
::
EmptyGradOpMaker
<
paddle
::
imperative
::
OpBase
>
);
REGISTER_OP_CPU_KERNEL
(
similarity_focus
,
PD_REGISTER_STRUCT_KERNEL
(
similarity_focus
,
ops
::
SimilarityFocusKernel
<
float
>
,
CPU
,
ops
::
SimilarityFocusKernel
<
double
>
);
ALL_LAYOUT
,
ops
::
SimilarityFocusKernel
,
float
,
double
)
{}
paddle/fluid/operators/similarity_focus_op.h
浏览文件 @
abc44b40
...
@@ -25,7 +25,7 @@ limitations under the License. */
...
@@ -25,7 +25,7 @@ limitations under the License. */
namespace
paddle
{
namespace
paddle
{
namespace
operators
{
namespace
operators
{
template
<
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SimilarityFocusKernel
:
public
framework
::
OpKernel
<
T
>
{
class
SimilarityFocusKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
...
paddle/fluid/operators/smooth_l1_loss_op.cc
浏览文件 @
abc44b40
...
@@ -225,7 +225,7 @@ REGISTER_OPERATOR(smooth_l1_loss,
...
@@ -225,7 +225,7 @@ REGISTER_OPERATOR(smooth_l1_loss,
ops
::
SmoothL1LossGradMaker
<
paddle
::
framework
::
OpDesc
>
,
ops
::
SmoothL1LossGradMaker
<
paddle
::
framework
::
OpDesc
>
,
ops
::
SmoothL1LossGradMaker
<
paddle
::
imperative
::
OpBase
>
);
ops
::
SmoothL1LossGradMaker
<
paddle
::
imperative
::
OpBase
>
);
REGISTER_OPERATOR
(
smooth_l1_loss_grad
,
ops
::
SmoothL1LossGradOp
);
REGISTER_OPERATOR
(
smooth_l1_loss_grad
,
ops
::
SmoothL1LossGradOp
);
REGISTER_OP_CPU_KERNEL
(
smooth_l1_loss
,
PD_REGISTER_STRUCT_KERNEL
(
ops
::
SmoothL1LossKernel
<
phi
::
CPUContext
,
float
>
);
smooth_l1_loss
,
CPU
,
ALL_LAYOUT
,
ops
::
SmoothL1LossKernel
,
float
)
{}
REGISTER_OP_CPU_KERNEL
(
smooth_l1_loss_grad
,
PD_REGISTER_STRUCT_KERNEL
(
ops
::
SmoothL1LossGradKernel
<
phi
::
CPUContext
,
float
>
);
smooth_l1_loss_grad
,
CPU
,
ALL_LAYOUT
,
ops
::
SmoothL1LossGradKernel
,
float
)
{}
paddle/fluid/operators/smooth_l1_loss_op.cu
浏览文件 @
abc44b40
...
@@ -14,7 +14,7 @@ limitations under the License. */
...
@@ -14,7 +14,7 @@ limitations under the License. */
#include "paddle/fluid/operators/smooth_l1_loss_op.h"
#include "paddle/fluid/operators/smooth_l1_loss_op.h"
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP_CUDA_KERNEL
(
smooth_l1_loss
,
PD_REGISTER_STRUCT_KERNEL
(
ops
::
SmoothL1LossKernel
<
phi
::
GPUContext
,
float
>
);
smooth_l1_loss
,
GPU
,
ALL_LAYOUT
,
ops
::
SmoothL1LossKernel
,
float
)
{}
REGISTER_OP_CUDA_KERNEL
(
smooth_l1_loss_grad
,
PD_REGISTER_STRUCT_KERNEL
(
ops
::
SmoothL1LossGradKernel
<
phi
::
GPUContext
,
float
>
);
smooth_l1_loss_grad
,
GPU
,
ALL_LAYOUT
,
ops
::
SmoothL1LossGradKernel
,
float
)
{}
paddle/fluid/operators/smooth_l1_loss_op.h
浏览文件 @
abc44b40
...
@@ -45,7 +45,7 @@ struct SmoothL1LossForward {
...
@@ -45,7 +45,7 @@ struct SmoothL1LossForward {
T
sigma2
;
T
sigma2
;
};
};
template
<
typename
DeviceContext
,
typename
T
,
typename
AttrType
=
T
>
template
<
typename
T
,
typename
DeviceContext
,
typename
AttrType
=
T
>
class
SmoothL1LossKernel
:
public
framework
::
OpKernel
<
T
>
{
class
SmoothL1LossKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
@@ -116,7 +116,7 @@ struct SmoothL1LossBackward {
...
@@ -116,7 +116,7 @@ struct SmoothL1LossBackward {
T
sigma2
;
T
sigma2
;
};
};
template
<
typename
DeviceContext
,
typename
T
,
typename
AttrType
=
T
>
template
<
typename
T
,
typename
DeviceContext
,
typename
AttrType
=
T
>
class
SmoothL1LossGradKernel
:
public
framework
::
OpKernel
<
T
>
{
class
SmoothL1LossGradKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
...
paddle/fluid/operators/space_to_depth_op.cc
浏览文件 @
abc44b40
...
@@ -224,13 +224,19 @@ REGISTER_OPERATOR(space_to_depth,
...
@@ -224,13 +224,19 @@ REGISTER_OPERATOR(space_to_depth,
REGISTER_OPERATOR
(
space_to_depth_grad
,
REGISTER_OPERATOR
(
space_to_depth_grad
,
ops
::
SpaceToDepthGradOp
,
ops
::
SpaceToDepthGradOp
,
ops
::
SpaceToDepthGradOpNoBufferVarsInferer
);
ops
::
SpaceToDepthGradOpNoBufferVarsInferer
);
REGISTER_OP_CPU_KERNEL
(
space_to_depth
,
PD_REGISTER_STRUCT_KERNEL
(
space_to_depth
,
ops
::
SpaceToDepthKernel
<
phi
::
CPUContext
,
float
>
,
CPU
,
ops
::
SpaceToDepthKernel
<
phi
::
CPUContext
,
double
>
,
ALL_LAYOUT
,
ops
::
SpaceToDepthKernel
<
phi
::
CPUContext
,
int
>
,
ops
::
SpaceToDepthKernel
,
ops
::
SpaceToDepthKernel
<
phi
::
CPUContext
,
int64_t
>
);
int
,
REGISTER_OP_CPU_KERNEL
(
space_to_depth_grad
,
int64_t
,
ops
::
SpaceToDepthGradKernel
<
phi
::
CPUContext
,
float
>
,
float
,
ops
::
SpaceToDepthGradKernel
<
phi
::
CPUContext
,
double
>
,
double
)
{}
ops
::
SpaceToDepthGradKernel
<
phi
::
CPUContext
,
int
>
,
PD_REGISTER_STRUCT_KERNEL
(
space_to_depth_grad
,
ops
::
SpaceToDepthGradKernel
<
phi
::
CPUContext
,
int64_t
>
);
CPU
,
ALL_LAYOUT
,
ops
::
SpaceToDepthGradKernel
,
int
,
int64_t
,
float
,
double
)
{}
paddle/fluid/operators/space_to_depth_op.cu
浏览文件 @
abc44b40
...
@@ -17,14 +17,19 @@
...
@@ -17,14 +17,19 @@
namespace
plat
=
paddle
::
platform
;
namespace
plat
=
paddle
::
platform
;
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP_CUDA_KERNEL
(
space_to_depth
,
PD_REGISTER_STRUCT_KERNEL
(
space_to_depth
,
ops
::
SpaceToDepthKernel
<
phi
::
GPUContext
,
float
>
,
GPU
,
ops
::
SpaceToDepthKernel
<
phi
::
GPUContext
,
double
>
,
ALL_LAYOUT
,
ops
::
SpaceToDepthKernel
<
phi
::
GPUContext
,
int
>
,
ops
::
SpaceToDepthKernel
,
ops
::
SpaceToDepthKernel
<
phi
::
GPUContext
,
int64_t
>
);
int
,
int64_t
,
REGISTER_OP_CUDA_KERNEL
(
space_to_depth_grad
,
float
,
ops
::
SpaceToDepthGradKernel
<
phi
::
GPUContext
,
float
>
,
double
)
{}
ops
::
SpaceToDepthGradKernel
<
phi
::
GPUContext
,
double
>
,
PD_REGISTER_STRUCT_KERNEL
(
space_to_depth_grad
,
ops
::
SpaceToDepthGradKernel
<
phi
::
GPUContext
,
int
>
,
GPU
,
ops
::
SpaceToDepthGradKernel
<
phi
::
GPUContext
,
int64_t
>
);
ALL_LAYOUT
,
ops
::
SpaceToDepthGradKernel
,
int
,
int64_t
,
float
,
double
)
{}
paddle/fluid/operators/space_to_depth_op.h
浏览文件 @
abc44b40
...
@@ -67,7 +67,7 @@ class space_to_depth_compute {
...
@@ -67,7 +67,7 @@ class space_to_depth_compute {
T
*
out_
;
T
*
out_
;
};
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SpaceToDepthKernel
:
public
framework
::
OpKernel
<
T
>
{
class
SpaceToDepthKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
@@ -96,7 +96,7 @@ class SpaceToDepthKernel : public framework::OpKernel<T> {
...
@@ -96,7 +96,7 @@ class SpaceToDepthKernel : public framework::OpKernel<T> {
}
}
};
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SpaceToDepthGradKernel
:
public
framework
::
OpKernel
<
T
>
{
class
SpaceToDepthGradKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
...
paddle/fluid/operators/sparse_attention_op.cu
浏览文件 @
abc44b40
...
@@ -653,7 +653,7 @@ std::vector<phi::DenseTensor> GetSplitTensor(phi::DenseTensor* input) {
...
@@ -653,7 +653,7 @@ std::vector<phi::DenseTensor> GetSplitTensor(phi::DenseTensor* input) {
return
input
->
Split
(
1
,
0
);
return
input
->
Split
(
1
,
0
);
}
}
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SparseAttentionCUDAKernel
:
public
framework
::
OpKernel
<
T
>
{
class
SparseAttentionCUDAKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
...
@@ -773,7 +773,7 @@ class SparseAttentionCUDAKernel : public framework::OpKernel<T> {
...
@@ -773,7 +773,7 @@ class SparseAttentionCUDAKernel : public framework::OpKernel<T> {
}
}
};
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SparseAttentionGradCUDAKernel
:
public
framework
::
OpKernel
<
T
>
{
class
SparseAttentionGradCUDAKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
...
@@ -890,12 +890,17 @@ class SparseAttentionGradCUDAKernel : public framework::OpKernel<T> {
...
@@ -890,12 +890,17 @@ class SparseAttentionGradCUDAKernel : public framework::OpKernel<T> {
}
// namespace operators
}
// namespace operators
}
// namespace paddle
}
// namespace paddle
REGISTER_OP_CUDA_KERNEL
(
sparse_attention
,
namespace
ops
=
paddle
::
operators
;
ops
::
SparseAttentionCUDAKernel
<
phi
::
GPUContext
,
float
>
,
PD_REGISTER_STRUCT_KERNEL
(
sparse_attention
,
ops
::
SparseAttentionCUDAKernel
<
phi
::
GPUContext
,
double
>
);
GPU
,
ALL_LAYOUT
,
REGISTER_OP_CUDA_KERNEL
(
ops
::
SparseAttentionCUDAKernel
,
sparse_attention_grad
,
float
,
ops
::
SparseAttentionGradCUDAKernel
<
phi
::
GPUContext
,
float
>
,
double
)
{}
ops
::
SparseAttentionGradCUDAKernel
<
phi
::
GPUContext
,
double
>
);
PD_REGISTER_STRUCT_KERNEL
(
sparse_attention_grad
,
GPU
,
ALL_LAYOUT
,
ops
::
SparseAttentionGradCUDAKernel
,
float
,
double
)
{}
paddle/fluid/operators/spp_op.cc
浏览文件 @
abc44b40
...
@@ -109,9 +109,8 @@ REGISTER_OPERATOR(
...
@@ -109,9 +109,8 @@ REGISTER_OPERATOR(
paddle
::
framework
::
DefaultGradOpMaker
<
paddle
::
framework
::
OpDesc
,
true
>
,
paddle
::
framework
::
DefaultGradOpMaker
<
paddle
::
framework
::
OpDesc
,
true
>
,
paddle
::
framework
::
DefaultGradOpMaker
<
paddle
::
imperative
::
OpBase
,
true
>
);
paddle
::
framework
::
DefaultGradOpMaker
<
paddle
::
imperative
::
OpBase
,
true
>
);
REGISTER_OPERATOR
(
spp_grad
,
ops
::
SppOpGrad
);
REGISTER_OPERATOR
(
spp_grad
,
ops
::
SppOpGrad
);
REGISTER_OP_CPU_KERNEL
(
spp
,
ops
::
SppKernel
<
phi
::
CPUContext
,
float
>
,
PD_REGISTER_STRUCT_KERNEL
(
spp
,
CPU
,
ALL_LAYOUT
,
ops
::
SppKernel
,
float
,
double
)
{
ops
::
SppKernel
<
phi
::
CPUContext
,
double
>
);
}
REGISTER_OP_CPU_KERNEL
(
spp_grad
,
PD_REGISTER_STRUCT_KERNEL
(
ops
::
SppGradKernel
<
phi
::
CPUContext
,
float
>
,
spp_grad
,
CPU
,
ALL_LAYOUT
,
ops
::
SppGradKernel
,
float
,
double
)
{}
ops
::
SppGradKernel
<
phi
::
CPUContext
,
double
>
);
paddle/fluid/operators/spp_op.cu.cc
浏览文件 @
abc44b40
...
@@ -15,9 +15,8 @@ limitations under the License. */
...
@@ -15,9 +15,8 @@ limitations under the License. */
#include "paddle/fluid/operators/spp_op.h"
#include "paddle/fluid/operators/spp_op.h"
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OP_CUDA_KERNEL
(
spp
,
ops
::
SppKernel
<
phi
::
GPUContext
,
float
>
,
PD_REGISTER_STRUCT_KERNEL
(
spp
,
GPU
,
ALL_LAYOUT
,
ops
::
SppKernel
,
float
,
double
)
{
ops
::
SppKernel
<
phi
::
GPUContext
,
double
>
);
}
REGISTER_OP_CUDA_KERNEL
(
spp_grad
,
PD_REGISTER_STRUCT_KERNEL
(
ops
::
SppGradKernel
<
phi
::
GPUContext
,
float
>
,
spp_grad
,
GPU
,
ALL_LAYOUT
,
ops
::
SppGradKernel
,
float
,
double
)
{}
ops
::
SppGradKernel
<
phi
::
GPUContext
,
double
>
);
paddle/fluid/operators/spp_op.h
浏览文件 @
abc44b40
...
@@ -24,7 +24,7 @@ limitations under the License. */
...
@@ -24,7 +24,7 @@ limitations under the License. */
namespace
paddle
{
namespace
paddle
{
namespace
operators
{
namespace
operators
{
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SppKernel
:
public
framework
::
OpKernel
<
T
>
{
class
SppKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
@@ -107,7 +107,7 @@ class SppKernel : public framework::OpKernel<T> {
...
@@ -107,7 +107,7 @@ class SppKernel : public framework::OpKernel<T> {
}
}
}
}
};
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
SppGradKernel
:
public
framework
::
OpKernel
<
T
>
{
class
SppGradKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录