Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
8676a37b
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看板
提交
8676a37b
编写于
1月 14, 2021
作者:
C
Channingss
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove useless code
上级
ed6400e1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
0 addition
and
15 deletion
+0
-15
x2paddle/op_mapper/dygraph/onnx2paddle/opset9/opset.py
x2paddle/op_mapper/dygraph/onnx2paddle/opset9/opset.py
+0
-15
未找到文件。
x2paddle/op_mapper/dygraph/onnx2paddle/opset9/opset.py
浏览文件 @
8676a37b
...
@@ -274,14 +274,12 @@ class OpSet9():
...
@@ -274,14 +274,12 @@ class OpSet9():
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.
# inputs['scale_factor'] = val_scales.name
attrs
[
'scale_factor'
]
=
self
.
weights
[
val_scales
.
name
].
tolist
()[
2
:]
attrs
[
'scale_factor'
]
=
self
.
weights
[
val_scales
.
name
].
tolist
()[
2
:]
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
)
# 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.
# inputs['scale_factor'] = val_scales.name
attrs
[
'scale_factor'
]
=
self
.
weights
[
val_scales
.
name
].
tolist
()[
2
:]
attrs
[
'scale_factor'
]
=
self
.
weights
[
val_scales
.
name
].
tolist
()[
2
:]
elif
len
(
node
.
layer
.
input
)
==
4
:
elif
len
(
node
.
layer
.
input
)
==
4
:
# opset 11
# opset 11
...
@@ -934,10 +932,6 @@ class OpSet9():
...
@@ -934,10 +932,6 @@ class OpSet9():
if
starts_value
is
not
None
and
ends_value
is
not
None
and
axes
is
not
None
:
if
starts_value
is
not
None
and
ends_value
is
not
None
and
axes
is
not
None
:
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)):
# if ends_value[idx] > 2**31 - 1:
# ends_value[idx] = 2**31 - 1
#print(val_x.out_shapes)
for
idx
in
range
(
len
(
ends_value
)):
for
idx
in
range
(
len
(
ends_value
)):
if
starts_value
[
idx
]
>=
val_x
.
out_shapes
[
0
][
axes
[
idx
]]:
if
starts_value
[
idx
]
>=
val_x
.
out_shapes
[
0
][
axes
[
idx
]]:
starts_value
[
idx
]
=
val_x
.
out_shapes
[
0
][
axes
[
idx
]]
-
1
starts_value
[
idx
]
=
val_x
.
out_shapes
[
0
][
axes
[
idx
]]
-
1
...
@@ -1337,11 +1331,6 @@ class OpSet9():
...
@@ -1337,11 +1331,6 @@ class OpSet9():
_rename_or_remove_weight
(
self
.
weights
,
val_var
.
name
,
op_name
+
'._variance'
)
_rename_or_remove_weight
(
self
.
weights
,
val_var
.
name
,
op_name
+
'._variance'
)
_rename_or_remove_weight
(
self
.
weights
,
val_mean
.
name
,
op_name
+
'._mean'
)
_rename_or_remove_weight
(
self
.
weights
,
val_mean
.
name
,
op_name
+
'._mean'
)
#self.weights[op_name + '.weight'] = self.weights[val_scale.name]
#self.weights[op_name + '.bias'] = self.weights[val_b.name]
#self.weights[op_name + '._variance'] = self.weights[val_var.name]
#self.weights[op_name + '._mean'] = self.weights[val_mean.name]
# Attribute: spatial is used in BatchNormalization-1,6,7
# Attribute: spatial is used in BatchNormalization-1,6,7
spatial
=
bool
(
node
.
get_attr
(
'spatial'
))
spatial
=
bool
(
node
.
get_attr
(
'spatial'
))
layer_attrs
=
{
layer_attrs
=
{
...
@@ -1706,13 +1695,11 @@ class OpSet9():
...
@@ -1706,13 +1695,11 @@ class OpSet9():
remove_weight
=
True
if
val_w
.
name
in
self
.
done_weight_list
else
False
remove_weight
=
True
if
val_w
.
name
in
self
.
done_weight_list
else
False
if
remove_weight
:
if
remove_weight
:
self
.
done_weight_list
.
append
(
val_w
.
name
)
self
.
done_weight_list
.
append
(
val_w
.
name
)
#self.weights[op_name + '.weight'] = self.weights[val_w.name]
_rename_or_remove_weight
(
self
.
weights
,
val_w
.
name
,
op_name
+
'.weight'
,
remove_weight
)
_rename_or_remove_weight
(
self
.
weights
,
val_w
.
name
,
op_name
+
'.weight'
,
remove_weight
)
if
has_bias
:
if
has_bias
:
remove_bias
=
True
if
val_b
.
name
in
self
.
done_weight_list
else
False
remove_bias
=
True
if
val_b
.
name
in
self
.
done_weight_list
else
False
if
remove_bias
:
if
remove_bias
:
self
.
done_weight_list
.
append
(
val_b_name
)
self
.
done_weight_list
.
append
(
val_b_name
)
#self.weights[op_name + '.bias'] = self.weights[val_b.name]
_rename_or_remove_weight
(
self
.
weights
,
val_b
.
name
,
op_name
+
'.bias'
,
remove_bias
)
_rename_or_remove_weight
(
self
.
weights
,
val_b
.
name
,
op_name
+
'.bias'
,
remove_bias
)
else
:
else
:
layer_attrs
[
"bias_attr"
]
=
False
layer_attrs
[
"bias_attr"
]
=
False
...
@@ -1781,10 +1768,8 @@ class OpSet9():
...
@@ -1781,10 +1768,8 @@ class OpSet9():
"groups"
:
num_groups
,
"groups"
:
num_groups
,
"output_padding"
:
out_padding
}
"output_padding"
:
out_padding
}
#self.weights[op_name + '.weight'] = self.weights[val_w.name]
_rename_or_remove_weight
(
self
.
weights
,
val_w
.
name
,
op_name
+
'.weight'
,)
_rename_or_remove_weight
(
self
.
weights
,
val_w
.
name
,
op_name
+
'.weight'
,)
if
val_b
is
not
None
:
if
val_b
is
not
None
:
#self.weights[op_name + '.bias'] = self.weights[val_b.name]
_rename_or_remove_weight
(
self
.
weights
,
val_b
.
name
,
op_name
+
'.bias'
)
_rename_or_remove_weight
(
self
.
weights
,
val_b
.
name
,
op_name
+
'.bias'
)
self
.
paddle_graph
.
add_layer
(
self
.
paddle_graph
.
add_layer
(
kernel
=
paddle_op
,
kernel
=
paddle_op
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录