Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
8c13edc1
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看板
提交
8c13edc1
编写于
4月 09, 2021
作者:
S
SunAhong1993
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix the tf
上级
4f892dd9
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
15 addition
and
5 deletion
+15
-5
x2paddle/decoder/tf_decoder.py
x2paddle/decoder/tf_decoder.py
+7
-1
x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py
x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py
+4
-2
x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py
x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py
+4
-2
未找到文件。
x2paddle/decoder/tf_decoder.py
浏览文件 @
8c13edc1
...
@@ -101,6 +101,7 @@ class TFGraphNode(GraphNode):
...
@@ -101,6 +101,7 @@ class TFGraphNode(GraphNode):
@
property
@
property
def
name
(
self
):
def
name
(
self
):
if
hasattr
(
self
,
'index'
):
if
hasattr
(
self
,
'index'
):
print
(
self
.
layer_type
)
return
self
.
layer_name
+
"_p{}"
.
format
(
self
.
index
)
return
self
.
layer_name
+
"_p{}"
.
format
(
self
.
index
)
return
self
.
layer_name
return
self
.
layer_name
...
@@ -184,7 +185,7 @@ class TFGraph(Graph):
...
@@ -184,7 +185,7 @@ class TFGraph(Graph):
node
=
super
(
TFGraph
,
self
).
get_node
(
new_node_name
,
copy
)
node
=
super
(
TFGraph
,
self
).
get_node
(
new_node_name
,
copy
)
if
node
is
None
:
if
node
is
None
:
return
None
return
None
if
node
.
layer_type
==
"Switch"
:
if
node
.
layer_type
in
[
"Switch"
,
"Reshape"
,
"Sub"
]
:
if
hasattr
(
node
,
'index'
):
if
hasattr
(
node
,
'index'
):
del
node
.
index
del
node
.
index
if
len
(
items
)
==
1
and
node
.
layer_type
in
self
.
multi_out_ops
:
if
len
(
items
)
==
1
and
node
.
layer_type
in
self
.
multi_out_ops
:
...
@@ -284,6 +285,11 @@ class TFGraph(Graph):
...
@@ -284,6 +285,11 @@ class TFGraph(Graph):
if
node_name
in
self
.
output_nodes
:
if
node_name
in
self
.
output_nodes
:
idx
=
self
.
output_nodes
.
index
(
node_name
)
idx
=
self
.
output_nodes
.
index
(
node_name
)
self
.
output_nodes
[
idx
]
=
input_node
.
layer_name
self
.
output_nodes
[
idx
]
=
input_node
.
layer_name
if
len
(
input_node
.
outputs
)
>
0
:
self
.
output_nodes
.
pop
(
idx
)
else
:
self
.
output_nodes
[
idx
]
=
input_node
.
layer_name
def
_remove_cast_node
(
self
):
def
_remove_cast_node
(
self
):
cast_node
=
list
()
cast_node
=
list
()
...
...
x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py
浏览文件 @
8c13edc1
...
@@ -248,8 +248,10 @@ class TFOpMapper(OpMapper):
...
@@ -248,8 +248,10 @@ class TFOpMapper(OpMapper):
def
Transpose
(
self
,
node
):
def
Transpose
(
self
,
node
):
input
=
self
.
graph
.
get_input_node
(
node
,
0
)
input
=
self
.
graph
.
get_input_node
(
node
,
0
)
perm
=
self
.
graph
.
get_input_node
(
node
,
1
)
perm
=
self
.
graph
.
get_input_node
(
node
,
1
)
assert
perm
.
layer_type
==
"Const"
,
"Perm of transpose OP should be Const"
if
perm
.
layer_type
==
"Const"
:
perm
=
perm
.
value
.
tolist
()
perm
=
perm
.
value
.
tolist
()
else
:
perm
=
self
.
decoder
.
infer_tensor
(
perm
,
use_diff_inputs
=
False
).
tolist
()
self
.
paddle_graph
.
add_layer
(
self
.
paddle_graph
.
add_layer
(
"paddle.transpose"
,
"paddle.transpose"
,
...
...
x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py
浏览文件 @
8c13edc1
...
@@ -238,8 +238,10 @@ class TFOpMapper(OpMapper):
...
@@ -238,8 +238,10 @@ class TFOpMapper(OpMapper):
def
Transpose
(
self
,
node
):
def
Transpose
(
self
,
node
):
input
=
self
.
graph
.
get_node
(
node
.
layer
.
input
[
0
])
input
=
self
.
graph
.
get_node
(
node
.
layer
.
input
[
0
])
perm
=
self
.
graph
.
get_node
(
node
.
layer
.
input
[
1
])
perm
=
self
.
graph
.
get_node
(
node
.
layer
.
input
[
1
])
assert
perm
.
layer_type
==
"Const"
,
"Perm of transpose OP should be Const"
if
perm
.
layer_type
==
"Const"
:
perm
=
perm
.
value
.
tolist
()
perm
=
perm
.
value
.
tolist
()
else
:
perm
=
self
.
decoder
.
infer_tensor
(
perm
,
use_diff_inputs
=
False
).
tolist
()
self
.
paddle_graph
.
add_layer
(
self
.
paddle_graph
.
add_layer
(
kernel
=
"paddle.transpose"
,
kernel
=
"paddle.transpose"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录