MCPcopy Create free account
hub / github.com/alibaba/MNN / clone

Method clone

express/module/StaticModule.cpp:676–689  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

674}
675
676Module* StaticModule::clone(CloneContext* ctx) const {
677 StaticModule* module(new StaticModule);
678 module->mResource = mResource;
679 module->mRuntimeManager = ctx->pRuntimeManager;
680 if (mResource->mOutputFromTensor.empty()) {
681 return this->cloneBaseTo(ctx, module);
682 }
683 // mSession->clone may construct new Backends.
684 ctx->pRuntimeManager->applyMetaToRuntime();
685 auto rt = ctx->pRuntimeManager->getInside()->mRuntime;
686 module->mSession.reset(mSession->clone(std::move(rt), mResource->mSharedConst));
687 module->resetInputOutputs();
688 return this->cloneBaseTo(ctx, module);
689}
690int StaticModule::onOptimize(Interpreter::SessionMode stage) {
691 int res = 0;
692 switch (stage) {

Callers

nothing calls this directly

Calls 5

cloneBaseToMethod · 0.80
applyMetaToRuntimeMethod · 0.80
resetInputOutputsMethod · 0.80
emptyMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected