Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
a91d37bd
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看板
提交
a91d37bd
编写于
5月 13, 2022
作者:
W
wjj19950828
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed Flatten
上级
4eb7510d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
58 addition
and
12 deletion
+58
-12
x2paddle/op_mapper/onnx2paddle/opset9/opset.py
x2paddle/op_mapper/onnx2paddle/opset9/opset.py
+58
-12
未找到文件。
x2paddle/op_mapper/onnx2paddle/opset9/opset.py
浏览文件 @
a91d37bd
...
...
@@ -1627,20 +1627,66 @@ class OpSet9():
val_x
=
self
.
graph
.
get_input_node
(
node
,
idx
=
0
,
copy
=
True
)
output_shape
=
val_x
.
out_shapes
[
0
]
axis
=
node
.
get_attr
(
'axis'
,
1
)
shape_list
=
[
1
,
1
]
if
axis
==
0
:
for
s
in
output_shape
:
shape_list
[
1
]
*=
s
self
.
paddle_graph
.
add_layer
(
'paddle.reshape'
,
inputs
=
{
"x"
:
val_x
.
name
},
outputs
=
[
node
.
name
],
shape
=
[
1
,
-
1
])
else
:
for
s
in
output_shape
[:
axis
]:
shape_list
[
0
]
*=
s
for
s
in
output_shape
[
axis
:]:
shape_list
[
1
]
*=
s
self
.
paddle_graph
.
add_layer
(
'paddle.reshape'
,
inputs
=
{
"x"
:
val_x
.
name
},
outputs
=
[
node
.
name
],
shape
=
shape_list
)
if
len
(
output_shape
)
!=
0
:
shape_list
=
[
1
,
1
]
for
s
in
output_shape
[:
axis
]:
shape_list
[
0
]
*=
s
for
s
in
output_shape
[
axis
:]:
shape_list
[
1
]
*=
s
self
.
paddle_graph
.
add_layer
(
'paddle.reshape'
,
inputs
=
{
"x"
:
val_x
.
name
},
outputs
=
[
node
.
name
],
shape
=
shape_list
)
else
:
self
.
paddle_graph
.
add_layer
(
'paddle.shape'
,
inputs
=
{
"input"
:
val_x
.
name
},
outputs
=
[
val_x
.
name
+
"_shape"
])
self
.
paddle_graph
.
add_layer
(
"paddle.slice"
,
inputs
=
{
"input"
:
val_x
.
name
+
"_shape"
},
outputs
=
[
val_x
.
name
+
"_shape_first"
],
axes
=
[
0
],
starts
=
[
0
],
ends
=
[
axis
])
self
.
paddle_graph
.
add_layer
(
'paddle.prod'
,
inputs
=
{
"x"
:
val_x
.
name
+
"_shape_first"
},
outputs
=
[
val_x
.
name
+
"_shape_first"
])
self
.
paddle_graph
.
add_layer
(
"paddle.slice"
,
inputs
=
{
"input"
:
val_x
.
name
+
"_shape"
},
outputs
=
[
val_x
.
name
+
"_shape_second"
],
axes
=
[
0
],
starts
=
[
axis
],
ends
=
[
2147483647
])
self
.
paddle_graph
.
add_layer
(
'paddle.prod'
,
inputs
=
{
"x"
:
val_x
.
name
+
"_shape_second"
},
outputs
=
[
val_x
.
name
+
"_shape_second"
])
self
.
paddle_graph
.
add_layer
(
'paddle.concat'
,
inputs
=
{
"x"
:
[
val_x
.
name
+
"_shape_first"
,
val_x
.
name
+
"_shape_second"
]
},
outputs
=
[
val_x
.
name
+
"_all_shape"
],
axis
=
0
)
self
.
paddle_graph
.
add_layer
(
'paddle.reshape'
,
inputs
=
{
'x'
:
val_x
.
name
},
outputs
=
[
node
.
name
],
shape
=
val_x
.
name
+
"_all_shape"
)
@
print_mapping_info
def
Gemm
(
self
,
node
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录