Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
2f499713
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
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看板
未验证
提交
2f499713
编写于
4月 14, 2023
作者:
H
huangjiyi
提交者:
GitHub
4月 14, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update (#52880)
上级
54e4360a
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
122 addition
and
84 deletion
+122
-84
paddle/fluid/operators/hash_op.cc
paddle/fluid/operators/hash_op.cc
+3
-1
paddle/fluid/operators/hash_op.h
paddle/fluid/operators/hash_op.h
+1
-1
paddle/fluid/operators/hinge_loss_op.cc
paddle/fluid/operators/hinge_loss_op.cc
+12
-9
paddle/fluid/operators/hinge_loss_op.h
paddle/fluid/operators/hinge_loss_op.h
+2
-2
paddle/fluid/operators/im2sequence_op.cc
paddle/fluid/operators/im2sequence_op.cc
+12
-9
paddle/fluid/operators/im2sequence_op.h
paddle/fluid/operators/im2sequence_op.h
+2
-2
paddle/fluid/operators/inplace_abn_op.cc
paddle/fluid/operators/inplace_abn_op.cc
+10
-8
paddle/fluid/operators/inplace_abn_op.cu
paddle/fluid/operators/inplace_abn_op.cu
+14
-12
paddle/fluid/operators/limit_by_capacity_op.cc
paddle/fluid/operators/limit_by_capacity_op.cc
+7
-4
paddle/fluid/operators/limit_by_capacity_op.cu
paddle/fluid/operators/limit_by_capacity_op.cu
+6
-5
paddle/fluid/operators/limit_by_capacity_op.h
paddle/fluid/operators/limit_by_capacity_op.h
+1
-1
paddle/fluid/operators/linear_chain_crf_op.cc
paddle/fluid/operators/linear_chain_crf_op.cc
+13
-7
paddle/fluid/operators/linear_chain_crf_op.h
paddle/fluid/operators/linear_chain_crf_op.h
+2
-2
paddle/fluid/operators/margin_rank_loss_op.cc
paddle/fluid/operators/margin_rank_loss_op.cc
+8
-4
paddle/fluid/operators/margin_rank_loss_op.cu
paddle/fluid/operators/margin_rank_loss_op.cu
+7
-4
paddle/fluid/operators/margin_rank_loss_op.h
paddle/fluid/operators/margin_rank_loss_op.h
+2
-2
paddle/fluid/operators/modified_huber_loss_op.cc
paddle/fluid/operators/modified_huber_loss_op.cc
+8
-4
paddle/fluid/operators/modified_huber_loss_op.cu
paddle/fluid/operators/modified_huber_loss_op.cu
+10
-5
paddle/fluid/operators/modified_huber_loss_op.h
paddle/fluid/operators/modified_huber_loss_op.h
+2
-2
未找到文件。
paddle/fluid/operators/hash_op.cc
浏览文件 @
2f499713
...
...
@@ -79,4 +79,6 @@ class HashOpMaker : public framework::OpProtoAndCheckerMaker {
namespace
ops
=
paddle
::
operators
;
REGISTER_OP_WITHOUT_GRADIENT
(
hash
,
ops
::
HashOp
,
ops
::
HashOpMaker
);
REGISTER_OP_CPU_KERNEL
(
hash
,
ops
::
HashKernel
<
int
>
,
ops
::
HashKernel
<
int64_t
>
);
PD_REGISTER_STRUCT_KERNEL
(
hash
,
CPU
,
ALL_LAYOUT
,
ops
::
HashKernel
,
int
,
int64_t
)
{}
paddle/fluid/operators/hash_op.h
浏览文件 @
2f499713
...
...
@@ -38,7 +38,7 @@ inline void HashOutputSize(const framework::DDim& in_dims,
out_dims
.
emplace_back
(
1
);
}
template
<
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
HashKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
virtual
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
{
...
...
paddle/fluid/operators/hinge_loss_op.cc
浏览文件 @
2f499713
...
...
@@ -150,12 +150,15 @@ REGISTER_OPERATOR(hinge_loss,
ops
::
HingeLossGradOpMaker
<
paddle
::
framework
::
OpDesc
>
,
ops
::
HingeLossGradOpMaker
<
paddle
::
imperative
::
OpBase
>
);
REGISTER_OPERATOR
(
hinge_loss_grad
,
ops
::
HingeLossGradOp
);
REGISTER_OP_CPU_KERNEL
(
hinge_loss
,
ops
::
HingeLossKernel
<
phi
::
CPUContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
hinge_loss_grad
,
ops
::
HingeLossGradKernel
<
phi
::
CPUContext
,
float
>
);
REGISTER_OP_CUDA_KERNEL
(
hinge_loss
,
ops
::
HingeLossKernel
<
phi
::
GPUContext
,
float
>
);
REGISTER_OP_CUDA_KERNEL
(
hinge_loss_grad
,
ops
::
HingeLossGradKernel
<
phi
::
GPUContext
,
float
>
);
PD_REGISTER_STRUCT_KERNEL
(
hinge_loss
,
CPU
,
ALL_LAYOUT
,
ops
::
HingeLossKernel
,
float
)
{}
PD_REGISTER_STRUCT_KERNEL
(
hinge_loss_grad
,
CPU
,
ALL_LAYOUT
,
ops
::
HingeLossGradKernel
,
float
)
{}
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
PD_REGISTER_STRUCT_KERNEL
(
hinge_loss
,
GPU
,
ALL_LAYOUT
,
ops
::
HingeLossKernel
,
float
)
{}
PD_REGISTER_STRUCT_KERNEL
(
hinge_loss_grad
,
GPU
,
ALL_LAYOUT
,
ops
::
HingeLossGradKernel
,
float
)
{}
#endif
paddle/fluid/operators/hinge_loss_op.h
浏览文件 @
2f499713
...
...
@@ -20,7 +20,7 @@ limitations under the License. */
namespace
paddle
{
namespace
operators
{
template
<
typename
DeviceContext
,
typename
T
,
typename
AttrType
=
T
>
template
<
typename
T
,
typename
DeviceContext
,
typename
AttrType
=
T
>
class
HingeLossKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
...
@@ -38,7 +38,7 @@ class HingeLossKernel : public framework::OpKernel<T> {
}
};
template
<
typename
DeviceContext
,
typename
T
,
typename
AttrType
=
T
>
template
<
typename
T
,
typename
DeviceContext
,
typename
AttrType
=
T
>
class
HingeLossGradKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
...
paddle/fluid/operators/im2sequence_op.cc
浏览文件 @
2f499713
...
...
@@ -195,12 +195,15 @@ REGISTER_OPERATOR(im2sequence,
ops
::
Im2SequenceGradMaker
<
paddle
::
framework
::
OpDesc
>
,
ops
::
Im2SequenceGradMaker
<
paddle
::
imperative
::
OpBase
>
);
REGISTER_OPERATOR
(
im2sequence_grad
,
ops
::
Im2SequenceGradOp
);
REGISTER_OP_CPU_KERNEL
(
im2sequence
,
ops
::
Im2SequenceKernel
<
phi
::
CPUContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
im2sequence_grad
,
ops
::
Im2SequenceGradKernel
<
phi
::
CPUContext
,
float
>
);
REGISTER_OP_CUDA_KERNEL
(
im2sequence
,
ops
::
Im2SequenceKernel
<
phi
::
GPUContext
,
float
>
);
REGISTER_OP_CUDA_KERNEL
(
im2sequence_grad
,
ops
::
Im2SequenceGradKernel
<
phi
::
GPUContext
,
float
>
);
PD_REGISTER_STRUCT_KERNEL
(
im2sequence
,
CPU
,
ALL_LAYOUT
,
ops
::
Im2SequenceKernel
,
float
)
{}
PD_REGISTER_STRUCT_KERNEL
(
im2sequence_grad
,
CPU
,
ALL_LAYOUT
,
ops
::
Im2SequenceGradKernel
,
float
)
{}
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
PD_REGISTER_STRUCT_KERNEL
(
im2sequence
,
GPU
,
ALL_LAYOUT
,
ops
::
Im2SequenceKernel
,
float
)
{}
PD_REGISTER_STRUCT_KERNEL
(
im2sequence_grad
,
GPU
,
ALL_LAYOUT
,
ops
::
Im2SequenceGradKernel
,
float
)
{}
#endif
paddle/fluid/operators/im2sequence_op.h
浏览文件 @
2f499713
...
...
@@ -33,7 +33,7 @@ inline int Im2SeqOutputSize(
return
output_size
;
}
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
Im2SequenceKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
...
...
@@ -153,7 +153,7 @@ class Im2SequenceKernel : public framework::OpKernel<T> {
}
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
Im2SequenceGradKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
...
...
paddle/fluid/operators/inplace_abn_op.cc
浏览文件 @
2f499713
...
...
@@ -210,7 +210,7 @@ class InplaceABNOpGradMaker : public framework::SingleGradOpMaker<T> {
}
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
InplaceABNKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
...
...
@@ -270,7 +270,7 @@ class InplaceABNKernel : public framework::OpKernel<T> {
}
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
InplaceABNGradKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
...
...
@@ -373,9 +373,11 @@ REGISTER_OPERATOR(inplace_abn,
InplaceAbnOpInplaceInferer
)
REGISTER_OPERATOR
(
inplace_abn_grad
,
ops
::
InplaceABNGradOp
)
REGISTER_OP_CPU_KERNEL
(
inplace_abn
,
ops
::
InplaceABNKernel
<
phi
::
CPUContext
,
float
>
,
ops
::
InplaceABNKernel
<
phi
::
CPUContext
,
double
>
);
REGISTER_OP_CPU_KERNEL
(
inplace_abn_grad
,
ops
::
InplaceABNGradKernel
<
phi
::
CPUContext
,
float
>
,
ops
::
InplaceABNGradKernel
<
phi
::
CPUContext
,
double
>
);
PD_REGISTER_STRUCT_KERNEL
(
inplace_abn
,
CPU
,
ALL_LAYOUT
,
ops
::
InplaceABNKernel
,
float
,
double
)
{}
PD_REGISTER_STRUCT_KERNEL
(
inplace_abn_grad
,
CPU
,
ALL_LAYOUT
,
ops
::
InplaceABNGradKernel
,
float
,
double
)
{}
paddle/fluid/operators/inplace_abn_op.cu
浏览文件 @
2f499713
...
...
@@ -23,7 +23,7 @@ limitations under the License. */
namespace
paddle
{
namespace
operators
{
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
InplaceABNKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
...
...
@@ -109,7 +109,7 @@ class InplaceABNKernel : public framework::OpKernel<T> {
// Deriving the Gradient for the Backward Pass of Batch Normalization
// https://kevinzakka.github.io/2016/09/14/batch_normalization/
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
InplaceABNGradKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
...
...
@@ -221,15 +221,17 @@ namespace ops = paddle::operators;
namespace
plat
=
paddle
::
platform
;
#ifdef PADDLE_WITH_HIP
// MIOPEN do not support double
REGISTER_OP_CUDA_KERNEL
(
inplace_abn
,
ops
::
InplaceABNKernel
<
phi
::
GPUContext
,
float
>
);
REGISTER_OP_CUDA_KERNEL
(
inplace_abn_grad
,
ops
::
InplaceABNGradKernel
<
phi
::
GPUContext
,
float
>
);
PD_REGISTER_STRUCT_KERNEL
(
inplace_abn
,
GPU
,
ALL_LAYOUT
,
ops
::
InplaceABNKernel
,
float
)
{}
PD_REGISTER_STRUCT_KERNEL
(
inplace_abn_grad
,
GPU
,
ALL_LAYOUT
,
ops
::
InplaceABNGradKernel
,
float
)
{}
#else
REGISTER_OP_CUDA_KERNEL
(
inplace_abn
,
ops
::
InplaceABNKernel
<
phi
::
GPUContext
,
float
>
,
ops
::
InplaceABNKernel
<
phi
::
GPUContext
,
double
>
);
REGISTER_OP_CUDA_KERNEL
(
inplace_abn_grad
,
ops
::
InplaceABNGradKernel
<
phi
::
GPUContext
,
float
>
,
ops
::
InplaceABNGradKernel
<
phi
::
GPUContext
,
double
>
);
PD_REGISTER_STRUCT_KERNEL
(
inplace_abn
,
GPU
,
ALL_LAYOUT
,
ops
::
InplaceABNKernel
,
float
,
double
)
{}
PD_REGISTER_STRUCT_KERNEL
(
inplace_abn_grad
,
GPU
,
ALL_LAYOUT
,
ops
::
InplaceABNGradKernel
,
float
,
double
)
{}
#endif
paddle/fluid/operators/limit_by_capacity_op.cc
浏览文件 @
2f499713
...
...
@@ -77,10 +77,13 @@ class LimitByCapacityOpMaker : public framework::OpProtoAndCheckerMaker {
namespace
ops
=
paddle
::
operators
;
namespace
plat
=
paddle
::
platform
;
REGISTER_OP_CPU_KERNEL
(
limit_by_capacity
,
ops
::
LimitByCapacityOpCPUKernel
<
int
>
,
ops
::
LimitByCapacityOpCPUKernel
<
int64_t
>
);
REGISTER_OP_WITHOUT_GRADIENT
(
limit_by_capacity
,
ops
::
LimitByCapacityOp
,
ops
::
LimitByCapacityOpMaker
);
PD_REGISTER_STRUCT_KERNEL
(
limit_by_capacity
,
CPU
,
ALL_LAYOUT
,
ops
::
LimitByCapacityOpCPUKernel
,
int
,
int64_t
)
{}
paddle/fluid/operators/limit_by_capacity_op.cu
浏览文件 @
2f499713
...
...
@@ -47,7 +47,7 @@ __global__ void limit_by_capacity_impl(
}
}
template
<
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
LimitByCapacityOpCUDAKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
...
@@ -78,7 +78,8 @@ class LimitByCapacityOpCUDAKernel : public framework::OpKernel<T> {
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
namespace
plat
=
paddle
::
platform
;
REGISTER_OP_CUDA_KERNEL
(
limit_by_capacity
,
ops
::
LimitByCapacityOpCUDAKernel
<
int64_t
>
);
PD_REGISTER_STRUCT_KERNEL
(
limit_by_capacity
,
GPU
,
ALL_LAYOUT
,
ops
::
LimitByCapacityOpCUDAKernel
,
int64_t
)
{}
paddle/fluid/operators/limit_by_capacity_op.h
浏览文件 @
2f499713
...
...
@@ -24,7 +24,7 @@
namespace
paddle
{
namespace
operators
{
template
<
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
LimitByCapacityOpCPUKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
...
...
paddle/fluid/operators/linear_chain_crf_op.cc
浏览文件 @
2f499713
...
...
@@ -395,10 +395,16 @@ REGISTER_OPERATOR(linear_chain_crf,
REGISTER_OPERATOR
(
linear_chain_crf_grad
,
ops
::
LinearChainCRFGradOp
,
ops
::
LinearChainCRFGradNoNeedBufferVarsInferer
);
REGISTER_OP_CPU_KERNEL
(
linear_chain_crf
,
ops
::
LinearChainCRFOpKernel
<
phi
::
CPUContext
,
float
>
,
ops
::
LinearChainCRFOpKernel
<
phi
::
CPUContext
,
double
>
);
REGISTER_OP_CPU_KERNEL
(
linear_chain_crf_grad
,
ops
::
LinearChainCRFGradOpKernel
<
phi
::
CPUContext
,
float
>
,
ops
::
LinearChainCRFGradOpKernel
<
phi
::
CPUContext
,
double
>
);
PD_REGISTER_STRUCT_KERNEL
(
linear_chain_crf
,
CPU
,
ALL_LAYOUT
,
ops
::
LinearChainCRFOpKernel
,
float
,
double
)
{}
PD_REGISTER_STRUCT_KERNEL
(
linear_chain_crf_grad
,
CPU
,
ALL_LAYOUT
,
ops
::
LinearChainCRFGradOpKernel
,
float
,
double
)
{}
paddle/fluid/operators/linear_chain_crf_op.h
浏览文件 @
2f499713
...
...
@@ -48,7 +48,7 @@ struct ScalarMul {
using
framework
::
LoD
;
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
LinearChainCRFOpKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
...
...
@@ -245,7 +245,7 @@ class LinearChainCRFOpKernel : public framework::OpKernel<T> {
}
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
LinearChainCRFGradOpKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
...
...
paddle/fluid/operators/margin_rank_loss_op.cc
浏览文件 @
2f499713
...
...
@@ -181,7 +181,11 @@ REGISTER_OPERATOR(margin_rank_loss,
ops
::
MarginRankLossGradMaker
<
paddle
::
framework
::
OpDesc
>
,
ops
::
MarginRankLossGradMaker
<
paddle
::
imperative
::
OpBase
>
);
REGISTER_OPERATOR
(
margin_rank_loss_grad
,
ops
::
MarginRankLossGradOp
);
REGISTER_OP_CPU_KERNEL
(
margin_rank_loss
,
ops
::
MarginRankLossKernel
<
phi
::
CPUContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
margin_rank_loss_grad
,
ops
::
MarginRankLossGradKernel
<
phi
::
CPUContext
,
float
>
);
PD_REGISTER_STRUCT_KERNEL
(
margin_rank_loss
,
CPU
,
ALL_LAYOUT
,
ops
::
MarginRankLossKernel
,
float
)
{}
PD_REGISTER_STRUCT_KERNEL
(
margin_rank_loss_grad
,
CPU
,
ALL_LAYOUT
,
ops
::
MarginRankLossGradKernel
,
float
)
{}
paddle/fluid/operators/margin_rank_loss_op.cu
浏览文件 @
2f499713
...
...
@@ -16,7 +16,10 @@ limitations under the License. */
namespace
ops
=
paddle
::
operators
;
REGISTER_OP_CUDA_KERNEL
(
margin_rank_loss
,
ops
::
MarginRankLossKernel
<
phi
::
GPUContext
,
float
>
);
REGISTER_OP_CUDA_KERNEL
(
margin_rank_loss_grad
,
ops
::
MarginRankLossGradKernel
<
phi
::
GPUContext
,
float
>
);
PD_REGISTER_STRUCT_KERNEL
(
margin_rank_loss
,
GPU
,
ALL_LAYOUT
,
ops
::
MarginRankLossKernel
,
float
)
{}
PD_REGISTER_STRUCT_KERNEL
(
margin_rank_loss_grad
,
GPU
,
ALL_LAYOUT
,
ops
::
MarginRankLossGradKernel
,
float
)
{}
paddle/fluid/operators/margin_rank_loss_op.h
浏览文件 @
2f499713
...
...
@@ -34,7 +34,7 @@ struct Heaviside {
}
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
MarginRankLossKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
{
...
...
@@ -62,7 +62,7 @@ class MarginRankLossKernel : public framework::OpKernel<T> {
}
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
MarginRankLossGradKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
{
...
...
paddle/fluid/operators/modified_huber_loss_op.cc
浏览文件 @
2f499713
...
...
@@ -176,7 +176,11 @@ REGISTER_OPERATOR(
ops
::
ModifiedHuberLossGradOpMaker
<
paddle
::
imperative
::
OpBase
>
);
REGISTER_OPERATOR
(
modified_huber_loss_grad
,
ops
::
ModifiedHuberLossGradOp
);
REGISTER_OP_CPU_KERNEL
(
modified_huber_loss
,
ops
::
ModifiedHuberLossKernel
<
phi
::
CPUContext
,
float
>
);
REGISTER_OP_CPU_KERNEL
(
modified_huber_loss_grad
,
ops
::
ModifiedHuberLossGradCPUKernel
<
float
>
);
PD_REGISTER_STRUCT_KERNEL
(
modified_huber_loss
,
CPU
,
ALL_LAYOUT
,
ops
::
ModifiedHuberLossKernel
,
float
)
{
}
PD_REGISTER_STRUCT_KERNEL
(
modified_huber_loss_grad
,
CPU
,
ALL_LAYOUT
,
ops
::
ModifiedHuberLossGradCPUKernel
,
float
)
{}
paddle/fluid/operators/modified_huber_loss_op.cu
浏览文件 @
2f499713
...
...
@@ -39,7 +39,7 @@ struct ModifiedHuberLossBackward {
}
};
template
<
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
ModifiedHuberLossGradGPUKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
...
@@ -74,7 +74,12 @@ class ModifiedHuberLossGradGPUKernel : public framework::OpKernel<T> {
}
// namespace paddle
namespace
ops
=
paddle
::
operators
;
REGISTER_OP_CUDA_KERNEL
(
modified_huber_loss
,
ops
::
ModifiedHuberLossKernel
<
phi
::
GPUContext
,
float
>
);
REGISTER_OP_CUDA_KERNEL
(
modified_huber_loss_grad
,
ops
::
ModifiedHuberLossGradGPUKernel
<
float
>
);
PD_REGISTER_STRUCT_KERNEL
(
modified_huber_loss
,
GPU
,
ALL_LAYOUT
,
ops
::
ModifiedHuberLossKernel
,
float
)
{
}
PD_REGISTER_STRUCT_KERNEL
(
modified_huber_loss_grad
,
GPU
,
ALL_LAYOUT
,
ops
::
ModifiedHuberLossGradGPUKernel
,
float
)
{}
paddle/fluid/operators/modified_huber_loss_op.h
浏览文件 @
2f499713
...
...
@@ -52,7 +52,7 @@ struct ModifiedHuberLossForward {
}
};
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
ModifiedHuberLossKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
...
...
@@ -79,7 +79,7 @@ class ModifiedHuberLossKernel : public framework::OpKernel<T> {
};
// CPU backward kernel
template
<
typename
T
>
template
<
typename
T
,
typename
DeviceContext
>
class
ModifiedHuberLossGradCPUKernel
:
public
framework
::
OpKernel
<
T
>
{
public:
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录