MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / init_seq

Method init_seq

imperative/src/impl/profiler_plugin.cpp:165–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165void ProfilerPlugin::init_seq(cg::AsyncExecutable* comp_seq) {
166 mgb_assert(m_opr_dict.empty());
167 mgb_assert(m_var_dict.empty());
168 comp_seq->iter_opr_seq([this](cg::OperatorNodeBase* opr) {
169 auto comp_nodes = get_opr_comp_node_set(opr);
170 mgb_assert(comp_nodes.size() == 1);
171 register_opr(opr);
172 for (auto&& input : opr->input()) {
173 if (m_var_dict.count(input) == 0) {
174 register_var(input).is_const = true;
175 } else {
176 get_var_info(input).ref_cnt++;
177 }
178 }
179 for (auto&& output : opr->output()) {
180 register_var(output).is_const = false;
181 }
182 // TODO: check ref_cnt
183 return true;
184 });
185}
186
187ProfilerPlugin::OprInfo& ProfilerPlugin::register_opr(cg::OperatorNodeBase* opr) {
188 OprInfo info;

Callers

nothing calls this directly

Calls 5

emptyMethod · 0.45
sizeMethod · 0.45
inputMethod · 0.45
countMethod · 0.45
outputMethod · 0.45

Tested by

no test coverage detected