Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSlim
提交
a3b9d118
P
PaddleSlim
项目概览
PaddlePaddle
/
PaddleSlim
1 年多 前同步成功
通知
51
Star
1434
Fork
344
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
53
列表
看板
标记
里程碑
合并请求
16
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleSlim
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
53
Issue
53
列表
看板
标记
里程碑
合并请求
16
合并请求
16
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a3b9d118
编写于
8月 19, 2020
作者:
C
chenluyan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
(1)add ops for prune_walker;(2)fix bugs of pruning mul
上级
241d4c8a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
55 addition
and
1 deletion
+55
-1
paddleslim/prune/prune_walker.py
paddleslim/prune/prune_walker.py
+55
-1
未找到文件。
paddleslim/prune/prune_walker.py
浏览文件 @
a3b9d118
...
...
@@ -550,7 +550,7 @@ class mul(PruneWorker):
self
.
pruned_params
.
append
((
param_var
,
0
,
idx
))
for
op
in
param_var
.
outputs
():
self
.
_prune_op
(
op
,
param_var
,
0
,
pruned_
idx
)
self
.
_prune_op
(
op
,
param_var
,
0
,
idx
)
@
PRUNE_WORKER
.
register
...
...
@@ -623,3 +623,57 @@ class affine_channel(PruneWorker):
next_ops
=
out_var
.
outputs
()
for
op
in
next_ops
:
self
.
_prune_op
(
op
,
out_var
,
pruned_axis
,
pruned_idx
)
@
PRUNE_WORKER
.
register
class
roi_align
(
PruneWorker
):
def
__init__
(
self
,
op
,
pruned_params
,
visited
):
super
(
roi_align
,
self
).
__init__
(
op
,
pruned_params
,
visited
)
def
_prune
(
self
,
var
,
pruned_axis
,
pruned_idx
):
if
var
in
self
.
op
.
outputs
(
"Out"
):
in_var
=
self
.
op
.
inputs
(
"X"
)[
0
]
pre_ops
=
in_var
.
inputs
()
for
op
in
pre_ops
:
self
.
_prune_op
(
op
,
in_var
,
pruned_axis
,
pruned_idx
)
out_var
=
self
.
op
.
outputs
(
"Out"
)[
0
]
self
.
_visit
(
out_var
,
pruned_axis
)
next_ops
=
out_var
.
outputs
()
for
op
in
next_ops
:
self
.
_prune_op
(
op
,
out_var
,
pruned_axis
,
pruned_idx
)
@
PRUNE_WORKER
.
register
class
lod_reset
(
PruneWorker
):
def
__init__
(
self
,
op
,
pruned_params
,
visited
=
{}):
super
(
lod_reset
,
self
).
__init__
(
op
,
pruned_params
,
visited
)
def
_prune
(
self
,
var
,
pruned_axis
,
pruned_idx
):
if
var
in
self
.
op
.
outputs
(
"Out"
):
in_var
=
self
.
op
.
inputs
(
"X"
)[
0
]
pre_ops
=
in_var
.
inputs
()
for
op
in
pre_ops
:
self
.
_prune_op
(
op
,
in_var
,
pruned_axis
,
pruned_idx
)
out_var
=
self
.
op
.
outputs
(
"Out"
)[
0
]
self
.
_visit
(
out_var
,
pruned_axis
)
next_ops
=
out_var
.
outputs
()
for
op
in
next_ops
:
self
.
_prune_op
(
op
,
out_var
,
pruned_axis
,
pruned_idx
)
@
PRUNE_WORKER
.
register
class
gather
(
PruneWorker
):
def
__init__
(
self
,
op
,
pruned_params
,
visited
):
super
(
gather
,
self
).
__init__
(
op
,
pruned_params
,
visited
)
def
_prune
(
self
,
var
,
pruned_axis
,
pruned_idx
):
if
var
in
self
.
op
.
outputs
(
"Out"
):
in_var
=
self
.
op
.
inputs
(
"X"
)[
0
]
pre_ops
=
in_var
.
inputs
()
for
op
in
pre_ops
:
self
.
_prune_op
(
op
,
in_var
,
pruned_axis
,
pruned_idx
)
out_var
=
self
.
op
.
outputs
(
"Out"
)[
0
]
self
.
_visit
(
out_var
,
pruned_axis
)
next_ops
=
out_var
.
outputs
()
for
op
in
next_ops
:
self
.
_prune_op
(
op
,
out_var
,
pruned_axis
,
pruned_idx
)
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录