Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
bebaee37
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看板
未验证
提交
bebaee37
编写于
5月 18, 2022
作者:
N
niuliling123
提交者:
GitHub
5月 18, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add return in initial function (#42823)
上级
1f64c42e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
8 addition
and
12 deletion
+8
-12
paddle/phi/kernels/primitive/functor_primitives_xpu2.h
paddle/phi/kernels/primitive/functor_primitives_xpu2.h
+8
-12
未找到文件。
paddle/phi/kernels/primitive/functor_primitives_xpu2.h
浏览文件 @
bebaee37
...
@@ -55,21 +55,21 @@ struct DivideFunctor {
...
@@ -55,21 +55,21 @@ struct DivideFunctor {
inline
DivideFunctor
()
{
n_inv
=
static_cast
<
Tx
>
(
1.0
f
);
}
inline
DivideFunctor
()
{
n_inv
=
static_cast
<
Tx
>
(
1.0
f
);
}
explicit
inline
DivideFunctor
(
int
n
)
explicit
inline
DivideFunctor
(
int
n
)
:
n_inv
(
static_cast
<
Tx
>
(
((
float
)
1.0
)
/
(
static_cast
<
float
>
(
n
))))
{}
:
n_inv
(
static_cast
<
Tx
>
(
1.0
f
/
(
static_cast
<
float
>
(
n
))))
{}
inline
Ty
operator
()(
const
Tx
&
x
)
const
{
return
static_cast
<
Ty
>
(
x
*
n_inv
);
}
inline
Ty
operator
()(
const
Tx
&
x
)
const
{
return
static_cast
<
Ty
>
(
x
*
n_inv
);
}
__device__
inline
DivideFunctor
()
{
n_inv
=
static_cast
<
Tx
>
(
1.0
f
);
}
__device__
inline
DivideFunctor
()
{
n_inv
=
static_cast
<
Tx
>
(
1.0
f
);
}
__device__
inline
DivideFunctor
(
int
n
)
__device__
inline
DivideFunctor
(
int
n
)
:
n_inv
(
static_cast
<
Tx
>
(
((
float
)
1.0
)
/
(
static_cast
<
float
>
(
n
))))
{}
:
n_inv
(
static_cast
<
Tx
>
(
1.0
f
/
(
static_cast
<
float
>
(
n
))))
{}
__device__
inline
Ty
operator
()(
const
Tx
&
x
)
const
{
__device__
inline
Ty
operator
()(
const
Tx
&
x
)
const
{
return
static_cast
<
Ty
>
(
x
*
n_inv
);
return
static_cast
<
Ty
>
(
x
*
n_inv
);
}
}
__device__
inline
void
SetDiv
(
int
n
)
{
__device__
inline
void
SetDiv
(
int
n
)
{
n_inv
=
static_cast
<
Tx
>
(
((
float
)
1.0
)
/
(
static_cast
<
float
>
(
n
)));
n_inv
=
static_cast
<
Tx
>
(
1.0
f
/
(
static_cast
<
float
>
(
n
)));
}
}
private:
private:
...
@@ -97,8 +97,7 @@ struct SquareFunctor {
...
@@ -97,8 +97,7 @@ struct SquareFunctor {
*/
*/
template
<
typename
T
>
template
<
typename
T
>
struct
MinFunctor
{
struct
MinFunctor
{
inline
T
initial
()
{
/*return static_cast<T>(std::numeric_limits<T>::max());*/
inline
T
initial
()
{
return
static_cast
<
T
>
(
std
::
numeric_limits
<
T
>::
max
());
}
}
__device__
T
operator
()(
const
T
&
a
,
const
T
&
b
)
const
{
__device__
T
operator
()(
const
T
&
a
,
const
T
&
b
)
const
{
return
(
b
<
a
)
?
b
:
a
;
return
(
b
<
a
)
?
b
:
a
;
...
@@ -111,7 +110,7 @@ struct MinFunctor {
...
@@ -111,7 +110,7 @@ struct MinFunctor {
template
<
typename
T
>
template
<
typename
T
>
struct
MaxFunctor
{
struct
MaxFunctor
{
inline
T
initial
()
{
inline
T
initial
()
{
//
return static_cast<T>(std::numeric_limits<T>::lowest());
return
static_cast
<
T
>
(
std
::
numeric_limits
<
T
>::
lowest
());
}
}
__device__
T
operator
()(
const
T
&
a
,
const
T
&
b
)
const
{
__device__
T
operator
()(
const
T
&
a
,
const
T
&
b
)
const
{
...
@@ -124,8 +123,7 @@ struct MaxFunctor {
...
@@ -124,8 +123,7 @@ struct MaxFunctor {
*/
*/
template
<
typename
T
>
template
<
typename
T
>
struct
AddFunctor
{
struct
AddFunctor
{
inline
T
initial
()
{
/*return static_cast<T>(0.0f);*/
inline
T
initial
()
{
return
static_cast
<
T
>
(
0.0
f
);
}
}
__device__
T
operator
()(
const
T
a
,
const
T
b
)
const
{
return
b
+
a
;
}
__device__
T
operator
()(
const
T
a
,
const
T
b
)
const
{
return
b
+
a
;
}
};
};
...
@@ -135,8 +133,7 @@ struct AddFunctor {
...
@@ -135,8 +133,7 @@ struct AddFunctor {
*/
*/
template
<
typename
T
>
template
<
typename
T
>
struct
MulFunctor
{
struct
MulFunctor
{
inline
T
initial
()
{
/*return static_cast<T>(1.0f);*/
inline
T
initial
()
{
return
static_cast
<
T
>
(
1.0
f
);
}
}
__device__
T
operator
()(
const
T
&
a
,
const
T
&
b
)
const
{
return
b
*
a
;
}
__device__
T
operator
()(
const
T
&
a
,
const
T
&
b
)
const
{
return
b
*
a
;
}
};
};
...
@@ -146,8 +143,7 @@ struct MulFunctor {
...
@@ -146,8 +143,7 @@ struct MulFunctor {
*/
*/
template
<
typename
T
>
template
<
typename
T
>
struct
LogicalOrFunctor
{
struct
LogicalOrFunctor
{
inline
T
initial
()
{
/*return static_cast<T>(false);*/
inline
T
initial
()
{
return
static_cast
<
T
>
(
false
);
}
}
__device__
T
operator
()(
const
T
&
a
,
const
T
&
b
)
const
{
return
b
||
a
;
}
__device__
T
operator
()(
const
T
&
a
,
const
T
&
b
)
const
{
return
b
||
a
;
}
};
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录