Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
86e20086
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看板
提交
86e20086
编写于
12月 28, 2020
作者:
S
SunAhong1993
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix the onnx bug
上级
377d9b8d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
11 deletion
+15
-11
x2paddle/decoder/onnx_decoder.py
x2paddle/decoder/onnx_decoder.py
+0
-4
x2paddle/op_mapper/dygraph/onnx2paddle/opset9/opset.py
x2paddle/op_mapper/dygraph/onnx2paddle/opset9/opset.py
+8
-6
x2paddle/op_mapper/static/onnx2paddle/opset9/opset.py
x2paddle/op_mapper/static/onnx2paddle/opset9/opset.py
+7
-1
未找到文件。
x2paddle/decoder/onnx_decoder.py
浏览文件 @
86e20086
...
...
@@ -311,7 +311,6 @@ class ONNXGraph(Graph):
if
new_nd_name
not
in
node
.
which_child
:
node
.
which_child
[
new_nd_name
]
=
idx
break
print
(
node
.
which_child
)
else
:
first_i
=
node
.
inputs
.
index
(
nd
.
name
)
node
.
which_child
[
nd
.
name
]
=
idx
...
...
@@ -334,13 +333,10 @@ class ONNXGraph(Graph):
ipt_node
=
super
(
ONNXGraph
,
self
).
get_node
(
node
.
inputs
[
idx
],
copy
)
new_ipt_name
=
"{}/{}"
.
format
(
ipt_node
.
layer_name
,
idx
)
if
new_ipt_name
in
node
.
which_child
:
print
(
new_ipt_name
)
ipt_node
.
index
=
node
.
which_child
[
new_ipt_name
]
print
(
"ipt_node.index"
,
ipt_node
.
index
)
else
:
if
ipt_node
.
layer_name
in
node
.
which_child
:
ipt_node
.
index
=
node
.
which_child
[
ipt_node
.
layer_name
]
print
(
"ipt_node.index"
,
ipt_node
.
index
)
return
ipt_node
...
...
x2paddle/op_mapper/dygraph/onnx2paddle/opset9/opset.py
浏览文件 @
86e20086
...
...
@@ -255,10 +255,16 @@ class OpSet9():
if
len
(
node
.
layer
.
input
)
==
2
:
# opset 10
val_scales
=
self
.
graph
.
get_input_node
(
node
,
idx
=
1
,
copy
=
True
)
inputs
[
'scale_factor'
]
=
val_scales
.
name
# TODO(syf): paddle.nn.functional.interpolate will support the length
# which is the same as the rank of input.
# inputs['scale_factor'] = val_scales.name
attrs
[
'scale_factor'
]
=
self
.
weights
[
val_scales
.
name
].
tolist
()[
2
:]
elif
len
(
node
.
layer
.
input
)
==
3
:
# opset 11
val_scales
=
self
.
graph
.
get_input_node
(
node
,
idx
=
2
,
copy
=
True
)
# TODO(syf): paddle.nn.functional.interpolate will support the length
# which is the same as the rank of input.
# inputs['scale_factor'] = val_scales.name
attrs
[
'scale_factor'
]
=
self
.
weights
[
val_scales
.
name
].
tolist
()[
2
:]
elif
len
(
node
.
layer
.
input
)
==
4
:
# opset 11
...
...
@@ -291,7 +297,7 @@ class OpSet9():
return
elif
node
.
layer_type
==
'Upsample'
:
val_scales
=
self
.
graph
.
get_input_node
(
node
,
idx
=
1
,
copy
=
True
)
inputs
[
'scale'
]
=
val_scales
inputs
[
'scale
_factor
'
]
=
val_scales
mode
=
node
.
get_attr
(
'mode'
,
'nearest'
)
attrs
.
update
({
"align_corners"
:
False
,
...
...
@@ -1097,10 +1103,6 @@ class OpSet9():
dtypes
=
set
()
for
i
in
range
(
len
(
node
.
layer
.
input
)):
ipt
=
self
.
graph
.
get_input_node
(
node
,
idx
=
i
,
copy
=
True
)
try
:
print
(
ipt
.
index
)
except
:
pass
inputs_list
.
append
(
ipt
.
name
)
dtypes
.
add
(
ipt
.
dtype
)
if
len
(
dtypes
)
>
1
:
...
...
x2paddle/op_mapper/static/onnx2paddle/opset9/opset.py
浏览文件 @
86e20086
...
...
@@ -245,10 +245,16 @@ class OpSet9():
if
len
(
node
.
layer
.
input
)
==
2
:
# opset 10
val_scales
=
self
.
graph
.
get_input_node
(
node
,
idx
=
1
,
copy
=
True
)
inputs
[
'scale_factor'
]
=
val_scales
.
name
# TODO(syf): paddle.nn.functional.interpolate will support the length
# which is the same as the rank of input.
# inputs['scale_factor'] = val_scales.name
attrs
[
'scale_factor'
]
=
self
.
params
[
val_scales
.
name
].
tolist
()[
2
:]
elif
len
(
node
.
layer
.
input
)
==
3
:
# opset 11
val_scales
=
self
.
graph
.
get_input_node
(
node
,
idx
=
2
,
copy
=
True
)
# TODO(syf): paddle.nn.functional.interpolate will support the length
# which is the same as the rank of input.
# inputs['scale_factor'] = val_scales.name
attrs
[
'scale_factor'
]
=
self
.
params
[
val_scales
.
name
].
tolist
()[
2
:]
elif
len
(
node
.
layer
.
input
)
==
4
:
# opset 11
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录