Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
182da953
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
182da953
编写于
3月 19, 2018
作者:
K
Kexin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
small fix
上级
f2bbbb2b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
11 addition
and
0 deletion
+11
-0
paddle/fluid/platform/float16.h
paddle/fluid/platform/float16.h
+11
-0
未找到文件。
paddle/fluid/platform/float16.h
浏览文件 @
182da953
...
...
@@ -490,6 +490,7 @@ HOSTDEVICE inline float16 operator+(const float16& a, const float16& b) {
return
float16
(
__hadd
(
half
(
a
),
half
(
b
)));
#else
return
float16
(
float
(
a
)
+
float
(
b
));
#endif
}
HOSTDEVICE
inline
float16
operator
-
(
const
float16
&
a
,
const
float16
&
b
)
{
...
...
@@ -497,6 +498,7 @@ HOSTDEVICE inline float16 operator-(const float16& a, const float16& b) {
return
float16
(
__hsub
(
half
(
a
),
half
(
b
)));
#else
return
float16
(
float
(
a
)
-
float
(
b
));
#endif
}
HOSTDEVICE
inline
float16
operator
*
(
const
float16
&
a
,
const
float16
&
b
)
{
...
...
@@ -504,6 +506,7 @@ HOSTDEVICE inline float16 operator*(const float16& a, const float16& b) {
return
float16
(
__hmul
(
half
(
a
),
half
(
b
)));
#else
return
float16
(
float
(
a
)
*
float
(
b
));
#endif
}
HOSTDEVICE
inline
float16
operator
/
(
const
float16
&
a
,
const
float16
&
b
)
{
...
...
@@ -514,6 +517,7 @@ HOSTDEVICE inline float16 operator/(const float16& a, const float16& b) {
return
float16
(
num
/
denom
);
#else
return
float16
(
float
(
a
)
/
float
(
b
));
#endif
}
HOSTDEVICE
inline
float16
operator
-
(
const
float16
&
a
)
{
...
...
@@ -523,6 +527,7 @@ HOSTDEVICE inline float16 operator-(const float16& a) {
float16
res
;
res
.
x
=
a
.
x
^
0x8000
;
return
res
;
#endif
}
HOSTDEVICE
inline
float16
&
operator
+=
(
float16
&
a
,
const
float16
&
b
)
{
...
...
@@ -550,6 +555,7 @@ HOSTDEVICE inline bool operator==(const float16& a, const float16& b) {
return
__heq
(
half
(
a
),
half
(
b
));
#else
return
float
(
a
)
==
float
(
b
);
#endif
}
HOSTDEVICE
inline
bool
operator
!=
(
const
float16
&
a
,
const
float16
&
b
)
{
...
...
@@ -557,6 +563,7 @@ HOSTDEVICE inline bool operator!=(const float16& a, const float16& b) {
return
__hne
(
half
(
a
),
half
(
b
));
#else
return
float
(
a
)
!=
float
(
b
);
#endif
}
HOSTDEVICE
inline
bool
operator
<
(
const
float16
&
a
,
const
float16
&
b
)
{
...
...
@@ -564,6 +571,7 @@ HOSTDEVICE inline bool operator<(const float16& a, const float16& b) {
return
__hlt
(
half
(
a
),
half
(
b
));
#else
return
float
(
a
)
<
float
(
b
);
#endif
}
HOSTDEVICE
inline
bool
operator
<=
(
const
float16
&
a
,
const
float16
&
b
)
{
...
...
@@ -571,6 +579,7 @@ HOSTDEVICE inline bool operator<=(const float16& a, const float16& b) {
return
__hle
(
half
(
a
),
half
(
b
));
#else
return
float
(
a
)
<=
float
(
b
);
#endif
}
HOSTDEVICE
inline
bool
operator
>
(
const
float16
&
a
,
const
float16
&
b
)
{
...
...
@@ -578,6 +587,7 @@ HOSTDEVICE inline bool operator>(const float16& a, const float16& b) {
return
__hgt
(
half
(
a
),
half
(
b
));
#else
return
float
(
a
)
>
float
(
b
);
#endif
}
HOSTDEVICE
inline
bool
operator
>=
(
const
float16
&
a
,
const
float16
&
b
)
{
...
...
@@ -585,6 +595,7 @@ HOSTDEVICE inline bool operator>=(const float16& a, const float16& b) {
return
__hge
(
half
(
a
),
half
(
b
));
#else
return
float
(
a
)
>=
float
(
b
);
#endif
}
// Arithmetic operators for float16 on ARMv8.2-A CPU
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录