Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
e164cf67
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e164cf67
编写于
7月 02, 2020
作者:
C
Channingss
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug
上级
fc5c67c4
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
17 addition
and
12 deletion
+17
-12
x2paddle/op_mapper/paddle_op_mapper.py
x2paddle/op_mapper/paddle_op_mapper.py
+17
-12
未找到文件。
x2paddle/op_mapper/paddle_op_mapper.py
浏览文件 @
e164cf67
...
@@ -556,14 +556,6 @@ class PaddleOpMapper(object):
...
@@ -556,14 +556,6 @@ class PaddleOpMapper(object):
'SizeTensor'
in
input_names
and
'SizeTensor'
in
input_names
and
len
(
op
.
input
(
'SizeTensor'
))
>
0
):
len
(
op
.
input
(
'SizeTensor'
))
>
0
):
node_list
=
list
()
node_list
=
list
()
empty_name
=
self
.
get_name
(
op
.
type
,
'empty'
)
empty_tensor
=
helper
.
make_tensor
(
empty_name
,
onnx_pb
.
TensorProto
.
FLOAT
,
(
0
,
),
np
.
array
([]).
astype
(
'float32'
),
raw
=
False
)
empty_node
=
helper
.
make_node
(
'Constant'
,
[],
outputs
=
[
empty_name
],
value
=
empty_tensor
)
shape_name0
=
self
.
get_name
(
op
.
type
,
'shape'
)
shape_name0
=
self
.
get_name
(
op
.
type
,
'shape'
)
shape_node0
=
helper
.
make_node
(
shape_node0
=
helper
.
make_node
(
'Shape'
,
inputs
=
op
.
input
(
'X'
),
outputs
=
[
shape_name0
])
'Shape'
,
inputs
=
op
.
input
(
'X'
),
outputs
=
[
shape_name0
])
...
@@ -578,8 +570,7 @@ class PaddleOpMapper(object):
...
@@ -578,8 +570,7 @@ class PaddleOpMapper(object):
'Slice'
,
'Slice'
,
inputs
=
[
shape_name0
,
starts_name
,
ends_name
],
inputs
=
[
shape_name0
,
starts_name
,
ends_name
],
outputs
=
[
shape_name1
])
outputs
=
[
shape_name1
])
node_list
.
extend
(
node_list
.
extend
([
shape_node0
,
starts_node
,
ends_node
,
shape_node1
])
[
empty_node
,
shape_node0
,
starts_node
,
ends_node
,
shape_node1
])
if
'OutSize'
in
input_names
and
len
(
op
.
input
(
'OutSize'
))
>
0
:
if
'OutSize'
in
input_names
and
len
(
op
.
input
(
'OutSize'
))
>
0
:
cast_shape_name
=
self
.
get_name
(
op
.
type
,
"shape.cast"
)
cast_shape_name
=
self
.
get_name
(
op
.
type
,
"shape.cast"
)
cast_shape_node
=
helper
.
make_node
(
cast_shape_node
=
helper
.
make_node
(
...
@@ -617,7 +608,7 @@ class PaddleOpMapper(object):
...
@@ -617,7 +608,7 @@ class PaddleOpMapper(object):
outputs
=
[
name_h_w
],
outputs
=
[
name_h_w
],
value
=
helper
.
make_tensor
(
value
=
helper
.
make_tensor
(
name
=
name_h_w
,
name
=
name_h_w
,
data_type
=
onnx_pb
.
TensorProto
.
FLOAT
,
data_type
=
onnx_pb
.
TensorProto
.
INT64
,
dims
=
[
2
],
dims
=
[
2
],
vals
=
[
height
,
width
],
vals
=
[
height
,
width
],
raw
=
False
))
raw
=
False
))
...
@@ -629,10 +620,24 @@ class PaddleOpMapper(object):
...
@@ -629,10 +620,24 @@ class PaddleOpMapper(object):
outputs
=
[
shape_name4
],
outputs
=
[
shape_name4
],
axis
=
0
)
axis
=
0
)
node_list
.
append
(
shape_node4
)
node_list
.
append
(
shape_node4
)
cast_shape_name3
=
self
.
get_name
(
op
.
type
,
"shape.cast"
)
cast_shape_node3
=
helper
.
make_node
(
'Cast'
,
inputs
=
[
shape_name3
],
outputs
=
[
cast_shape_name3
],
to
=
onnx_pb
.
TensorProto
.
FLOAT
)
node_list
.
append
(
cast_shape_node3
)
cast_shape_name4
=
self
.
get_name
(
op
.
type
,
"shape.cast"
)
cast_shape_node4
=
helper
.
make_node
(
'Cast'
,
inputs
=
[
shape_name4
],
outputs
=
[
cast_shape_name4
],
to
=
onnx_pb
.
TensorProto
.
FLOAT
)
node_list
.
append
(
cast_shape_node4
)
outputs_h_w_scales
=
op
.
output
(
'Out'
)[
0
]
+
"@out_hw_scales"
outputs_h_w_scales
=
op
.
output
(
'Out'
)[
0
]
+
"@out_hw_scales"
node_h_w_scales
=
helper
.
make_node
(
node_h_w_scales
=
helper
.
make_node
(
'Div'
,
'Div'
,
inputs
=
[
shape_name3
,
shape_name4
],
inputs
=
[
cast_shape_name3
,
cast_
shape_name4
],
outputs
=
[
outputs_h_w_scales
])
outputs
=
[
outputs_h_w_scales
])
node_list
.
append
(
node_h_w_scales
)
node_list
.
append
(
node_h_w_scales
)
result_node
=
helper
.
make_node
(
result_node
=
helper
.
make_node
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录