Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
f781473e
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
f781473e
编写于
11月 14, 2022
作者:
J
JZ-LIANG
提交者:
GitHub
11月 14, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[AutoParallel] bugfixed for FP16 if cond (#47841)
* fixed cond state * fixed cond state
上级
f50de679
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
11 addition
and
8 deletion
+11
-8
python/paddle/distributed/passes/auto_parallel_fp16.py
python/paddle/distributed/passes/auto_parallel_fp16.py
+11
-8
未找到文件。
python/paddle/distributed/passes/auto_parallel_fp16.py
浏览文件 @
f781473e
...
...
@@ -256,7 +256,10 @@ class FP16State:
for
op
in
block
.
ops
:
if
is_forward_op
(
op
):
# NOTE (JZ-LIANG) un-expected cast op when user call "+, -, *, /" in python
if
self
.
_is_fp16_op
(
op
.
desc
.
original_id
())
or
op
.
type
==
"cast"
:
if
(
self
.
_is_fp16_op
(
op
.
desc
.
original_id
())
is
True
or
op
.
type
==
"cast"
):
for
in_name
in
op
.
input_names
:
if
_keep_fp32_input
(
op
,
in_name
):
continue
...
...
@@ -273,7 +276,7 @@ class FP16State:
self
.
set_var_to_fp16
(
out_var_name
,
block
)
set_op_dtype_to_fp16
(
op
)
# NOTE (JZ-LIANG) un-expected cast op when user call "+, -, *, /" in python
elif
not
self
.
_is_fp16_op
(
op
.
desc
.
original_id
())
:
elif
self
.
_is_fp16_op
(
op
.
desc
.
original_id
())
is
False
:
for
out_var_name
in
op
.
output_arg_names
:
out_var
=
block
.
vars
.
get
(
out_var_name
)
if
out_var
is
None
or
out_var
.
type
not
in
_valid_types
:
...
...
@@ -281,7 +284,7 @@ class FP16State:
if
out_var
.
dtype
==
core
.
VarDesc
.
VarType
.
FP16
:
out_var
.
desc
.
set_dtype
(
core
.
VarDesc
.
VarType
.
FP32
)
elif
is_backward_op
(
op
):
if
self
.
_is_fp16_op
(
op
.
desc
.
original_id
()):
if
self
.
_is_fp16_op
(
op
.
desc
.
original_id
())
is
True
:
for
out_name
in
op
.
output_names
:
if
_keep_fp32_output
(
op
,
out_name
):
continue
...
...
@@ -289,7 +292,7 @@ class FP16State:
self
.
set_var_to_fp16
(
out_var_name
,
block
)
set_op_dtype_to_fp16
(
op
)
# NOTE (JZ-LIANG) un-expected cast op when user call "+, -, *, /" in python
elif
not
self
.
_is_fp16_op
(
op
.
desc
.
original_id
())
:
elif
self
.
_is_fp16_op
(
op
.
desc
.
original_id
())
is
False
:
for
out_var_name
in
op
.
output_arg_names
:
out_var
=
block
.
vars
.
get
(
out_var_name
)
if
out_var
is
None
or
out_var
.
type
not
in
_valid_types
:
...
...
@@ -308,7 +311,7 @@ class FP16State:
idx
+=
1
continue
elif
is_forward_op
(
op
):
if
not
self
.
_is_fp16_op
(
op
.
desc
.
original_id
())
:
if
self
.
_is_fp16_op
(
op
.
desc
.
original_id
())
is
False
:
num_cast_ops
=
self
.
_insert_forward_cast_ops
(
op
,
idx
,
...
...
@@ -317,7 +320,7 @@ class FP16State:
core
.
VarDesc
.
VarType
.
FP32
,
self
.
dist_context
,
)
elif
self
.
_is_fp16_op
(
op
.
desc
.
original_id
()):
elif
self
.
_is_fp16_op
(
op
.
desc
.
original_id
())
is
True
:
num_cast_ops
=
self
.
_insert_forward_cast_ops
(
op
,
idx
,
...
...
@@ -328,7 +331,7 @@ class FP16State:
)
elif
is_backward_op
(
op
):
if
op
.
desc
.
original_id
()
in
dist_op_context
.
grad_op_id_to_op_id
:
if
not
self
.
_is_fp16_op
(
op
.
desc
.
original_id
())
:
if
self
.
_is_fp16_op
(
op
.
desc
.
original_id
())
is
False
:
num_cast_ops
=
self
.
_insert_backward_cast_ops
(
op
,
idx
,
...
...
@@ -337,7 +340,7 @@ class FP16State:
core
.
VarDesc
.
VarType
.
FP32
,
self
.
dist_context
,
)
elif
self
.
_is_fp16_op
(
op
.
desc
.
original_id
()):
elif
self
.
_is_fp16_op
(
op
.
desc
.
original_id
())
is
True
:
num_cast_ops
=
self
.
_insert_backward_cast_ops
(
op
,
idx
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录