Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
4d7134cc
X
X2Paddle
项目概览
PaddlePaddle
/
X2Paddle
大约 1 年 前同步成功
通知
328
Star
698
Fork
167
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
26
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
X2Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
26
Issue
26
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
4d7134cc
编写于
12月 17, 2020
作者:
S
SunAhong1993
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix the tf
上级
c48cf6d8
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
5 addition
and
15 deletion
+5
-15
x2paddle/decoder/tf_decoder.py
x2paddle/decoder/tf_decoder.py
+1
-1
x2paddle/optimizer/elimination/dygraph/transpose_elimination.py
...le/optimizer/elimination/dygraph/transpose_elimination.py
+2
-7
x2paddle/optimizer/elimination/static/transpose_elimination.py
...dle/optimizer/elimination/static/transpose_elimination.py
+2
-7
未找到文件。
x2paddle/decoder/tf_decoder.py
浏览文件 @
4d7134cc
...
@@ -172,7 +172,7 @@ class TFGraph(Graph):
...
@@ -172,7 +172,7 @@ class TFGraph(Graph):
self
.
_remove_isolated_node
()
self
.
_remove_isolated_node
()
self
.
_optimize_dialiation_conv
()
self
.
_optimize_dialiation_conv
()
self
.
_remove_identity_node
()
self
.
_remove_identity_node
()
#
self._remove_cast_node()
self
.
_remove_cast_node
()
def
get_node
(
self
,
node_name
,
copy
=
False
):
def
get_node
(
self
,
node_name
,
copy
=
False
):
...
...
x2paddle/optimizer/elimination/dygraph/transpose_elimination.py
浏览文件 @
4d7134cc
...
@@ -178,13 +178,13 @@ class DygraphTransposeElimination(FuseBase):
...
@@ -178,13 +178,13 @@ class DygraphTransposeElimination(FuseBase):
if
_graph
.
layers
[
ipt
].
outputs
[
if
_graph
.
layers
[
ipt
].
outputs
[
output_index
]
==
_graph
.
layers
[
current_id
].
inputs
[
output_index
]
==
_graph
.
layers
[
current_id
].
inputs
[
'x'
]:
'x'
]:
if
l
en
(
x_shape
)
<=
1
:
if
l
ist
(
x_shape
)
==
[
1
]
or
len
(
x_shape
)
<
1
:
elementwise_layers
.
append
(
current_id
)
elementwise_layers
.
append
(
current_id
)
continue
continue
elif
_graph
.
layers
[
ipt
].
outputs
[
elif
_graph
.
layers
[
ipt
].
outputs
[
output_index
]
==
_graph
.
layers
[
current_id
].
inputs
[
output_index
]
==
_graph
.
layers
[
current_id
].
inputs
[
'y'
]:
'y'
]:
if
l
en
(
y_shape
)
<=
1
:
if
l
ist
(
y_shape
)
==
[
1
]
or
len
(
y_shape
)
<
1
:
elementwise_layers
.
append
(
current_id
)
elementwise_layers
.
append
(
current_id
)
continue
continue
else
:
else
:
...
@@ -279,11 +279,6 @@ class DygraphTransposeElimination(FuseBase):
...
@@ -279,11 +279,6 @@ class DygraphTransposeElimination(FuseBase):
for
layer_id
in
list
(
set
(
optimized_concat_layers
)):
for
layer_id
in
list
(
set
(
optimized_concat_layers
)):
axis
=
graph
.
layers
[
layer_id
].
attrs
.
get
(
'axis'
,
0
)
axis
=
graph
.
layers
[
layer_id
].
attrs
.
get
(
'axis'
,
0
)
graph
.
layers
[
layer_id
].
attrs
[
'axis'
]
=
[
0
,
2
,
3
,
1
][
axis
]
graph
.
layers
[
layer_id
].
attrs
[
'axis'
]
=
[
0
,
2
,
3
,
1
][
axis
]
for
layer_id
in
list
(
set
(
optimized_elementwise_layers
)):
axis
=
graph
.
layers
[
layer_id
].
attrs
.
get
(
'axis'
,
-
1
)
graph
.
layers
[
layer_id
].
attrs
[
'axis'
]
=
[
0
,
2
,
3
,
1
][
axis
]
if
graph
.
layers
[
layer_id
].
kernel
==
"paddle.add"
:
graph
.
layers
[
layer_id
].
kernel
=
"fluid.layers.elementwise_add"
current_transpose_num
=
self
.
get_transpose_num
(
graph
)
current_transpose_num
=
self
.
get_transpose_num
(
graph
)
print
(
print
(
...
...
x2paddle/optimizer/elimination/static/transpose_elimination.py
浏览文件 @
4d7134cc
...
@@ -178,13 +178,13 @@ class StaticTransposeElimination(FuseBase):
...
@@ -178,13 +178,13 @@ class StaticTransposeElimination(FuseBase):
if
_graph
.
layers
[
ipt
].
outputs
[
if
_graph
.
layers
[
ipt
].
outputs
[
output_index
]
==
_graph
.
layers
[
current_id
].
inputs
[
output_index
]
==
_graph
.
layers
[
current_id
].
inputs
[
'x'
]:
'x'
]:
if
l
en
(
x_shape
)
<=
1
:
if
l
ist
(
x_shape
)
==
[
1
]
or
len
(
x_shape
)
<
1
:
elementwise_layers
.
append
(
current_id
)
elementwise_layers
.
append
(
current_id
)
continue
continue
elif
_graph
.
layers
[
ipt
].
outputs
[
elif
_graph
.
layers
[
ipt
].
outputs
[
output_index
]
==
_graph
.
layers
[
current_id
].
inputs
[
output_index
]
==
_graph
.
layers
[
current_id
].
inputs
[
'y'
]:
'y'
]:
if
l
en
(
y_shape
)
<=
1
:
if
l
ist
(
y_shape
)
==
[
1
]
or
len
(
y_shape
)
<
1
:
elementwise_layers
.
append
(
current_id
)
elementwise_layers
.
append
(
current_id
)
continue
continue
else
:
else
:
...
@@ -279,11 +279,6 @@ class StaticTransposeElimination(FuseBase):
...
@@ -279,11 +279,6 @@ class StaticTransposeElimination(FuseBase):
for
layer_id
in
list
(
set
(
optimized_concat_layers
)):
for
layer_id
in
list
(
set
(
optimized_concat_layers
)):
axis
=
graph
.
layers
[
layer_id
].
attrs
.
get
(
'axis'
,
0
)
axis
=
graph
.
layers
[
layer_id
].
attrs
.
get
(
'axis'
,
0
)
graph
.
layers
[
layer_id
].
attrs
[
'axis'
]
=
[
0
,
2
,
3
,
1
][
axis
]
graph
.
layers
[
layer_id
].
attrs
[
'axis'
]
=
[
0
,
2
,
3
,
1
][
axis
]
for
layer_id
in
list
(
set
(
optimized_elementwise_layers
)):
axis
=
graph
.
layers
[
layer_id
].
attrs
.
get
(
'axis'
,
-
1
)
graph
.
layers
[
layer_id
].
attrs
[
'axis'
]
=
[
0
,
2
,
3
,
1
][
axis
]
if
graph
.
layers
[
layer_id
].
kernel
==
"paddle.add"
:
graph
.
layers
[
layer_id
].
kernel
=
"fluid.layers.elementwise_add"
current_transpose_num
=
self
.
get_transpose_num
(
graph
)
current_transpose_num
=
self
.
get_transpose_num
(
graph
)
print
(
print
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录