Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
eeb538dc
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看板
未验证
提交
eeb538dc
编写于
11月 10, 2020
作者:
J
Jason
提交者:
GitHub
11月 10, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #430 from Channingss/fix_bug
fix bug of symbolic shape inference
上级
d55a2515
6f7fda45
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
8 addition
and
4 deletion
+8
-4
x2paddle/decoder/onnx_decoder.py
x2paddle/decoder/onnx_decoder.py
+5
-1
x2paddle/decoder/onnx_shape_inference.py
x2paddle/decoder/onnx_shape_inference.py
+3
-3
未找到文件。
x2paddle/decoder/onnx_decoder.py
浏览文件 @
eeb538dc
...
@@ -18,7 +18,7 @@ from x2paddle.decoder.onnx_shape_inference import SymbolicShapeInference
...
@@ -18,7 +18,7 @@ from x2paddle.decoder.onnx_shape_inference import SymbolicShapeInference
from
onnx.checker
import
ValidationError
from
onnx.checker
import
ValidationError
from
onnx.checker
import
check_model
from
onnx.checker
import
check_model
from
onnx.utils
import
polish_model
from
onnx.utils
import
polish_model
from
onnx
import
helper
from
onnx
import
helper
,
shape_inference
from
onnx.helper
import
get_attribute_value
,
make_attribute
from
onnx.helper
import
get_attribute_value
,
make_attribute
from
onnx.shape_inference
import
infer_shapes
from
onnx.shape_inference
import
infer_shapes
from
onnx.mapping
import
TENSOR_TYPE_TO_NP_TYPE
from
onnx.mapping
import
TENSOR_TYPE_TO_NP_TYPE
...
@@ -141,6 +141,10 @@ class ONNXGraph(Graph):
...
@@ -141,6 +141,10 @@ class ONNXGraph(Graph):
print
(
"shape inferencing ..."
)
print
(
"shape inferencing ..."
)
self
.
graph
=
SymbolicShapeInference
.
infer_shapes
(
self
.
graph
=
SymbolicShapeInference
.
infer_shapes
(
onnx_model
,
fixed_input_shape
=
self
.
fixed_input_shape
)
onnx_model
,
fixed_input_shape
=
self
.
fixed_input_shape
)
if
self
.
graph
is
None
:
print
(
'[WARNING] Shape inference by ONNX offical interface.'
)
onnx_model
=
shape_inference
.
infer_shapes
(
onnx_model
)
self
.
graph
=
onnx_model
.
graph
print
(
"shape inferenced."
)
print
(
"shape inferenced."
)
self
.
build
()
self
.
build
()
self
.
collect_value_infos
()
self
.
collect_value_infos
()
...
...
x2paddle/decoder/onnx_shape_inference.py
浏览文件 @
eeb538dc
...
@@ -1588,7 +1588,7 @@ class SymbolicShapeInference:
...
@@ -1588,7 +1588,7 @@ class SymbolicShapeInference:
assert
version
.
parse
(
onnx
.
__version__
)
>=
version
.
parse
(
"1.5.0"
)
assert
version
.
parse
(
onnx
.
__version__
)
>=
version
.
parse
(
"1.5.0"
)
onnx_opset
=
get_opset
(
in_mp
)
onnx_opset
=
get_opset
(
in_mp
)
if
not
onnx_opset
or
onnx_opset
<
7
:
if
not
onnx_opset
or
onnx_opset
<
7
:
print
(
'
O
nly support models of onnx opset 7 and above.'
)
print
(
'
[WARNING] Symbolic shape inference o
nly support models of onnx opset 7 and above.'
)
return
return
symbolic_shape_inference
=
SymbolicShapeInference
(
symbolic_shape_inference
=
SymbolicShapeInference
(
int_max
,
auto_merge
,
guess_output_rank
,
verbose
)
int_max
,
auto_merge
,
guess_output_rank
,
verbose
)
...
@@ -1601,11 +1601,11 @@ class SymbolicShapeInference:
...
@@ -1601,11 +1601,11 @@ class SymbolicShapeInference:
in_mp
)
in_mp
)
symbolic_shape_inference
.
_update_output_from_vi
()
symbolic_shape_inference
.
_update_output_from_vi
()
if
not
all_shapes_inferred
:
if
not
all_shapes_inferred
:
print
(
'!'
*
10
)
symbolic_shape_inference
.
out_mp_
=
shape_inference
.
infer_shapes
(
symbolic_shape_inference
.
out_mp_
=
shape_inference
.
infer_shapes
(
symbolic_shape_inference
.
out_mp_
)
symbolic_shape_inference
.
out_mp_
)
print
(
'[INFO] Complete symbolic shape inference.'
)
except
:
except
:
print
(
'
Stopping at incomplete symbolic shape inference
'
)
print
(
'
[WARNING] Incomplete symbolic shape inference.
'
)
symbolic_shape_inference
.
out_mp_
=
shape_inference
.
infer_shapes
(
symbolic_shape_inference
.
out_mp_
=
shape_inference
.
infer_shapes
(
symbolic_shape_inference
.
out_mp_
)
symbolic_shape_inference
.
out_mp_
)
return
symbolic_shape_inference
.
out_mp_
.
graph
return
symbolic_shape_inference
.
out_mp_
.
graph
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录