Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
9a6c85a5
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看板
未验证
提交
9a6c85a5
编写于
3月 06, 2022
作者:
W
WJJ1995
提交者:
GitHub
3月 06, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed resize op (#749)
上级
2958c54e
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
28 addition
and
4 deletion
+28
-4
x2paddle/op_mapper/onnx2paddle/opset9/opset.py
x2paddle/op_mapper/onnx2paddle/opset9/opset.py
+28
-4
未找到文件。
x2paddle/op_mapper/onnx2paddle/opset9/opset.py
浏览文件 @
9a6c85a5
...
@@ -296,14 +296,40 @@ class OpSet9():
...
@@ -296,14 +296,40 @@ class OpSet9():
val_x
=
self
.
graph
.
get_input_node
(
node
,
idx
=
0
,
copy
=
True
)
val_x
=
self
.
graph
.
get_input_node
(
node
,
idx
=
0
,
copy
=
True
)
inputs
=
{
'x'
:
val_x
.
name
}
inputs
=
{
'x'
:
val_x
.
name
}
attrs
=
dict
()
attrs
=
dict
()
val_x_shape
=
val_x
.
out_shapes
[
0
]
if
node
.
layer_type
==
'Resize'
:
if
node
.
layer_type
==
'Resize'
:
if
len
(
node
.
layer
.
input
)
==
2
:
if
len
(
node
.
layer
.
input
)
==
2
:
# opset 10
# opset 10
val_scales
=
self
.
graph
.
get_input_node
(
node
,
idx
=
1
,
copy
=
True
)
val_scales
=
self
.
graph
.
get_input_node
(
node
,
idx
=
1
,
copy
=
True
)
# TODO(syf): paddle.nn.functional.interpolate will support the length
# TODO(syf): paddle.nn.functional.interpolate will support the length
# which is the same as the rank of input.
# which is the same as the rank of input.
attrs
[
'scale_factor'
]
=
self
.
weights
[
val_scales
.
name
].
tolist
()[
scale_values
=
_const_weight_or_none
(
val_scales
)
2
:]
if
scale_values
is
not
None
:
attrs
[
'scale_factor'
]
=
self
.
weights
[
val_scales
.
name
].
tolist
()[
2
:]
else
:
var_nc
,
var_hw
=
val_scales
.
name
+
'_nc'
,
val_scales
.
name
+
'_hw'
self
.
paddle_graph
.
add_layer
(
'paddle.split'
,
inputs
=
{
"x"
:
val_scales
.
name
},
outputs
=
[
var_nc
,
var_hw
],
num_or_sections
=
[
2
,
2
],
axis
=
0
)
inputs
[
'scale_factor'
]
=
var_hw
mode
=
node
.
get_attr
(
'mode'
,
'nearest'
)
attrs
.
update
({
"align_corners"
:
False
,
"mode"
:
string
(
mode
),
"align_mode"
:
1
})
if
mode
==
"linear"
and
len
(
val_x_shape
)
==
4
:
attrs
[
"mode"
]
=
string
(
"bilinear"
)
self
.
paddle_graph
.
add_layer
(
kernel
=
"paddle.nn.functional.interpolate"
,
inputs
=
inputs
,
outputs
=
[
node
.
name
],
**
attrs
)
return
elif
len
(
node
.
layer
.
input
)
==
3
:
elif
len
(
node
.
layer
.
input
)
==
3
:
# opset 11
# opset 11
val_scales
=
self
.
graph
.
get_input_node
(
node
,
idx
=
2
,
copy
=
True
)
val_scales
=
self
.
graph
.
get_input_node
(
node
,
idx
=
2
,
copy
=
True
)
...
@@ -315,7 +341,6 @@ class OpSet9():
...
@@ -315,7 +341,6 @@ class OpSet9():
# opset 11
# opset 11
val_sizes
=
self
.
graph
.
get_input_node
(
node
,
idx
=
3
,
copy
=
True
)
val_sizes
=
self
.
graph
.
get_input_node
(
node
,
idx
=
3
,
copy
=
True
)
size_values
=
_const_weight_or_none
(
val_sizes
)
size_values
=
_const_weight_or_none
(
val_sizes
)
val_x_shape
=
val_x
.
out_shapes
[
0
]
if
len
(
val_x_shape
)
==
3
:
if
len
(
val_x_shape
)
==
3
:
var_n
,
var_hw
=
val_sizes
.
name
+
'_n'
,
val_sizes
.
name
+
'_hw'
var_n
,
var_hw
=
val_sizes
.
name
+
'_n'
,
val_sizes
.
name
+
'_hw'
self
.
paddle_graph
.
add_layer
(
self
.
paddle_graph
.
add_layer
(
...
@@ -418,7 +443,6 @@ class OpSet9():
...
@@ -418,7 +443,6 @@ class OpSet9():
})
})
if
len
(
node
.
layer
.
input
)
==
1
:
if
len
(
node
.
layer
.
input
)
==
1
:
attrs
[
"scale_factor"
]
=
val_scales
attrs
[
"scale_factor"
]
=
val_scales
val_x_shape
=
val_x
.
out_shapes
[
0
]
if
mode
==
"linear"
and
len
(
val_x_shape
)
==
4
:
if
mode
==
"linear"
and
len
(
val_x_shape
)
==
4
:
attrs
[
"mode"
]
=
string
(
"bilinear"
)
attrs
[
"mode"
]
=
string
(
"bilinear"
)
if
node
.
get_attr
(
'coordinate_transformation_mode'
,
if
node
.
get_attr
(
'coordinate_transformation_mode'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录