Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
39f365c4
P
Paddle
项目概览
PaddlePaddle
/
Paddle
接近 2 年 前同步成功
通知
2323
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看板
未验证
提交
39f365c4
编写于
5月 19, 2023
作者:
G
Galaxy1458
提交者:
GitHub
5月 19, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test,test=develop (#53847)
上级
16fcbb9b
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
64 addition
and
62 deletion
+64
-62
paddle/phi/kernels/cpu/viterbi_decode_kernel.cc
paddle/phi/kernels/cpu/viterbi_decode_kernel.cc
+1
-1
paddle/phi/kernels/cpu/yolo_loss_grad_kernel.cc
paddle/phi/kernels/cpu/yolo_loss_grad_kernel.cc
+5
-5
paddle/phi/kernels/funcs/activation_functor.h
paddle/phi/kernels/funcs/activation_functor.h
+1
-1
paddle/phi/kernels/funcs/adam_functors.h
paddle/phi/kernels/funcs/adam_functors.h
+1
-1
paddle/phi/kernels/funcs/blas/blas_impl.h
paddle/phi/kernels/funcs/blas/blas_impl.h
+1
-1
paddle/phi/kernels/funcs/deformable_conv_functor.cc
paddle/phi/kernels/funcs/deformable_conv_functor.cc
+1
-1
paddle/phi/kernels/funcs/detail/gru_cpu_kernel.h
paddle/phi/kernels/funcs/detail/gru_cpu_kernel.h
+3
-3
paddle/phi/kernels/funcs/elementwise_functor.h
paddle/phi/kernels/funcs/elementwise_functor.h
+4
-4
paddle/phi/kernels/funcs/fft.cc
paddle/phi/kernels/funcs/fft.cc
+3
-3
paddle/phi/kernels/funcs/functors.h
paddle/phi/kernels/funcs/functors.h
+11
-11
paddle/phi/kernels/funcs/im2col.cc
paddle/phi/kernels/funcs/im2col.cc
+8
-8
paddle/phi/kernels/funcs/isfinite_functor.h
paddle/phi/kernels/funcs/isfinite_functor.h
+3
-3
paddle/phi/kernels/funcs/layer_norm_util.h
paddle/phi/kernels/funcs/layer_norm_util.h
+3
-1
paddle/phi/kernels/funcs/math_function.cc
paddle/phi/kernels/funcs/math_function.cc
+1
-1
paddle/phi/kernels/funcs/pooling.cc
paddle/phi/kernels/funcs/pooling.cc
+8
-8
paddle/phi/kernels/funcs/pooling.h
paddle/phi/kernels/funcs/pooling.h
+3
-3
paddle/phi/kernels/funcs/selected_rows_functor.cc
paddle/phi/kernels/funcs/selected_rows_functor.cc
+1
-1
paddle/phi/kernels/funcs/sequence2batch.cc
paddle/phi/kernels/funcs/sequence2batch.cc
+1
-1
paddle/phi/kernels/funcs/sequence_pooling.cc
paddle/phi/kernels/funcs/sequence_pooling.cc
+5
-5
未找到文件。
paddle/phi/kernels/cpu/viterbi_decode_kernel.cc
浏览文件 @
39f365c4
...
@@ -34,7 +34,7 @@ namespace phi {
...
@@ -34,7 +34,7 @@ namespace phi {
template
<
typename
Context
,
typename
T
,
typename
IndType
>
template
<
typename
Context
,
typename
T
,
typename
IndType
>
struct
Argmax
{
struct
Argmax
{
void
operator
()(
const
Context
&
dev_ctx
,
void
operator
()(
const
Context
&
dev_ctx
UNUSED
,
const
DenseTensor
&
input
,
const
DenseTensor
&
input
,
DenseTensor
*
out_idx
,
DenseTensor
*
out_idx
,
DenseTensor
*
out
,
DenseTensor
*
out
,
...
...
paddle/phi/kernels/cpu/yolo_loss_grad_kernel.cc
浏览文件 @
39f365c4
...
@@ -128,14 +128,14 @@ void YoloLossGradKernel(const Context& dev_ctx,
...
@@ -128,14 +128,14 @@ void YoloLossGradKernel(const Context& dev_ctx,
const
std
::
vector
<
int
>&
anchors
,
const
std
::
vector
<
int
>&
anchors
,
const
std
::
vector
<
int
>&
anchor_mask
,
const
std
::
vector
<
int
>&
anchor_mask
,
int
class_num
,
int
class_num
,
float
ignore_thresh
,
float
ignore_thresh
UNUSED
,
int
downsample_ratio
,
int
downsample_ratio
,
bool
use_label_smooth
,
bool
use_label_smooth
,
float
scale_x_y
,
float
scale_x_y
UNUSED
,
DenseTensor
*
x_grad
,
DenseTensor
*
x_grad
,
DenseTensor
*
gt_box_grad
,
DenseTensor
*
gt_box_grad
UNUSED
,
DenseTensor
*
gt_label_grad
,
DenseTensor
*
gt_label_grad
UNUSED
,
DenseTensor
*
gt_score_grad
)
{
DenseTensor
*
gt_score_grad
UNUSED
)
{
auto
*
input
=
&
x
;
auto
*
input
=
&
x
;
auto
input_grad
=
x_grad
;
auto
input_grad
=
x_grad
;
auto
*
objness_mask
=
&
objectness_mask
;
auto
*
objness_mask
=
&
objectness_mask
;
...
...
paddle/phi/kernels/funcs/activation_functor.h
浏览文件 @
39f365c4
...
@@ -1651,7 +1651,7 @@ struct ELUGradFunctor : public BaseActivationFunctor<T> {
...
@@ -1651,7 +1651,7 @@ struct ELUGradFunctor : public BaseActivationFunctor<T> {
typename
Out
,
typename
Out
,
typename
dOut
,
typename
dOut
,
typename
dX
>
typename
dX
>
void
operator
()(
Device
d
,
X
x
,
Out
out
,
dOut
dout
,
dX
dx
)
const
{
void
operator
()(
Device
d
,
X
x
UNUSED
,
Out
out
,
dOut
dout
,
dX
dx
)
const
{
// case 1: alpha >= 0
// case 1: alpha >= 0
// dx = dout, if out > 0
// dx = dout, if out > 0
// dx = dout * (out + alpha), if out <= 0
// dx = dout * (out + alpha), if out <= 0
...
...
paddle/phi/kernels/funcs/adam_functors.h
浏览文件 @
39f365c4
...
@@ -455,7 +455,7 @@ class SparseAdamFunctor<T, CPUAdam, T> {
...
@@ -455,7 +455,7 @@ class SparseAdamFunctor<T, CPUAdam, T> {
const
int64_t
*
rows
,
const
int64_t
*
rows
,
int64_t
row_numel
,
int64_t
row_numel
,
int64_t
row_count
,
int64_t
row_count
,
bool
lazy_mode
)
bool
lazy_mode
UNUSED
)
:
beta1_
(
beta1
),
:
beta1_
(
beta1
),
beta2_
(
beta2
),
beta2_
(
beta2
),
epsilon_
(
epsilon
),
epsilon_
(
epsilon
),
...
...
paddle/phi/kernels/funcs/blas/blas_impl.h
浏览文件 @
39f365c4
...
@@ -71,7 +71,7 @@ struct CBlas<phi::dtype::bfloat16> {
...
@@ -71,7 +71,7 @@ struct CBlas<phi::dtype::bfloat16> {
}
}
template
<
typename
...
ARGS
>
template
<
typename
...
ARGS
>
static
void
VCOPY
(
ARGS
...
args
)
{
static
void
VCOPY
(
ARGS
...
args
UNUSED
)
{
PADDLE_THROW
(
phi
::
errors
::
Unimplemented
(
PADDLE_THROW
(
phi
::
errors
::
Unimplemented
(
"Blas VCOPY do not supported on CPU with bfloat16,"
"Blas VCOPY do not supported on CPU with bfloat16,"
" please check your code"
));
" please check your code"
));
...
...
paddle/phi/kernels/funcs/deformable_conv_functor.cc
浏览文件 @
39f365c4
...
@@ -99,7 +99,7 @@ inline void ModulatedDeformableIm2colCPUKernel(
...
@@ -99,7 +99,7 @@ inline void ModulatedDeformableIm2colCPUKernel(
}
}
template
<
typename
T
,
typename
Context
>
template
<
typename
T
,
typename
Context
>
void
ModulatedDeformableIm2col
(
const
Context
&
dev_ctx
,
void
ModulatedDeformableIm2col
(
const
Context
&
dev_ctx
UNUSED
,
const
T
*
data_im
,
const
T
*
data_im
,
const
T
*
data_offset
,
const
T
*
data_offset
,
const
T
*
data_mask
,
const
T
*
data_mask
,
...
...
paddle/phi/kernels/funcs/detail/gru_cpu_kernel.h
浏览文件 @
39f365c4
...
@@ -932,13 +932,13 @@ inline void gru_backward(const Context &context,
...
@@ -932,13 +932,13 @@ inline void gru_backward(const Context &context,
template
<
class
OpGruGrad
,
typename
T
,
typename
Context
>
template
<
class
OpGruGrad
,
typename
T
,
typename
Context
>
inline
void
cpu_gru_backward
(
const
Context
&
context
,
inline
void
cpu_gru_backward
(
const
Context
&
context
,
OpGruGrad
op_gru_grad
,
OpGruGrad
op_gru_grad
UNUSED
,
phi
::
funcs
::
GRUMetaValue
<
T
>
value
,
phi
::
funcs
::
GRUMetaValue
<
T
>
value
,
phi
::
funcs
::
GRUMetaGrad
<
T
>
grad
,
phi
::
funcs
::
GRUMetaGrad
<
T
>
grad
,
int
frame_size
,
int
frame_size
,
int
batch_size
,
int
batch_size
,
ActivationType
active_node
,
ActivationType
active_node
UNUSED
,
ActivationType
active_gate
)
{
ActivationType
active_gate
UNUSED
)
{
for
(
int
b
=
0
;
b
<
batch_size
;
++
b
)
{
for
(
int
b
=
0
;
b
<
batch_size
;
++
b
)
{
// eigen
// eigen
gru_backward
(
context
,
value
,
grad
,
frame_size
);
gru_backward
(
context
,
value
,
grad
,
frame_size
);
...
...
paddle/phi/kernels/funcs/elementwise_functor.h
浏览文件 @
39f365c4
...
@@ -274,7 +274,7 @@ struct FMaxFunctor<int64_t> {
...
@@ -274,7 +274,7 @@ struct FMaxFunctor<int64_t> {
template
<
typename
T
>
template
<
typename
T
>
struct
FMaxGradDx
{
struct
FMaxGradDx
{
HOSTDEVICE
T
operator
()(
T
x
,
T
y
,
T
out
,
T
dout
)
const
{
HOSTDEVICE
T
operator
()(
T
x
,
T
y
,
T
out
UNUSED
,
T
dout
)
const
{
return
dout
*
static_cast
<
T
>
((
x
>=
y
)
||
isnan
(
y
));
return
dout
*
static_cast
<
T
>
((
x
>=
y
)
||
isnan
(
y
));
}
}
};
};
...
@@ -308,7 +308,7 @@ struct FMaxGradDx<int64_t> {
...
@@ -308,7 +308,7 @@ struct FMaxGradDx<int64_t> {
template
<
typename
T
>
template
<
typename
T
>
struct
FMaxGradDy
{
struct
FMaxGradDy
{
HOSTDEVICE
T
operator
()(
T
x
,
T
y
,
T
out
,
T
dout
)
const
{
HOSTDEVICE
T
operator
()(
T
x
,
T
y
,
T
out
UNUSED
,
T
dout
)
const
{
return
dout
*
static_cast
<
T
>
(
!
((
x
>=
y
)
||
isnan
(
y
)));
return
dout
*
static_cast
<
T
>
(
!
((
x
>=
y
)
||
isnan
(
y
)));
}
}
};
};
...
@@ -342,7 +342,7 @@ struct FMaxGradDy<int> {
...
@@ -342,7 +342,7 @@ struct FMaxGradDy<int> {
template
<
typename
T
>
template
<
typename
T
>
struct
FMinGradDx
{
struct
FMinGradDx
{
HOSTDEVICE
T
operator
()(
T
x
,
T
y
,
T
out
,
T
dout
)
const
{
HOSTDEVICE
T
operator
()(
T
x
,
T
y
,
T
out
UNUSED
,
T
dout
)
const
{
return
dout
*
static_cast
<
T
>
((
x
<=
y
)
||
isnan
(
y
));
return
dout
*
static_cast
<
T
>
((
x
<=
y
)
||
isnan
(
y
));
}
}
};
};
...
@@ -376,7 +376,7 @@ struct FMinGradDx<int64_t> {
...
@@ -376,7 +376,7 @@ struct FMinGradDx<int64_t> {
template
<
typename
T
>
template
<
typename
T
>
struct
FMinGradDy
{
struct
FMinGradDy
{
HOSTDEVICE
T
operator
()(
T
x
,
T
y
,
T
out
,
T
dout
)
const
{
HOSTDEVICE
T
operator
()(
T
x
,
T
y
,
T
out
UNUSED
,
T
dout
)
const
{
return
dout
*
static_cast
<
T
>
(
!
((
x
<=
y
)
||
isnan
(
y
)));
return
dout
*
static_cast
<
T
>
(
!
((
x
<=
y
)
||
isnan
(
y
)));
}
}
};
};
...
...
paddle/phi/kernels/funcs/fft.cc
浏览文件 @
39f365c4
...
@@ -210,7 +210,7 @@ static T compute_factor(size_t size, FFTNormMode normalization) {
...
@@ -210,7 +210,7 @@ static T compute_factor(size_t size, FFTNormMode normalization) {
template
<
typename
Ti
,
typename
To
>
template
<
typename
Ti
,
typename
To
>
struct
FFTC2CFunctor
<
phi
::
CPUContext
,
Ti
,
To
>
{
struct
FFTC2CFunctor
<
phi
::
CPUContext
,
Ti
,
To
>
{
void
operator
()(
const
phi
::
CPUContext
&
ctx
,
void
operator
()(
const
phi
::
CPUContext
&
ctx
UNUSED
,
const
DenseTensor
&
x
,
const
DenseTensor
&
x
,
DenseTensor
*
out
,
DenseTensor
*
out
,
const
std
::
vector
<
int64_t
>&
axes
,
const
std
::
vector
<
int64_t
>&
axes
,
...
@@ -253,7 +253,7 @@ struct FFTC2CFunctor<phi::CPUContext, Ti, To> {
...
@@ -253,7 +253,7 @@ struct FFTC2CFunctor<phi::CPUContext, Ti, To> {
template
<
typename
Ti
,
typename
To
>
template
<
typename
Ti
,
typename
To
>
struct
FFTR2CFunctor
<
phi
::
CPUContext
,
Ti
,
To
>
{
struct
FFTR2CFunctor
<
phi
::
CPUContext
,
Ti
,
To
>
{
void
operator
()(
const
phi
::
CPUContext
&
ctx
,
void
operator
()(
const
phi
::
CPUContext
&
ctx
UNUSED
,
const
DenseTensor
&
x
,
const
DenseTensor
&
x
,
DenseTensor
*
out
,
DenseTensor
*
out
,
const
std
::
vector
<
int64_t
>&
axes
,
const
std
::
vector
<
int64_t
>&
axes
,
...
@@ -310,7 +310,7 @@ struct FFTR2CFunctor<phi::CPUContext, Ti, To> {
...
@@ -310,7 +310,7 @@ struct FFTR2CFunctor<phi::CPUContext, Ti, To> {
template
<
typename
Ti
,
typename
To
>
template
<
typename
Ti
,
typename
To
>
struct
FFTC2RFunctor
<
phi
::
CPUContext
,
Ti
,
To
>
{
struct
FFTC2RFunctor
<
phi
::
CPUContext
,
Ti
,
To
>
{
void
operator
()(
const
phi
::
CPUContext
&
ctx
,
void
operator
()(
const
phi
::
CPUContext
&
ctx
UNUSED
,
const
DenseTensor
&
x
,
const
DenseTensor
&
x
,
DenseTensor
*
out
,
DenseTensor
*
out
,
const
std
::
vector
<
int64_t
>&
axes
,
const
std
::
vector
<
int64_t
>&
axes
,
...
...
paddle/phi/kernels/funcs/functors.h
浏览文件 @
39f365c4
...
@@ -21,14 +21,14 @@ namespace phi {
...
@@ -21,14 +21,14 @@ namespace phi {
namespace
funcs
{
namespace
funcs
{
template
<
typename
T
>
template
<
typename
T
>
struct
MulGradFunctor
{
struct
MulGradFunctor
{
inline
HOSTDEVICE
T
Dx
(
T
x
,
T
y
)
{
return
y
;
}
inline
HOSTDEVICE
T
Dx
(
T
x
UNUSED
,
T
y
)
{
return
y
;
}
inline
HOSTDEVICE
T
Dy
(
T
x
,
T
y
)
{
return
x
;
}
inline
HOSTDEVICE
T
Dy
(
T
x
,
T
y
UNUSED
)
{
return
x
;
}
};
};
template
<
typename
T
>
template
<
typename
T
>
struct
AddGradFunctor
{
struct
AddGradFunctor
{
inline
HOSTDEVICE
T
Dx
(
T
x
,
T
y
)
{
return
static_cast
<
T
>
(
1.
);
}
inline
HOSTDEVICE
T
Dx
(
T
x
UNUSED
,
T
y
UNUSED
)
{
return
static_cast
<
T
>
(
1.
);
}
inline
HOSTDEVICE
T
Dy
(
T
x
,
T
y
)
{
return
static_cast
<
T
>
(
1.
);
}
inline
HOSTDEVICE
T
Dy
(
T
x
UNUSED
,
T
y
UNUSED
)
{
return
static_cast
<
T
>
(
1.
);
}
};
};
template
<
typename
T
>
template
<
typename
T
>
...
@@ -48,9 +48,9 @@ template <typename T>
...
@@ -48,9 +48,9 @@ template <typename T>
struct
ScaleGradFunctor
{
struct
ScaleGradFunctor
{
explicit
ScaleGradFunctor
(
T
coeff
)
:
coeff_
(
coeff
)
{}
explicit
ScaleGradFunctor
(
T
coeff
)
:
coeff_
(
coeff
)
{}
inline
HOSTDEVICE
T
UseX
(
T
x
)
{
return
coeff_
;
}
inline
HOSTDEVICE
T
UseX
(
T
x
UNUSED
)
{
return
coeff_
;
}
inline
HOSTDEVICE
T
UseOut
(
T
out
)
{
return
coeff_
;
}
inline
HOSTDEVICE
T
UseOut
(
T
out
UNUSED
)
{
return
coeff_
;
}
inline
HOSTDEVICE
T
UseXAndOut
(
T
x
,
T
out
)
{
return
coeff_
;
}
inline
HOSTDEVICE
T
UseXAndOut
(
T
x
UNUSED
,
T
out
UNUSED
)
{
return
coeff_
;
}
private:
private:
T
coeff_
;
T
coeff_
;
...
@@ -71,7 +71,7 @@ struct ReluGradFunctor {
...
@@ -71,7 +71,7 @@ struct ReluGradFunctor {
inline
HOSTDEVICE
T
UseOut
(
T
out
)
{
inline
HOSTDEVICE
T
UseOut
(
T
out
)
{
return
out
>
static_cast
<
T
>
(
0
)
?
static_cast
<
T
>
(
1
)
:
static_cast
<
T
>
(
0
);
return
out
>
static_cast
<
T
>
(
0
)
?
static_cast
<
T
>
(
1
)
:
static_cast
<
T
>
(
0
);
}
}
inline
HOSTDEVICE
T
UseXAndOut
(
T
x
,
T
out
)
{
inline
HOSTDEVICE
T
UseXAndOut
(
T
x
UNUSED
,
T
out
)
{
return
out
>
static_cast
<
T
>
(
0
)
?
static_cast
<
T
>
(
1
)
:
static_cast
<
T
>
(
0
);
return
out
>
static_cast
<
T
>
(
0
)
?
static_cast
<
T
>
(
1
)
:
static_cast
<
T
>
(
0
);
}
}
};
};
...
@@ -93,7 +93,7 @@ template <typename T>
...
@@ -93,7 +93,7 @@ template <typename T>
struct
TanhGradFunctor
{
struct
TanhGradFunctor
{
inline
HOSTDEVICE
T
UseX
(
T
x
)
{
return
static_cast
<
T
>
(
1
)
-
x
*
x
;
}
inline
HOSTDEVICE
T
UseX
(
T
x
)
{
return
static_cast
<
T
>
(
1
)
-
x
*
x
;
}
inline
HOSTDEVICE
T
UseOut
(
T
out
)
{
return
static_cast
<
T
>
(
1
)
-
out
*
out
;
}
inline
HOSTDEVICE
T
UseOut
(
T
out
)
{
return
static_cast
<
T
>
(
1
)
-
out
*
out
;
}
inline
HOSTDEVICE
T
UseXAndOut
(
T
x
,
T
out
)
{
inline
HOSTDEVICE
T
UseXAndOut
(
T
x
UNUSED
,
T
out
)
{
return
static_cast
<
T
>
(
1
)
-
out
*
out
;
return
static_cast
<
T
>
(
1
)
-
out
*
out
;
}
}
};
};
...
@@ -113,7 +113,7 @@ template <typename T>
...
@@ -113,7 +113,7 @@ template <typename T>
struct
SigmoidGradFunctor
{
struct
SigmoidGradFunctor
{
inline
HOSTDEVICE
T
UseX
(
T
x
)
{
return
x
*
(
static_cast
<
T
>
(
1
)
-
x
);
}
inline
HOSTDEVICE
T
UseX
(
T
x
)
{
return
x
*
(
static_cast
<
T
>
(
1
)
-
x
);
}
inline
HOSTDEVICE
T
UseOut
(
T
out
)
{
return
out
*
(
static_cast
<
T
>
(
1
)
-
out
);
}
inline
HOSTDEVICE
T
UseOut
(
T
out
)
{
return
out
*
(
static_cast
<
T
>
(
1
)
-
out
);
}
inline
HOSTDEVICE
T
UseXAndOut
(
T
x
,
T
out
)
{
inline
HOSTDEVICE
T
UseXAndOut
(
T
x
UNUSED
,
T
out
)
{
return
out
*
(
static_cast
<
T
>
(
1
)
-
out
);
return
out
*
(
static_cast
<
T
>
(
1
)
-
out
);
}
}
};
};
...
@@ -161,7 +161,7 @@ struct GeluGradFunctor {
...
@@ -161,7 +161,7 @@ struct GeluGradFunctor {
static_cast
<
MT
>
(
0.5
)
*
(
static_cast
<
MT
>
(
1
)
+
tanh_out
);
static_cast
<
MT
>
(
0.5
)
*
(
static_cast
<
MT
>
(
1
)
+
tanh_out
);
return
static_cast
<
T
>
(
ans
);
return
static_cast
<
T
>
(
ans
);
}
}
inline
HOSTDEVICE
T
UseXAndOut
(
T
x
,
T
out
)
{
inline
HOSTDEVICE
T
UseXAndOut
(
T
x
,
T
out
UNUSED
)
{
MT
mx
=
static_cast
<
MT
>
(
x
);
MT
mx
=
static_cast
<
MT
>
(
x
);
MT
tanh_out
=
MT
tanh_out
=
tanh
(
static_cast
<
MT
>
(
0.79788456
)
*
mx
*
tanh
(
static_cast
<
MT
>
(
0.79788456
)
*
mx
*
...
...
paddle/phi/kernels/funcs/im2col.cc
浏览文件 @
39f365c4
...
@@ -30,7 +30,7 @@ namespace funcs {
...
@@ -30,7 +30,7 @@ namespace funcs {
template
<
class
T
,
typename
DeviceContext
>
template
<
class
T
,
typename
DeviceContext
>
class
Im2ColFunctor
<
phi
::
funcs
::
ColFormat
::
kCFO
,
DeviceContext
,
T
>
{
class
Im2ColFunctor
<
phi
::
funcs
::
ColFormat
::
kCFO
,
DeviceContext
,
T
>
{
public:
public:
void
operator
()(
const
DeviceContext
&
context
,
void
operator
()(
const
DeviceContext
&
context
UNUSED
,
const
phi
::
DenseTensor
&
im
,
const
phi
::
DenseTensor
&
im
,
const
std
::
vector
<
int
>&
dilation
,
const
std
::
vector
<
int
>&
dilation
,
const
std
::
vector
<
int
>&
stride
,
const
std
::
vector
<
int
>&
stride
,
...
@@ -75,7 +75,7 @@ class Im2ColFunctor<phi::funcs::ColFormat::kCFO, DeviceContext, T> {
...
@@ -75,7 +75,7 @@ class Im2ColFunctor<phi::funcs::ColFormat::kCFO, DeviceContext, T> {
template
<
class
T
,
typename
DeviceContext
>
template
<
class
T
,
typename
DeviceContext
>
class
Col2ImFunctor
<
phi
::
funcs
::
ColFormat
::
kCFO
,
DeviceContext
,
T
>
{
class
Col2ImFunctor
<
phi
::
funcs
::
ColFormat
::
kCFO
,
DeviceContext
,
T
>
{
public:
public:
void
operator
()(
const
DeviceContext
&
context
,
void
operator
()(
const
DeviceContext
&
context
UNUSED
,
const
phi
::
DenseTensor
&
col
,
const
phi
::
DenseTensor
&
col
,
const
std
::
vector
<
int
>&
dilation
,
const
std
::
vector
<
int
>&
dilation
,
const
std
::
vector
<
int
>&
stride
,
const
std
::
vector
<
int
>&
stride
,
...
@@ -175,13 +175,13 @@ template class Col2ImFunctor<phi::funcs::ColFormat::kCFO,
...
@@ -175,13 +175,13 @@ template class Col2ImFunctor<phi::funcs::ColFormat::kCFO,
template
<
class
T
,
typename
DeviceContext
>
template
<
class
T
,
typename
DeviceContext
>
class
Im2ColFunctor
<
phi
::
funcs
::
ColFormat
::
kOCF
,
DeviceContext
,
T
>
{
class
Im2ColFunctor
<
phi
::
funcs
::
ColFormat
::
kOCF
,
DeviceContext
,
T
>
{
public:
public:
void
operator
()(
const
DeviceContext
&
context
,
void
operator
()(
const
DeviceContext
&
context
UNUSED
,
const
phi
::
DenseTensor
&
im
,
const
phi
::
DenseTensor
&
im
,
const
std
::
vector
<
int
>&
dilation
,
const
std
::
vector
<
int
>&
dilation
UNUSED
,
const
std
::
vector
<
int
>&
stride
,
const
std
::
vector
<
int
>&
stride
,
const
std
::
vector
<
int
>&
padding
,
const
std
::
vector
<
int
>&
padding
,
phi
::
DenseTensor
*
col
,
phi
::
DenseTensor
*
col
,
const
DataLayout
data_layout
)
{
const
DataLayout
data_layout
UNUSED
)
{
PADDLE_ENFORCE_EQ
(
im
.
dims
().
size
(),
PADDLE_ENFORCE_EQ
(
im
.
dims
().
size
(),
3
,
3
,
phi
::
errors
::
InvalidArgument
(
phi
::
errors
::
InvalidArgument
(
...
@@ -248,13 +248,13 @@ class Im2ColFunctor<phi::funcs::ColFormat::kOCF, DeviceContext, T> {
...
@@ -248,13 +248,13 @@ class Im2ColFunctor<phi::funcs::ColFormat::kOCF, DeviceContext, T> {
template
<
class
T
,
typename
DeviceContext
>
template
<
class
T
,
typename
DeviceContext
>
class
Col2ImFunctor
<
phi
::
funcs
::
ColFormat
::
kOCF
,
DeviceContext
,
T
>
{
class
Col2ImFunctor
<
phi
::
funcs
::
ColFormat
::
kOCF
,
DeviceContext
,
T
>
{
public:
public:
void
operator
()(
const
DeviceContext
&
context
,
void
operator
()(
const
DeviceContext
&
context
UNUSED
,
const
phi
::
DenseTensor
&
col
,
const
phi
::
DenseTensor
&
col
,
const
std
::
vector
<
int
>&
dilation
,
const
std
::
vector
<
int
>&
dilation
UNUSED
,
const
std
::
vector
<
int
>&
stride
,
const
std
::
vector
<
int
>&
stride
,
const
std
::
vector
<
int
>&
padding
,
const
std
::
vector
<
int
>&
padding
,
phi
::
DenseTensor
*
im
,
phi
::
DenseTensor
*
im
,
const
DataLayout
data_layout
)
{
const
DataLayout
data_layout
UNUSED
)
{
PADDLE_ENFORCE_EQ
(
im
->
dims
().
size
(),
PADDLE_ENFORCE_EQ
(
im
->
dims
().
size
(),
3
,
3
,
phi
::
errors
::
InvalidArgument
(
phi
::
errors
::
InvalidArgument
(
...
...
paddle/phi/kernels/funcs/isfinite_functor.h
浏览文件 @
39f365c4
...
@@ -31,7 +31,7 @@ struct IsNanFunctor {
...
@@ -31,7 +31,7 @@ struct IsNanFunctor {
template
<
typename
T
>
template
<
typename
T
>
struct
IsNanFunctor
<
T
,
struct
IsNanFunctor
<
T
,
typename
std
::
enable_if
<
std
::
is_integral
<
T
>::
value
>::
type
>
{
typename
std
::
enable_if
<
std
::
is_integral
<
T
>::
value
>::
type
>
{
HOSTDEVICE
bool
operator
()(
const
T
&
a
)
const
{
return
false
;
}
HOSTDEVICE
bool
operator
()(
const
T
&
a
UNUSED
)
const
{
return
false
;
}
};
};
// isnan is defined in namespace std in float16.h, but
// isnan is defined in namespace std in float16.h, but
...
@@ -66,7 +66,7 @@ struct IsInfFunctor {
...
@@ -66,7 +66,7 @@ struct IsInfFunctor {
template
<
typename
T
>
template
<
typename
T
>
struct
IsInfFunctor
<
T
,
struct
IsInfFunctor
<
T
,
typename
std
::
enable_if
<
std
::
is_integral
<
T
>::
value
>::
type
>
{
typename
std
::
enable_if
<
std
::
is_integral
<
T
>::
value
>::
type
>
{
HOSTDEVICE
bool
operator
()(
const
T
&
a
)
const
{
return
false
;
}
HOSTDEVICE
bool
operator
()(
const
T
&
a
UNUSED
)
const
{
return
false
;
}
};
};
template
<
>
template
<
>
...
@@ -98,7 +98,7 @@ template <typename T>
...
@@ -98,7 +98,7 @@ template <typename T>
struct
IsFiniteFunctor
<
struct
IsFiniteFunctor
<
T
,
T
,
typename
std
::
enable_if
<
std
::
is_integral
<
T
>::
value
>::
type
>
{
typename
std
::
enable_if
<
std
::
is_integral
<
T
>::
value
>::
type
>
{
HOSTDEVICE
bool
operator
()(
const
T
&
a
)
const
{
return
true
;
}
HOSTDEVICE
bool
operator
()(
const
T
&
a
UNUSED
)
const
{
return
true
;
}
};
};
template
<
>
template
<
>
...
...
paddle/phi/kernels/funcs/layer_norm_util.h
浏览文件 @
39f365c4
...
@@ -126,7 +126,9 @@ class ColwiseSum2D<phi::GPUContext, T> {
...
@@ -126,7 +126,9 @@ class ColwiseSum2D<phi::GPUContext, T> {
template
<
typename
T
>
template
<
typename
T
>
class
ColwiseSum2D
<
phi
::
CPUContext
,
T
>
{
class
ColwiseSum2D
<
phi
::
CPUContext
,
T
>
{
public:
public:
ColwiseSum2D
(
int
left
,
int
right
,
const
phi
::
CPUContext
&
dev_ctx
)
{}
ColwiseSum2D
(
int
left
UNUSED
,
int
right
UNUSED
,
const
phi
::
CPUContext
&
dev_ctx
UNUSED
)
{}
void
operator
()(
const
phi
::
CPUContext
&
context
,
void
operator
()(
const
phi
::
CPUContext
&
context
,
const
DenseTensor
&
input
,
const
DenseTensor
&
input
,
...
...
paddle/phi/kernels/funcs/math_function.cc
浏览文件 @
39f365c4
...
@@ -243,7 +243,7 @@ template struct RowwiseMean<phi::CPUContext, double>;
...
@@ -243,7 +243,7 @@ template struct RowwiseMean<phi::CPUContext, double>;
template
<
typename
T
>
template
<
typename
T
>
struct
RowwiseAdd
<
phi
::
CPUContext
,
T
>
{
struct
RowwiseAdd
<
phi
::
CPUContext
,
T
>
{
void
operator
()(
const
phi
::
CPUContext
&
context
,
void
operator
()(
const
phi
::
CPUContext
&
context
UNUSED
,
const
phi
::
DenseTensor
&
input
,
const
phi
::
DenseTensor
&
input
,
const
phi
::
DenseTensor
&
vector
,
const
phi
::
DenseTensor
&
vector
,
phi
::
DenseTensor
*
output
)
{
phi
::
DenseTensor
*
output
)
{
...
...
paddle/phi/kernels/funcs/pooling.cc
浏览文件 @
39f365c4
...
@@ -1622,10 +1622,10 @@ class MaxPool2dWithIndexGradFunctor<CPUContext, T1, T2> {
...
@@ -1622,10 +1622,10 @@ class MaxPool2dWithIndexGradFunctor<CPUContext, T1, T2> {
void
operator
()(
const
CPUContext
&
context
,
void
operator
()(
const
CPUContext
&
context
,
const
DenseTensor
&
output_grad
,
const
DenseTensor
&
output_grad
,
const
DenseTensor
&
mask
,
const
DenseTensor
&
mask
,
const
std
::
vector
<
int
>&
ksize
,
const
std
::
vector
<
int
>&
ksize
UNUSED
,
const
std
::
vector
<
int
>&
strides
,
const
std
::
vector
<
int
>&
strides
UNUSED
,
const
std
::
vector
<
int
>&
paddings
,
const
std
::
vector
<
int
>&
paddings
UNUSED
,
bool
adaptive
,
bool
adaptive
UNUSED
,
DenseTensor
*
input_grad
)
{
DenseTensor
*
input_grad
)
{
const
int
batch_size
=
input_grad
->
dims
()[
0
];
const
int
batch_size
=
input_grad
->
dims
()[
0
];
const
int
input_height
=
input_grad
->
dims
()[
2
];
const
int
input_height
=
input_grad
->
dims
()[
2
];
...
@@ -1775,10 +1775,10 @@ class MaxPool3dWithIndexGradFunctor<CPUContext, T1, T2> {
...
@@ -1775,10 +1775,10 @@ class MaxPool3dWithIndexGradFunctor<CPUContext, T1, T2> {
void
operator
()(
const
CPUContext
&
context
,
void
operator
()(
const
CPUContext
&
context
,
const
DenseTensor
&
output_grad
,
const
DenseTensor
&
output_grad
,
const
DenseTensor
&
mask
,
const
DenseTensor
&
mask
,
const
std
::
vector
<
int
>&
ksize
,
const
std
::
vector
<
int
>&
ksize
UNUSED
,
const
std
::
vector
<
int
>&
strides
,
const
std
::
vector
<
int
>&
strides
UNUSED
,
const
std
::
vector
<
int
>&
paddings
,
const
std
::
vector
<
int
>&
paddings
UNUSED
,
bool
adaptive
,
bool
adaptive
UNUSED
,
DenseTensor
*
input_grad
)
{
DenseTensor
*
input_grad
)
{
const
int
batch_size
=
input_grad
->
dims
()[
0
];
const
int
batch_size
=
input_grad
->
dims
()[
0
];
const
int
input_depth
=
input_grad
->
dims
()[
2
];
const
int
input_depth
=
input_grad
->
dims
()[
2
];
...
...
paddle/phi/kernels/funcs/pooling.h
浏览文件 @
39f365c4
...
@@ -45,7 +45,7 @@ class MaxPool {
...
@@ -45,7 +45,7 @@ class MaxPool {
public:
public:
DEVICE
inline
T
initial
()
{
return
static_cast
<
T
>
(
-
FLT_MAX
);
}
DEVICE
inline
T
initial
()
{
return
static_cast
<
T
>
(
-
FLT_MAX
);
}
HOSTDEVICE
inline
void
compute
(
const
T
&
x
,
T
*
y
)
{
*
y
=
*
y
>
x
?
*
y
:
x
;
}
HOSTDEVICE
inline
void
compute
(
const
T
&
x
,
T
*
y
)
{
*
y
=
*
y
>
x
?
*
y
:
x
;
}
DEVICE
inline
void
finalize
(
const
T
&
pool_field
,
T
*
y
)
{}
DEVICE
inline
void
finalize
(
const
T
&
pool_field
UNUSED
,
T
*
y
UNUSED
)
{}
};
};
template
<
class
T
>
template
<
class
T
>
...
@@ -59,7 +59,7 @@ class AvgPool {
...
@@ -59,7 +59,7 @@ class AvgPool {
return
static_cast
<
T
>
(
0
);
return
static_cast
<
T
>
(
0
);
}
}
DEVICE
inline
void
compute
(
const
T
&
x
,
T
*
y
)
{
DEVICE
inline
void
compute
(
const
T
&
x
,
T
*
y
UNUSED
)
{
intermediate_res
+=
static_cast
<
MT
>
(
x
);
intermediate_res
+=
static_cast
<
MT
>
(
x
);
}
}
...
@@ -83,7 +83,7 @@ class AvgPoolGrad {
...
@@ -83,7 +83,7 @@ class AvgPoolGrad {
public:
public:
static
constexpr
bool
use_x
=
false
;
static
constexpr
bool
use_x
=
false
;
HOSTDEVICE
inline
void
compute
(
HOSTDEVICE
inline
void
compute
(
const
T
&
x
,
const
T
&
y
,
const
T
&
dy
,
T
scale
,
T
*
dx
)
{
const
T
&
x
UNUSED
,
const
T
&
y
UNUSED
,
const
T
&
dy
,
T
scale
,
T
*
dx
)
{
*
dx
+=
(
scale
*
dy
);
*
dx
+=
(
scale
*
dy
);
}
}
};
};
...
...
paddle/phi/kernels/funcs/selected_rows_functor.cc
浏览文件 @
39f365c4
...
@@ -420,7 +420,7 @@ typename std::enable_if<!std::is_integral<T>::value>::type elementwise_add_to(
...
@@ -420,7 +420,7 @@ typename std::enable_if<!std::is_integral<T>::value>::type elementwise_add_to(
template
<
typename
T
,
typename
DeviceContext
>
template
<
typename
T
,
typename
DeviceContext
>
typename
std
::
enable_if
<
std
::
is_integral
<
T
>::
value
>::
type
elementwise_add_to
(
typename
std
::
enable_if
<
std
::
is_integral
<
T
>::
value
>::
type
elementwise_add_to
(
phi
::
funcs
::
BlasT
<
DeviceContext
,
T
>*
blas
,
phi
::
funcs
::
BlasT
<
DeviceContext
,
T
>*
blas
UNUSED
,
size_t
data_len
,
size_t
data_len
,
const
T
*
in
,
const
T
*
in
,
T
*
out
)
{
T
*
out
)
{
...
...
paddle/phi/kernels/funcs/sequence2batch.cc
浏览文件 @
39f365c4
...
@@ -20,7 +20,7 @@ namespace funcs {
...
@@ -20,7 +20,7 @@ namespace funcs {
template
<
typename
T
>
template
<
typename
T
>
class
CopyMatrixRowsFunctor
<
phi
::
CPUContext
,
T
>
{
class
CopyMatrixRowsFunctor
<
phi
::
CPUContext
,
T
>
{
public:
public:
void
operator
()(
const
phi
::
CPUContext
&
context
,
void
operator
()(
const
phi
::
CPUContext
&
context
UNUSED
,
const
phi
::
DenseTensor
&
src
,
const
phi
::
DenseTensor
&
src
,
phi
::
Vector
<
size_t
>
index_lod
,
phi
::
Vector
<
size_t
>
index_lod
,
phi
::
DenseTensor
*
dst
,
phi
::
DenseTensor
*
dst
,
...
...
paddle/phi/kernels/funcs/sequence_pooling.cc
浏览文件 @
39f365c4
...
@@ -36,7 +36,7 @@ using EigenMatrix = phi::EigenMatrix<T, MajorType, IndexType>;
...
@@ -36,7 +36,7 @@ using EigenMatrix = phi::EigenMatrix<T, MajorType, IndexType>;
template
<
typename
T
,
bool
is_test
>
template
<
typename
T
,
bool
is_test
>
class
MaxSeqPoolFunctor
{
class
MaxSeqPoolFunctor
{
public:
public:
void
operator
()(
const
phi
::
CPUContext
&
context
,
void
operator
()(
const
phi
::
CPUContext
&
context
UNUSED
,
const
phi
::
DenseTensor
&
input
,
const
phi
::
DenseTensor
&
input
,
T
pad_value
,
T
pad_value
,
phi
::
DenseTensor
*
output
,
phi
::
DenseTensor
*
output
,
...
@@ -115,11 +115,11 @@ class MaxSeqPoolFunctor {
...
@@ -115,11 +115,11 @@ class MaxSeqPoolFunctor {
template
<
typename
T
>
template
<
typename
T
>
class
MaxSeqPoolFunctor
<
T
,
true
>
{
class
MaxSeqPoolFunctor
<
T
,
true
>
{
public:
public:
void
operator
()(
const
phi
::
CPUContext
&
context
,
void
operator
()(
const
phi
::
CPUContext
&
context
UNUSED
,
const
phi
::
DenseTensor
&
input
,
const
phi
::
DenseTensor
&
input
,
T
pad_value
,
T
pad_value
,
phi
::
DenseTensor
*
output
,
phi
::
DenseTensor
*
output
,
phi
::
DenseTensor
*
index
)
{
phi
::
DenseTensor
*
index
UNUSED
)
{
auto
in_dims
=
input
.
dims
();
auto
in_dims
=
input
.
dims
();
auto
out_dims
=
output
->
dims
();
auto
out_dims
=
output
->
dims
();
PADDLE_ENFORCE_GT
(
in_dims
.
size
(),
PADDLE_ENFORCE_GT
(
in_dims
.
size
(),
...
@@ -239,7 +239,7 @@ class MaxSeqPoolGradFunctor {
...
@@ -239,7 +239,7 @@ class MaxSeqPoolGradFunctor {
template
<
typename
T
>
template
<
typename
T
>
class
LastSeqPoolFunctor
{
class
LastSeqPoolFunctor
{
public:
public:
void
operator
()(
const
phi
::
CPUContext
&
context
,
void
operator
()(
const
phi
::
CPUContext
&
context
UNUSED
,
const
phi
::
DenseTensor
&
input
,
const
phi
::
DenseTensor
&
input
,
T
pad_value
,
T
pad_value
,
phi
::
DenseTensor
*
output
)
{
phi
::
DenseTensor
*
output
)
{
...
@@ -273,7 +273,7 @@ class LastSeqPoolFunctor {
...
@@ -273,7 +273,7 @@ class LastSeqPoolFunctor {
template
<
typename
T
>
template
<
typename
T
>
class
FirstSeqPoolFunctor
{
class
FirstSeqPoolFunctor
{
public:
public:
void
operator
()(
const
phi
::
CPUContext
&
context
,
void
operator
()(
const
phi
::
CPUContext
&
context
UNUSED
,
const
phi
::
DenseTensor
&
input
,
const
phi
::
DenseTensor
&
input
,
T
pad_value
,
T
pad_value
,
phi
::
DenseTensor
*
output
)
{
phi
::
DenseTensor
*
output
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录