Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
df5d55bb
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
df5d55bb
编写于
1月 12, 2022
作者:
Z
Zhang Ting
提交者:
GitHub
1月 12, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[part 1]change type of function args (#38885)
上级
f5166284
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
12 addition
and
12 deletion
+12
-12
paddle/fluid/operators/abs_op.cu
paddle/fluid/operators/abs_op.cu
+2
-2
paddle/fluid/operators/bce_loss_op.cu
paddle/fluid/operators/bce_loss_op.cu
+2
-2
paddle/fluid/operators/clip_op.h
paddle/fluid/operators/clip_op.h
+1
-1
paddle/fluid/operators/p_norm_op.cu
paddle/fluid/operators/p_norm_op.cu
+4
-4
paddle/fluid/operators/renorm_op.cu
paddle/fluid/operators/renorm_op.cu
+1
-1
paddle/pten/kernels/gpu/cast_kernel.cu
paddle/pten/kernels/gpu/cast_kernel.cu
+1
-1
paddle/pten/kernels/gpu/scale_kernel.cu
paddle/pten/kernels/gpu/scale_kernel.cu
+1
-1
未找到文件。
paddle/fluid/operators/abs_op.cu
浏览文件 @
df5d55bb
...
@@ -24,14 +24,14 @@ struct CudaAbsFunctor;
...
@@ -24,14 +24,14 @@ struct CudaAbsFunctor;
template
<
typename
T
>
template
<
typename
T
>
struct
CudaAbsFunctor
<
T
,
math
::
Complex
<
T
,
math
::
Real
<
T
>>>
{
struct
CudaAbsFunctor
<
T
,
math
::
Complex
<
T
,
math
::
Real
<
T
>>>
{
__device__
__forceinline__
math
::
Real
<
T
>
operator
()(
const
T
&
x
)
const
{
__device__
__forceinline__
math
::
Real
<
T
>
operator
()(
const
T
x
)
const
{
return
abs
(
x
);
return
abs
(
x
);
}
}
};
};
template
<
typename
T
>
template
<
typename
T
>
struct
CudaAbsFunctor
<
T
,
math
::
NoComplex
<
T
,
math
::
Real
<
T
>>>
{
struct
CudaAbsFunctor
<
T
,
math
::
NoComplex
<
T
,
math
::
Real
<
T
>>>
{
__device__
__forceinline__
T
operator
()(
const
T
&
x
)
const
{
__device__
__forceinline__
T
operator
()(
const
T
x
)
const
{
return
std
::
abs
(
x
);
return
std
::
abs
(
x
);
}
}
};
};
...
...
paddle/fluid/operators/bce_loss_op.cu
浏览文件 @
df5d55bb
...
@@ -28,8 +28,8 @@ template <typename T>
...
@@ -28,8 +28,8 @@ template <typename T>
struct
BCELossGradFunctor
{
struct
BCELossGradFunctor
{
T
one
=
static_cast
<
T
>
(
1.0
f
);
T
one
=
static_cast
<
T
>
(
1.0
f
);
T
eps
=
static_cast
<
T
>
(
1e-12
);
T
eps
=
static_cast
<
T
>
(
1e-12
);
__device__
__forceinline__
T
operator
()(
const
T
&
x
,
const
T
&
label
,
__device__
__forceinline__
T
operator
()(
const
T
x
,
const
T
label
,
const
T
&
dout
)
const
{
const
T
dout
)
const
{
T
term1
=
max
((
one
-
x
)
*
x
,
eps
);
T
term1
=
max
((
one
-
x
)
*
x
,
eps
);
return
(
dout
*
(
x
-
label
)
/
term1
);
return
(
dout
*
(
x
-
label
)
/
term1
);
}
}
...
...
paddle/fluid/operators/clip_op.h
浏览文件 @
df5d55bb
...
@@ -32,7 +32,7 @@ template <typename T>
...
@@ -32,7 +32,7 @@ template <typename T>
class
ClipFunctor
{
class
ClipFunctor
{
public:
public:
explicit
ClipFunctor
(
const
T
min
,
const
T
max
)
:
min_
(
min
),
max_
(
max
)
{}
explicit
ClipFunctor
(
const
T
min
,
const
T
max
)
:
min_
(
min
),
max_
(
max
)
{}
HOSTDEVICE
T
operator
()(
const
T
&
x
)
const
{
HOSTDEVICE
T
operator
()(
const
T
x
)
const
{
return
x
<
min_
?
min_
:
x
>
max_
?
max_
:
x
;
return
x
<
min_
?
min_
:
x
>
max_
?
max_
:
x
;
}
}
...
...
paddle/fluid/operators/p_norm_op.cu
浏览文件 @
df5d55bb
...
@@ -63,7 +63,7 @@ __device__ __forceinline__ double inline_pow(double base, double exponent) {
...
@@ -63,7 +63,7 @@ __device__ __forceinline__ double inline_pow(double base, double exponent) {
template
<
typename
T
>
template
<
typename
T
>
struct
NonzeroFunctor
{
struct
NonzeroFunctor
{
HOSTDEVICE
explicit
inline
NonzeroFunctor
()
{}
HOSTDEVICE
explicit
inline
NonzeroFunctor
()
{}
HOSTDEVICE
inline
T
operator
()(
const
T
&
x
)
const
{
HOSTDEVICE
inline
T
operator
()(
const
T
x
)
const
{
return
static_cast
<
T
>
(
static_cast
<
double
>
(
x
)
!=
0
);
return
static_cast
<
T
>
(
static_cast
<
double
>
(
x
)
!=
0
);
}
}
};
};
...
@@ -71,7 +71,7 @@ struct NonzeroFunctor {
...
@@ -71,7 +71,7 @@ struct NonzeroFunctor {
template
<
typename
T
>
template
<
typename
T
>
struct
AbsFunctor
{
struct
AbsFunctor
{
HOSTDEVICE
explicit
inline
AbsFunctor
()
{}
HOSTDEVICE
explicit
inline
AbsFunctor
()
{}
HOSTDEVICE
inline
T
operator
()(
const
T
&
x
)
const
{
HOSTDEVICE
inline
T
operator
()(
const
T
x
)
const
{
return
static_cast
<
T
>
(
inline_abs
(
x
));
return
static_cast
<
T
>
(
inline_abs
(
x
));
}
}
};
};
...
@@ -81,7 +81,7 @@ struct UnsignedPowFunctor {
...
@@ -81,7 +81,7 @@ struct UnsignedPowFunctor {
HOSTDEVICE
explicit
inline
UnsignedPowFunctor
(
float
porder
)
{
HOSTDEVICE
explicit
inline
UnsignedPowFunctor
(
float
porder
)
{
this
->
porder
=
porder
;
this
->
porder
=
porder
;
}
}
HOSTDEVICE
inline
Ty
operator
()(
const
Tx
&
x
)
const
{
HOSTDEVICE
inline
Ty
operator
()(
const
Tx
x
)
const
{
return
static_cast
<
Ty
>
(
inline_pow
(
inline_abs
(
x
),
static_cast
<
Tx
>
(
porder
)));
return
static_cast
<
Ty
>
(
inline_pow
(
inline_abs
(
x
),
static_cast
<
Tx
>
(
porder
)));
}
}
float
porder
;
float
porder
;
...
@@ -90,7 +90,7 @@ struct UnsignedPowFunctor {
...
@@ -90,7 +90,7 @@ struct UnsignedPowFunctor {
template
<
typename
Tx
,
typename
Ty
=
Tx
>
template
<
typename
Tx
,
typename
Ty
=
Tx
>
struct
PowFunctor
{
struct
PowFunctor
{
HOSTDEVICE
explicit
inline
PowFunctor
(
float
porder
)
{
this
->
porder
=
porder
;
}
HOSTDEVICE
explicit
inline
PowFunctor
(
float
porder
)
{
this
->
porder
=
porder
;
}
HOSTDEVICE
inline
Ty
operator
()(
const
Tx
&
x
)
const
{
HOSTDEVICE
inline
Ty
operator
()(
const
Tx
x
)
const
{
return
static_cast
<
Ty
>
(
inline_pow
(
x
,
static_cast
<
Tx
>
(
porder
)));
return
static_cast
<
Ty
>
(
inline_pow
(
x
,
static_cast
<
Tx
>
(
porder
)));
}
}
float
porder
;
float
porder
;
...
...
paddle/fluid/operators/renorm_op.cu
浏览文件 @
df5d55bb
...
@@ -42,7 +42,7 @@ struct UnsignedPowFunctor {
...
@@ -42,7 +42,7 @@ struct UnsignedPowFunctor {
HOSTDEVICE
explicit
inline
UnsignedPowFunctor
(
float
porder
)
{
HOSTDEVICE
explicit
inline
UnsignedPowFunctor
(
float
porder
)
{
this
->
porder
=
porder
;
this
->
porder
=
porder
;
}
}
HOSTDEVICE
inline
Ty
operator
()(
const
Tx
&
x
)
const
{
HOSTDEVICE
inline
Ty
operator
()(
const
Tx
x
)
const
{
return
static_cast
<
Ty
>
(
inline_pow
(
inline_abs
(
x
),
static_cast
<
Tx
>
(
porder
)));
return
static_cast
<
Ty
>
(
inline_pow
(
inline_abs
(
x
),
static_cast
<
Tx
>
(
porder
)));
}
}
float
porder
;
float
porder
;
...
...
paddle/pten/kernels/gpu/cast_kernel.cu
浏览文件 @
df5d55bb
...
@@ -30,7 +30,7 @@ namespace pten {
...
@@ -30,7 +30,7 @@ namespace pten {
template
<
typename
InT
,
typename
OutT
>
template
<
typename
InT
,
typename
OutT
>
struct
CastFuctor
{
struct
CastFuctor
{
__device__
__forceinline__
OutT
operator
()(
const
InT
&
x
)
const
{
__device__
__forceinline__
OutT
operator
()(
const
InT
x
)
const
{
return
static_cast
<
OutT
>
(
x
);
return
static_cast
<
OutT
>
(
x
);
}
}
};
};
...
...
paddle/pten/kernels/gpu/scale_kernel.cu
浏览文件 @
df5d55bb
...
@@ -34,7 +34,7 @@ struct ScaleFunctor {
...
@@ -34,7 +34,7 @@ struct ScaleFunctor {
bias_after_scale
=
is_bias_after_sacle
;
bias_after_scale
=
is_bias_after_sacle
;
}
}
__device__
__forceinline__
InT
operator
()(
const
InT
&
x
)
const
{
__device__
__forceinline__
InT
operator
()(
const
InT
x
)
const
{
if
(
bias_after_scale
)
{
if
(
bias_after_scale
)
{
return
scale
*
x
+
bias
;
return
scale
*
x
+
bias
;
}
else
{
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录