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

Method add

src/core/impl/graph/helper.cpp:452–477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

450}
451
452void cg::DepOprIter::add(OperatorNodeBase* dest) {
453 if (!m_owner_graph) {
454 m_owner_graph = dest->owner_graph();
455 } else {
456 mgb_assert(
457 m_owner_graph == dest->owner_graph(),
458 "dest oprs belong to different graphs");
459 }
460 push_stack(dest);
461 while (!m_stack.empty()) {
462 auto&& frame = m_stack.back();
463 if (frame.inp_idx == frame.nr_input + frame.nr_extra_dep) {
464 m_cb(frame.opr);
465 m_stack.pop_back();
466 } else {
467 VarNode* inp = nullptr;
468 if (frame.inp_idx < frame.nr_input) {
469 inp = frame.inputs[frame.inp_idx++];
470 } else {
471 inp = frame.extra_deps[frame.inp_idx - frame.nr_input];
472 frame.inp_idx++;
473 }
474 push_stack(inp->owner_opr());
475 }
476 }
477}
478
479/* =================== InterGraphVarTransformer =================== */
480

Callers 14

to_jsonMethod · 0.45
update_out_specsMethod · 0.45
concat_and_prepareMethod · 0.45
ExecContextMethod · 0.45
to_jsonMethod · 0.45
helper.cppFile · 0.45
apply_actionMethod · 0.45

Calls 5

backMethod · 0.80
owner_graphMethod · 0.45
emptyMethod · 0.45
pop_backMethod · 0.45
owner_oprMethod · 0.45

Tested by

no test coverage detected