Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
6511e005
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看板
提交
6511e005
编写于
12月 18, 2020
作者:
S
SunAhong1993
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove transpose
上级
4d7134cc
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
14 addition
and
6 deletion
+14
-6
x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py
x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py
+14
-6
未找到文件。
x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py
浏览文件 @
6511e005
...
@@ -96,6 +96,7 @@ class TFOpMapper(OpMapper):
...
@@ -96,6 +96,7 @@ class TFOpMapper(OpMapper):
raise
Exception
(
"Model is not supported yet."
)
raise
Exception
(
"Model is not supported yet."
)
self
.
params
=
dict
()
self
.
params
=
dict
()
self
.
paddle_graph
=
PaddleGraph
(
parent_layer
=
None
,
graph_type
=
"static"
,
source_type
=
"tf"
)
self
.
paddle_graph
=
PaddleGraph
(
parent_layer
=
None
,
graph_type
=
"static"
,
source_type
=
"tf"
)
self
.
params_output2id
=
dict
()
not_placeholder
=
list
()
not_placeholder
=
list
()
for
name
in
self
.
graph
.
input_nodes
:
for
name
in
self
.
graph
.
input_nodes
:
...
@@ -224,7 +225,7 @@ class TFOpMapper(OpMapper):
...
@@ -224,7 +225,7 @@ class TFOpMapper(OpMapper):
return
return
self
.
params
[
node
.
name
]
=
node
.
value
self
.
params
[
node
.
name
]
=
node
.
value
self
.
paddle_graph
.
add_layer
(
layer_id
=
self
.
paddle_graph
.
add_layer
(
kernel
=
"paddle.static.create_parameter"
,
kernel
=
"paddle.static.create_parameter"
,
inputs
=
{},
inputs
=
{},
outputs
=
[
node
.
name
],
outputs
=
[
node
.
name
],
...
@@ -232,6 +233,7 @@ class TFOpMapper(OpMapper):
...
@@ -232,6 +233,7 @@ class TFOpMapper(OpMapper):
shape
=
shape
,
shape
=
shape
,
name
=
string
(
node
.
name
),
name
=
string
(
node
.
name
),
default_initializer
=
"paddle.nn.initializer.Constant(value=0.0)"
)
default_initializer
=
"paddle.nn.initializer.Constant(value=0.0)"
)
self
.
params_output2id
[
node
.
name
]
=
layer_id
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
])
...
@@ -774,6 +776,12 @@ class TFOpMapper(OpMapper):
...
@@ -774,6 +776,12 @@ class TFOpMapper(OpMapper):
data_format
=
node
.
get_attr
(
"data_format"
).
decode
()
data_format
=
node
.
get_attr
(
"data_format"
).
decode
()
pad_mode
=
node
.
get_attr
(
"padding"
).
decode
()
pad_mode
=
node
.
get_attr
(
"padding"
).
decode
()
if
len
(
kernel
.
outputs
)
==
1
:
self
.
params
[
kernel
.
name
]
=
numpy
.
transpose
(
self
.
params
[
kernel
.
name
],
(
2
,
3
,
0
,
1
))
layer
=
self
.
paddle_graph
.
layers
[
self
.
params_output2id
[
kernel
.
name
]]
layer
.
attrs
[
"shape"
]
=
self
.
params
[
kernel
.
name
].
shape
else
:
self
.
paddle_graph
.
add_layer
(
self
.
paddle_graph
.
add_layer
(
kernel
=
"paddle.transpose"
,
kernel
=
"paddle.transpose"
,
inputs
=
{
"x"
:
kernel
.
name
},
inputs
=
{
"x"
:
kernel
.
name
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录