MCPcopy Create free account
hub / github.com/apache/tvm-ffi / ImportModule

Method ImportModule

src/ffi/extra/module.cc:103–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103void ModuleObj::ImportModule(const Module& other) {
104 std::unordered_set<const ModuleObj*> visited{other.operator->()};
105 std::vector<const ModuleObj*> stack{other.operator->()};
106 while (!stack.empty()) {
107 const ModuleObj* n = stack.back();
108 stack.pop_back();
109 for (const Any& m : n->imports_) {
110 const ModuleObj* next = m.cast<const ModuleObj*>();
111 if (visited.count(next)) continue;
112 visited.insert(next);
113 stack.push_back(next);
114 }
115 }
116 if (visited.count(this)) {
117 TVM_FFI_THROW(RuntimeError) << "Cyclic dependency detected during import";
118 }
119 imports_.push_back(other);
120}
121
122void ModuleObj::ClearImports() { imports_.clear(); }
123

Callers

nothing calls this directly

Calls 7

operator->Method · 0.45
emptyMethod · 0.45
backMethod · 0.45
pop_backMethod · 0.45
countMethod · 0.45
insertMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected