Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
b230e146
MegEngine
项目概览
MegEngine 天元
/
MegEngine
1 年多 前同步成功
通知
404
Star
4705
Fork
582
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MegEngine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
b230e146
编写于
5月 11, 2021
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(mge/dump): fix dump_with_testcase_mge Varnode type mismatch
GitOrigin-RevId: 05618e5ac5f8e3170698c2716f6ae2f5d11a7326
上级
9b69a02f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
21 addition
and
30 deletion
+21
-30
sdk/load-and-run/dump_with_testcase_mge.py
sdk/load-and-run/dump_with_testcase_mge.py
+21
-30
未找到文件。
sdk/load-and-run/dump_with_testcase_mge.py
浏览文件 @
b230e146
...
...
@@ -20,7 +20,6 @@ import megengine.core.tensor.megbrain_graph as G
from
megengine
import
tensor
from
megengine.core._imperative_rt.core2
import
apply
from
megengine.core.ops
import
builtin
from
megengine.core.tensor.megbrain_graph
import
VarNode
from
megengine.utils
import
comp_graph_tools
as
cgtools
logger
=
mge
.
get_logger
(
__name__
)
...
...
@@ -268,8 +267,8 @@ def make_feeds(args):
def
assert_equal
(
expect
,
real
,
**
kwargs
):
op
=
builtin
.
AssertEqual
(
**
kwargs
)
(
res
,)
=
G
.
apply_normal_varnode
(
op
,
expect
,
real
)
return
G
.
VarNode
(
res
)
(
res
,)
=
apply
(
op
,
expect
,
real
)
return
res
verbose
=
not
args
.
silent
...
...
@@ -284,8 +283,8 @@ def make_feeds(args):
# insert assert opr to check expect and real.
outputs_new
.
append
(
assert_equal
(
G
.
VarNode
(
expect_get
)
,
G
.
VarNode
(
i
)
,
expect_get
,
i
,
verbose
=
verbose
,
maxerr
=
args
.
maxerr
,
)
...
...
@@ -297,29 +296,26 @@ def make_feeds(args):
def
optimize_for_inference
(
args
,
outputs
):
args_
map
=
{
"enable_io16xc32"
:
"f16_io_f32_comp"
,
"enable_ioc16"
:
"f16_io_comp"
,
"enable_hwcd4"
:
"use_nhwcd4"
,
"enable_nchw4"
:
"use_nchw4"
,
"enable_nchw88"
:
"use_nchw88"
,
"enable_nchw44"
:
"use_nchw44"
,
"enable_nchw44_dot"
:
"use_nchw44_dot"
,
"enable_nchw32"
:
"use_nchw32"
,
"enable_chwn4"
:
"use_chwn4"
,
"enable_fuse_conv_bias_nonlinearity"
:
"fuse_conv_bias_nonlinearity"
,
"enable_fuse_conv_bias_with_z"
:
"fuse_conv_bias_with_z"
,
}
args_
list
=
[
"enable_io16xc32"
,
"enable_ioc16"
,
"enable_hwcd4"
,
"enable_nchw4"
,
"enable_nchw88"
,
"enable_nchw44"
,
"enable_nchw44_dot"
,
"enable_nchw32"
,
"enable_chwn4"
,
"enable_fuse_conv_bias_nonlinearity"
,
"enable_fuse_conv_bias_with_z"
,
]
kwargs
=
{}
for
k
,
v
in
args_map
.
items
()
:
for
k
in
args_list
:
if
getattr
(
args
,
k
):
assert
(
args
.
optimize_for_inference
),
"optimize_for_inference should be set when {} is given"
.
format
(
k
)
kwargs
[
v
]
=
True
kwargs
[
k
]
=
True
if
args
.
optimize_for_inference
:
outputs
=
[
i
.
_node
for
i
in
G
.
optimize_for_inference
(
outputs
,
**
kwargs
)]
outputs
=
G
.
optimize_for_inference
(
outputs
,
**
kwargs
)
return
outputs
...
...
@@ -476,7 +472,6 @@ def main():
output_mgbvars
=
feeds
[
"outputs"
]
output_mgbvars
=
optimize_for_inference
(
args
,
output_mgbvars
)
output_mgbvars
=
[
var
.
_node
for
var
in
output_mgbvars
]
inputs
=
cgtools
.
get_dep_vars
(
output_mgbvars
,
"Host2DeviceCopy"
)
inputs
=
sorted
((
i
.
name
,
i
.
dtype
)
for
i
in
inputs
)
...
...
@@ -491,12 +486,8 @@ def main():
with
open
(
args
.
output
,
"wb"
)
as
fout
:
fout
.
write
(
b
"mgbtest0"
)
fout
.
write
(
struct
.
pack
(
"I"
,
len
(
feeds
[
"testcases"
])))
if
isinstance
(
output_mgbvars
,
dict
):
wrap_output_vars
=
dict
([(
i
,
VarNode
(
j
))
for
i
,
j
in
output_mgbvars
])
else
:
wrap_output_vars
=
[
VarNode
(
i
)
for
i
in
output_mgbvars
]
dump_content
,
stat
=
G
.
dump_graph
(
wrap_output_
vars
,
output_mgb
vars
,
append_json
=
True
,
strip_info_file
=
strip_info_file
,
**
sereg_kwargs
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录