Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
3f51c5ce
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看板
提交
3f51c5ce
编写于
8月 14, 2020
作者:
C
Channingss
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug of nearest opset11
上级
0a40bebb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
8 addition
and
1 deletion
+8
-1
x2paddle/op_mapper/paddle2onnx/opset11/opset.py
x2paddle/op_mapper/paddle2onnx/opset11/opset.py
+8
-1
未找到文件。
x2paddle/op_mapper/paddle2onnx/opset11/opset.py
浏览文件 @
3f51c5ce
...
@@ -29,6 +29,7 @@ class OpSet11(OpSet10):
...
@@ -29,6 +29,7 @@ class OpSet11(OpSet10):
super
(
OpSet11
,
self
).
__init__
()
super
(
OpSet11
,
self
).
__init__
()
def
relu6
(
self
,
op
,
block
):
def
relu6
(
self
,
op
,
block
):
print
(
'relu6'
)
min_name
=
self
.
get_name
(
op
.
type
,
'min'
)
min_name
=
self
.
get_name
(
op
.
type
,
'min'
)
max_name
=
self
.
get_name
(
op
.
type
,
'max'
)
max_name
=
self
.
get_name
(
op
.
type
,
'max'
)
min_node
=
self
.
make_constant_node
(
min_name
,
onnx_pb
.
TensorProto
.
FLOAT
,
min_node
=
self
.
make_constant_node
(
min_name
,
onnx_pb
.
TensorProto
.
FLOAT
,
...
@@ -42,6 +43,7 @@ class OpSet11(OpSet10):
...
@@ -42,6 +43,7 @@ class OpSet11(OpSet10):
return
[
min_node
,
max_node
,
node
]
return
[
min_node
,
max_node
,
node
]
def
pad2d
(
self
,
op
,
block
):
def
pad2d
(
self
,
op
,
block
):
print
(
'pad2d'
)
x_shape
=
block
.
var
(
op
.
input
(
'X'
)[
0
]).
shape
x_shape
=
block
.
var
(
op
.
input
(
'X'
)[
0
]).
shape
paddings
=
op
.
attr
(
'paddings'
)
paddings
=
op
.
attr
(
'paddings'
)
onnx_pads
=
[]
onnx_pads
=
[]
...
@@ -69,6 +71,7 @@ class OpSet11(OpSet10):
...
@@ -69,6 +71,7 @@ class OpSet11(OpSet10):
return
[
pads_node
,
constant_value_node
,
node
]
return
[
pads_node
,
constant_value_node
,
node
]
def
clip
(
self
,
op
,
block
):
def
clip
(
self
,
op
,
block
):
print
(
'clip'
)
min_name
=
self
.
get_name
(
op
.
type
,
'min'
)
min_name
=
self
.
get_name
(
op
.
type
,
'min'
)
max_name
=
self
.
get_name
(
op
.
type
,
'max'
)
max_name
=
self
.
get_name
(
op
.
type
,
'max'
)
min_node
=
self
.
make_constant_node
(
min_name
,
onnx_pb
.
TensorProto
.
FLOAT
,
min_node
=
self
.
make_constant_node
(
min_name
,
onnx_pb
.
TensorProto
.
FLOAT
,
...
@@ -82,6 +85,7 @@ class OpSet11(OpSet10):
...
@@ -82,6 +85,7 @@ class OpSet11(OpSet10):
return
[
min_node
,
max_node
,
node
]
return
[
min_node
,
max_node
,
node
]
def
bilinear_interp
(
self
,
op
,
block
):
def
bilinear_interp
(
self
,
op
,
block
):
print
(
'bilinear'
)
input_names
=
op
.
input_names
input_names
=
op
.
input_names
coordinate_transformation_mode
=
''
coordinate_transformation_mode
=
''
align_corners
=
op
.
attr
(
'align_corners'
)
align_corners
=
op
.
attr
(
'align_corners'
)
...
@@ -196,11 +200,12 @@ class OpSet11(OpSet10):
...
@@ -196,11 +200,12 @@ class OpSet11(OpSet10):
if
align_corners
:
if
align_corners
:
coordinate_transformation_mode
=
'align_corners'
coordinate_transformation_mode
=
'align_corners'
else
:
else
:
coordinate_transformation_mode
=
'
asymmetric
'
coordinate_transformation_mode
=
'
half_pixel
'
roi_name
=
self
.
get_name
(
op
.
type
,
'roi'
)
roi_name
=
self
.
get_name
(
op
.
type
,
'roi'
)
roi_node
=
self
.
make_constant_node
(
roi_name
,
onnx_pb
.
TensorProto
.
FLOAT
,
roi_node
=
self
.
make_constant_node
(
roi_name
,
onnx_pb
.
TensorProto
.
FLOAT
,
[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
])
[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
])
if
'OutSize'
in
input_names
and
len
(
op
.
input
(
'OutSize'
))
>
0
:
if
'OutSize'
in
input_names
and
len
(
op
.
input
(
'OutSize'
))
>
0
:
print
(
'0000'
)
node
=
helper
.
make_node
(
node
=
helper
.
make_node
(
'Resize'
,
'Resize'
,
inputs
=
[
op
.
input
(
'X'
)[
0
],
roi_name
,
op
.
input
(
'OutSize'
)[
0
]],
inputs
=
[
op
.
input
(
'X'
)[
0
],
roi_name
,
op
.
input
(
'OutSize'
)[
0
]],
...
@@ -208,6 +213,7 @@ class OpSet11(OpSet10):
...
@@ -208,6 +213,7 @@ class OpSet11(OpSet10):
mode
=
'nearest'
,
mode
=
'nearest'
,
coordinate_transformation_mode
=
coordinate_transformation_mode
)
coordinate_transformation_mode
=
coordinate_transformation_mode
)
elif
'Scale'
in
input_names
and
len
(
op
.
input
(
'Scale'
))
>
0
:
elif
'Scale'
in
input_names
and
len
(
op
.
input
(
'Scale'
))
>
0
:
print
(
'1111'
)
node
=
helper
.
make_node
(
node
=
helper
.
make_node
(
'Resize'
,
'Resize'
,
inputs
=
[
op
.
input
(
'X'
)[
0
],
roi_name
,
op
.
input
(
'Scale'
)[
0
]],
inputs
=
[
op
.
input
(
'X'
)[
0
],
roi_name
,
op
.
input
(
'Scale'
)[
0
]],
...
@@ -215,6 +221,7 @@ class OpSet11(OpSet10):
...
@@ -215,6 +221,7 @@ class OpSet11(OpSet10):
mode
=
'nearest'
,
mode
=
'nearest'
,
coordinate_transformation_mode
=
coordinate_transformation_mode
)
coordinate_transformation_mode
=
coordinate_transformation_mode
)
else
:
else
:
print
(
'2222'
)
out_shape
=
[
op
.
attr
(
'out_h'
),
op
.
attr
(
'out_w'
)]
out_shape
=
[
op
.
attr
(
'out_h'
),
op
.
attr
(
'out_w'
)]
scale
=
op
.
attr
(
'scale'
)
scale
=
op
.
attr
(
'scale'
)
if
out_shape
.
count
(
-
1
)
>
0
:
if
out_shape
.
count
(
-
1
)
>
0
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录