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

Method onForward

express/module/IfModule.cpp:22–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20 return -1;
21}
22std::vector<Express::VARP> IfModule::onForward(const std::vector<Express::VARP>& inputs) {
23 std::vector<Express::VARP> outputs(mOutputFromElse.size());
24 MNN_ASSERT(mOutputFromThen.size() == mOutputFromElse.size());
25
26
27 if (inputs[0]->readMap<int>()[0] > 0) {
28 std::vector<Express::VARP> subInputs(mInputForThen.size());
29 for (auto& p : mInputForThen) {
30 subInputs[p.first] = inputs[p.second];
31 }
32 auto subOutputs = mThen->onForward(subInputs);
33 for (int i=0; i<mOutputFromThen.size(); ++i) {
34 outputs[i] = subOutputs[mOutputFromThen[i]];
35 }
36 } else {
37 std::vector<Express::VARP> subInputs(mInputForElse.size());
38 for (auto& p : mInputForElse) {
39 subInputs[p.first] = inputs[p.second];
40 }
41 auto subOutputs = mElse->onForward(subInputs);
42 for (int i=0; i<mOutputFromElse.size(); ++i) {
43 outputs[i] = subOutputs[mOutputFromElse[i]];
44 }
45 }
46 return outputs;
47}
48IfModule* IfModule::create(const Op* op, const std::map<std::string, SubGraph>& subGraph) {
49 auto module = new IfModule;
50 module->setType("IfModule");

Callers 15

predictDurationMethod · 0.45
encodeTextMethod · 0.45
estimateVectorMethod · 0.45
vocodeMethod · 0.45
ProcessMethod · 0.45
ProcessMethod · 0.45
ProcessMethod · 0.45
ProcessMethod · 0.45
ScoreTokenMethod · 0.45
ForwardMethod · 0.45
RunEncoderMethod · 0.45
RunDecoderMethod · 0.45

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected