Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
c7ded2fe
MegEngine
项目概览
MegEngine 天元
/
MegEngine
12 个月 前同步成功
通知
393
Star
4704
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c7ded2fe
编写于
2月 17, 2022
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(imperative): remove unnecessary reverve in small vector
GitOrigin-RevId: 85c30bc828a65bc6e626ced97095ee3c68a50c31
上级
8c2b916e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
0 addition
and
18 deletion
+0
-18
imperative/src/impl/interpreter/interpreter_impl.cpp
imperative/src/impl/interpreter/interpreter_impl.cpp
+0
-9
imperative/src/impl/ops/tensor_manip.cpp
imperative/src/impl/ops/tensor_manip.cpp
+0
-1
imperative/src/impl/proxy_graph.cpp
imperative/src/impl/proxy_graph.cpp
+0
-3
imperative/src/impl/proxy_graph/mini_graph.h
imperative/src/impl/proxy_graph/mini_graph.h
+0
-5
未找到文件。
imperative/src/impl/interpreter/interpreter_impl.cpp
浏览文件 @
c7ded2fe
...
...
@@ -238,7 +238,6 @@ void ChannelImpl::dispatch_default_cpu(
MGB_RECORD_EVENT
(
ShapeInferEvent
,
validated
);
SmallVector
<
DeviceTensorND
>
input_tensornds
;
input_tensornds
.
reserve
(
input_descs
.
size
());
CompNode
output_cn
;
{
MGB_LOCK_GUARD
(
m_mutex
);
...
...
@@ -261,9 +260,7 @@ void ChannelImpl::dispatch_default_cpu(
}
}
outputs
->
reserve
(
output_descs
.
size
());
SmallVector
<
DeviceTensorND
>
output_tensornds
;
output_tensornds
.
reserve
(
output_descs
.
size
());
for
(
auto
&&
desc
:
output_descs
)
{
// TODO: may conflict with condtake, which need alloc inside
mgb_assert
(
!
desc
.
layout
.
is_empty
());
...
...
@@ -290,7 +287,6 @@ void ChannelImpl::dispatch_default_cpu(
}
SmallVector
<
TensorInfo
*>
output_infos
;
output_infos
.
reserve
(
output_descs
.
size
());
for
(
auto
&&
tensornd
:
output_tensornds
)
{
HostTensorND
host_tensornd
=
HostTensorND
::
make_proxy
(
tensornd
).
proxy_to_comp_node
(
output_cn
);
...
...
@@ -329,9 +325,6 @@ void ChannelImpl::dispatch_kernel(
ApplyOp
cmd
{
Profiler
::
next_id
(),
std
::
move
(
op
)};
cmd
.
inputs
=
std
::
move
(
input_infos
);
cmd
.
outputs
.
reserve
(
output_descs
.
size
());
outputs
->
reserve
(
output_descs
.
size
());
for
(
int
i
=
0
;
i
<
output_descs
.
size
();
++
i
)
{
auto
&&
desc
=
output_descs
[
i
];
auto
info
=
alloc
();
...
...
@@ -399,9 +392,7 @@ SmallVector<Handle> ChannelImpl::apply_op_impl(
i
);
}
SmallVector
<
TensorInfo
*>
input_infos
;
input_infos
.
reserve
(
inputs
.
size
());
SmallVector
<
LogicalTensorDesc
>
input_descs
;
input_descs
.
reserve
(
inputs
.
size
());
{
MGB_LOCK_GUARD
(
m_mutex
);
for
(
auto
i
:
inputs
)
{
...
...
imperative/src/impl/ops/tensor_manip.cpp
浏览文件 @
c7ded2fe
...
...
@@ -87,7 +87,6 @@ void apply_on_device_tensornd(
HostTensorND
get_var_shape_host_tensor
(
const
OpDef
&
def
,
const
SmallVector
<
TensorPtr
>&
inputs
)
{
SmallVector
<
DeviceTensorND
>
input_tensornds
;
input_tensornds
.
reserve
(
inputs
.
size
());
for
(
auto
&&
inp
:
inputs
)
{
input_tensornds
.
push_back
(
inp
->
dev_tensor
());
}
...
...
imperative/src/impl/proxy_graph.cpp
浏览文件 @
c7ded2fe
...
...
@@ -232,7 +232,6 @@ public:
// fill args for infer_func
cg
::
static_infer
::
InpVal
args
{
1
};
args
.
val
.
reserve
(
desc
->
deps
.
size
());
auto
push_shape
=
[
&
args
](
const
TensorShape
*
shape
)
{
args
.
val
.
emplace_back
();
args
.
val
.
back
().
m_shape
=
shape
;
...
...
@@ -607,8 +606,6 @@ EncodedSubgraph ProxyGraph::make_backward_graph(
}
// set backward graph inputs
igraph
.
inputs
.
reserve
(
nr_backward_graph_inputs
);
result
.
input_mask
.
reserve
(
nr_backward_graph_inputs
);
auto
write_inputs
=
[
&
igraph
,
&
var2idx
,
&
result
](
const
VarNodeArray
&
vars
)
{
for
(
auto
&&
i
:
vars
)
{
auto
&&
iter
=
var2idx
.
find
(
i
);
...
...
imperative/src/impl/proxy_graph/mini_graph.h
浏览文件 @
c7ded2fe
...
...
@@ -132,7 +132,6 @@ protected:
mgb_assert
(
!
infer_func
);
infer_func
=
func
;
inp_val
.
val
.
resize
(
dep_val
.
size
());
deps
.
reserve
(
dep_val
.
size
());
for
(
auto
&&
dep
:
dep_val
)
{
auto
[
found
,
i
]
=
find_index
(
opr
->
input
(),
dep
.
dest
);
...
...
@@ -253,7 +252,6 @@ public:
// fix permuted input: the order of m_opr->input() and vinputs may be
// different, input_remap keeps the index map of m_opr->input() and vinputs
input_remap
.
reserve
(
m_opr
->
input
().
size
());
for
(
auto
*
v
:
m_opr
->
input
())
{
auto
[
found
,
i
]
=
find_index
(
vinputs
,
v
);
mgb_assert
(
found
);
...
...
@@ -272,7 +270,6 @@ public:
}
// fix permuted output
output_remap
.
reserve
(
ovars
.
size
());
for
(
auto
*
v
:
ovars
)
{
auto
[
found
,
i
]
=
find_index
(
m_opr
->
output
(),
v
);
mgb_assert
(
found
);
...
...
@@ -784,7 +781,6 @@ public:
auto
sess
=
minigraph
.
infer_session
(
inputs
);
std
::
tuple
<
SmallVector
<
LogicalTensorDesc
>
,
bool
>
ret
;
auto
&
[
descs
,
noerr
]
=
ret
;
descs
.
reserve
(
minigraph
.
output_size
());
for
(
size_t
i
=
0
;
i
<
minigraph
.
output_size
();
++
i
)
{
descs
.
emplace_back
();
auto
&
desc
=
descs
.
back
();
...
...
@@ -819,7 +815,6 @@ public:
mgb_assert
(
shape
);
minigraph
.
opr
()
->
output
()[
i
]
->
shape
(
*
shape
);
}
descs
.
reserve
(
minigraph
.
output_size
());
for
(
size_t
i
=
0
;
i
<
minigraph
.
output_size
();
++
i
)
{
auto
*
ovar
=
minigraph
.
output_var
(
i
);
mgb_assert
(
ovar
->
dtype
().
valid
()
&&
ovar
->
comp_node
().
valid
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录