Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
d3e786ef
MegEngine
项目概览
MegEngine 天元
/
MegEngine
1 年多 前同步成功
通知
403
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看板
提交
d3e786ef
编写于
8月 24, 2022
作者:
M
Megvii Engine Team
提交者:
“wenjuan”
8月 27, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(imperative): load_nerwork_and_run enable weight preprocess
GitOrigin-RevId: 0642b237a7595624f847d6c154802c853b092bd8
上级
c6ff878d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
4 deletion
+19
-4
imperative/python/megengine/tools/load_network_and_run.py
imperative/python/megengine/tools/load_network_and_run.py
+15
-4
imperative/python/src/graph_rt.cpp
imperative/python/src/graph_rt.cpp
+4
-0
未找到文件。
imperative/python/megengine/tools/load_network_and_run.py
浏览文件 @
d3e786ef
...
@@ -121,6 +121,9 @@ def run_model(args, graph, inputs, outputs, data):
...
@@ -121,6 +121,9 @@ def run_model(args, graph, inputs, outputs, data):
# must use level0 to avoid unintended opr modification
# must use level0 to avoid unintended opr modification
graph
.
options
.
graph_opt_level
=
0
graph
.
options
.
graph_opt_level
=
0
if
args
.
weight_preprocess
:
graph
.
enable_weight_preprocess
()
logger
.
info
(
"input tensors: "
)
logger
.
info
(
"input tensors: "
)
for
k
,
v
in
data
.
items
():
for
k
,
v
in
data
.
items
():
logger
.
info
(
" {}: {}"
.
format
(
k
,
v
.
shape
))
logger
.
info
(
" {}: {}"
.
format
(
k
,
v
.
shape
))
...
@@ -161,8 +164,8 @@ def run_model(args, graph, inputs, outputs, data):
...
@@ -161,8 +164,8 @@ def run_model(args, graph, inputs, outputs, data):
func
.
wait
()
func
.
wait
()
return
[
oup_node
.
get_value
().
numpy
()
for
oup_node
in
output_dict
.
values
()]
return
[
oup_node
.
get_value
().
numpy
()
for
oup_node
in
output_dict
.
values
()]
if
args
.
warm_up
:
for
i
in
range
(
args
.
warm_up
)
:
logger
.
info
(
"warming up
"
)
logger
.
info
(
"warming up
{}"
.
format
(
i
)
)
run
()
run
()
total_time
=
0
total_time
=
0
...
@@ -276,8 +279,9 @@ def main():
...
@@ -276,8 +279,9 @@ def main():
)
)
parser
.
add_argument
(
parser
.
add_argument
(
"--warm-up"
,
"--warm-up"
,
action
=
"store_true"
,
type
=
int
,
help
=
"warm up model before do timing "
" for better estimation"
,
default
=
0
,
help
=
"times of warm up model before do timing "
" for better estimation"
,
)
)
parser
.
add_argument
(
parser
.
add_argument
(
"--verbose"
,
"--verbose"
,
...
@@ -394,6 +398,13 @@ def main():
...
@@ -394,6 +398,13 @@ def main():
parser
.
add_argument
(
parser
.
add_argument
(
"--custom-op-lib"
,
type
=
str
,
help
=
"path of the custom op"
,
"--custom-op-lib"
,
type
=
str
,
help
=
"path of the custom op"
,
)
)
parser
.
add_argument
(
"--weight-preprocess"
,
action
=
"store_true"
,
help
=
"Execute operators with weight preprocess, which can"
"optimize the operator execution time with algo of winograd,"
"im2col ,etc.,but it may consume more memory."
,
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
...
...
imperative/python/src/graph_rt.cpp
浏览文件 @
d3e786ef
...
@@ -253,6 +253,10 @@ void init_graph_rt(py::module m) {
...
@@ -253,6 +253,10 @@ void init_graph_rt(py::module m) {
}
}
return
graph
.
compile
(
spec
);
return
graph
.
compile
(
spec
);
})
})
.
def
(
"enable_weight_preprocess"
,
[](
cg
::
ComputingGraph
&
graph
)
{
graph
.
options
().
graph_opt
.
enable_weight_preprocess
();
})
.
def_property_readonly
(
.
def_property_readonly
(
"options"
,
"options"
,
py
::
overload_cast
<>
(
&
cg
::
ComputingGraph
::
options
));
py
::
overload_cast
<>
(
&
cg
::
ComputingGraph
::
options
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录