Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
213f8038
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看板
未验证
提交
213f8038
编写于
8月 31, 2022
作者:
Z
zyfncg
提交者:
GitHub
8月 31, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert the change of remove_training_info (#45582)
* revert the change of remove_training_info * update * update
上级
413d6e1b
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
15 addition
and
18 deletion
+15
-18
python/paddle/fluid/framework.py
python/paddle/fluid/framework.py
+15
-18
未找到文件。
python/paddle/fluid/framework.py
浏览文件 @
213f8038
...
...
@@ -5867,26 +5867,23 @@ class Program(object):
# Note: The op_role and op_role_var cann't be deleted currently,
# and we will try to remove them in the future.
common_clipped_attrs_list
=
[
'op_namescope'
,
'op_callstack'
]
common_clipped_attrs_list
=
[
'op_namescope'
,
'op_callstack'
,
'op_device'
,
'with_quant_attr'
]
for
i
in
six
.
moves
.
range
(
res
.
desc
.
num_blocks
()):
block
=
res
.
desc
.
block
(
i
)
for
var
in
block
.
all_vars
():
var
.
clear_is_parameter
()
var
.
clear_stop_gradient
()
if
not
clip_extra
:
continue
for
op_idx
in
range
(
0
,
block
.
op_size
()):
op
=
block
.
op
(
op_idx
)
if
op
.
type
()
not
in
OpProtoHolder
.
instance
().
op_proto_map
:
continue
if
not
clip_extra
:
continue
extra_attrs_map
=
core
.
get_op_extra_attrs
(
op
.
type
())
for
name
in
op
.
attr_names
():
if
name
in
extra_attrs_map
:
op
.
remove_attr
(
name
)
continue
proto
=
OpProtoHolder
.
instance
().
get_op_proto
(
op
.
type
())
remove_input_list
=
[]
...
...
@@ -5901,9 +5898,8 @@ class Program(object):
break
if
not
find
:
remove_input_list
.
append
(
name
)
# The extra input of op will be removed in the future
# for name in remove_input_list:
# op.remove_input(name)
for
name
in
remove_input_list
:
op
.
remove_input
(
name
)
remove_output_list
=
[]
for
name
in
op
.
output_names
():
...
...
@@ -5917,10 +5913,10 @@ class Program(object):
break
if
not
find
:
remove_output_list
.
append
(
name
)
# The extra input of op will be removed in the future
# for name in remove_output_list:
# op.remove_output(name)
for
name
in
remove_output_list
:
op
.
remove_output
(
name
)
remove_attr_list
=
[]
op_quant_name
=
core
.
op_proto_and_checker_maker
.
kOpWithQuantAttrName
(
)
quant
=
bool
(
op
.
attr
(
op_quant_name
)
...
...
@@ -5930,21 +5926,22 @@ class Program(object):
"activation_bits"
,
"bit_length"
,
"quantize_weight_bits"
,
"weight_quant_scale"
]
remove_attr_list
=
[]
for
name
in
op
.
attr_names
():
if
quant
:
if
name
in
quant_attrs
:
continue
if
name
.
endswith
(
"_threshold"
):
continue
if
name
in
common_clipped_attrs_list
:
remove_attr_list
.
append
(
name
)
if
len
(
extra_attrs_map
)
>
0
:
if
name
in
extra_attrs_map
or
name
in
common_clipped_attrs_list
:
op
.
remove_attr
(
name
)
continue
find
=
False
for
attr_proto
in
proto
.
attrs
:
if
attr_proto
.
name
!=
name
:
continue
if
attr_proto
.
extra
:
remove_attr_list
.
append
(
name
)
find
=
True
break
if
not
find
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录