Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
6bbecdc4
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看板
提交
6bbecdc4
编写于
6月 06, 2022
作者:
W
wjj19950828
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'upstream/develop' into rm_fluid
上级
6eca1a44
ea254a8d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
3 deletion
+20
-3
x2paddle/op_mapper/onnx2paddle/opset9/opset.py
x2paddle/op_mapper/onnx2paddle/opset9/opset.py
+20
-3
未找到文件。
x2paddle/op_mapper/onnx2paddle/opset9/opset.py
浏览文件 @
6bbecdc4
...
@@ -1097,6 +1097,12 @@ class OpSet9():
...
@@ -1097,6 +1097,12 @@ 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
)
starts
,
ends
,
axes
,
steps
=
None
,
None
,
None
,
None
starts
,
ends
,
axes
,
steps
=
None
,
None
,
None
,
None
layer_attrs
=
{}
layer_attrs
=
{}
if
val_x
.
dtype
==
'uint8'
:
self
.
paddle_graph
.
add_layer
(
'paddle.cast'
,
inputs
=
{
"x"
:
val_x
.
name
},
outputs
=
[
val_x
.
name
],
dtype
=
string
(
'int32'
))
if
len
(
node
.
inputs
)
>
1
:
if
len
(
node
.
inputs
)
>
1
:
starts
=
self
.
graph
.
get_input_node
(
node
,
idx
=
1
,
copy
=
True
)
starts
=
self
.
graph
.
get_input_node
(
node
,
idx
=
1
,
copy
=
True
)
ends
=
self
.
graph
.
get_input_node
(
node
,
idx
=
2
,
copy
=
True
)
ends
=
self
.
graph
.
get_input_node
(
node
,
idx
=
2
,
copy
=
True
)
...
@@ -1125,8 +1131,9 @@ class OpSet9():
...
@@ -1125,8 +1131,9 @@ class OpSet9():
starts_value
=
starts_value
.
copy
()
starts_value
=
starts_value
.
copy
()
ends_value
=
ends_value
.
copy
()
ends_value
=
ends_value
.
copy
()
for
idx
in
range
(
len
(
ends_value
)):
for
idx
in
range
(
len
(
ends_value
)):
if
starts_value
[
idx
]
>=
val_x
.
out_shapes
[
0
][
axes
[
if
len
(
val_x
.
out_shapes
[
0
])
!=
0
and
starts_value
[
idx
]]
and
val_x
.
out_shapes
[
0
][
axes
[
idx
]]
>
0
:
idx
]
>=
val_x
.
out_shapes
[
0
][
axes
[
idx
]]
and
val_x
.
out_shapes
[
0
][
axes
[
idx
]]
>
0
:
starts_value
[
idx
]
=
val_x
.
out_shapes
[
0
][
axes
[
idx
]]
-
1
starts_value
[
idx
]
=
val_x
.
out_shapes
[
0
][
axes
[
idx
]]
-
1
ends_value
[
idx
]
=
val_x
.
out_shapes
[
0
][
axes
[
idx
]]
ends_value
[
idx
]
=
val_x
.
out_shapes
[
0
][
axes
[
idx
]]
elif
ends_value
[
idx
]
>
2
**
31
-
1
:
elif
ends_value
[
idx
]
>
2
**
31
-
1
:
...
@@ -1182,6 +1189,12 @@ class OpSet9():
...
@@ -1182,6 +1189,12 @@ class OpSet9():
inputs
=
{
"input"
:
val_x
.
name
},
inputs
=
{
"input"
:
val_x
.
name
},
outputs
=
[
node
.
name
],
outputs
=
[
node
.
name
],
**
layer_attrs
)
**
layer_attrs
)
if
val_x
.
dtype
==
'uint8'
:
self
.
paddle_graph
.
add_layer
(
'paddle.cast'
,
inputs
=
{
"x"
:
node
.
name
},
outputs
=
[
node
.
name
],
dtype
=
string
(
'uint8'
))
@
print_mapping_info
@
print_mapping_info
def
ConstantOfShape
(
self
,
node
):
def
ConstantOfShape
(
self
,
node
):
...
@@ -1812,7 +1825,11 @@ class OpSet9():
...
@@ -1812,7 +1825,11 @@ class OpSet9():
def
Squeeze
(
self
,
node
):
def
Squeeze
(
self
,
node
):
val_x
=
self
.
graph
.
get_input_node
(
node
,
idx
=
0
,
copy
=
True
)
val_x
=
self
.
graph
.
get_input_node
(
node
,
idx
=
0
,
copy
=
True
)
axes
=
node
.
get_attr
(
'axes'
)
axes
=
node
.
get_attr
(
'axes'
)
if
len
(
val_x
.
out_shapes
[
0
])
==
1
:
if
axes
is
None
:
axes_node
=
self
.
graph
.
get_input_node
(
node
,
idx
=
1
,
copy
=
True
)
axes
=
_const_weight_or_none
(
axes_node
,
necessary
=
True
)
# deal with scalar(0D) tensor
if
len
(
val_x
.
out_shapes
[
0
])
<=
1
and
len
(
axes
)
==
1
and
axes
[
0
]
==
0
:
self
.
paddle_graph
.
add_layer
(
self
.
paddle_graph
.
add_layer
(
"paddle.cast"
,
"paddle.cast"
,
inputs
=
{
"x"
:
val_x
.
name
},
inputs
=
{
"x"
:
val_x
.
name
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录