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

Function _zeroInputs

tools/cpp/backendTest.cpp:89–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87using namespace MNN;
88
89static void _zeroInputs(const Interpreter* net, const Session* session) {
90 // Set Other Inputs to Zero
91 auto allInput = net->getSessionInputAll(session);
92 for (auto& iter : allInput) {
93 auto inputTensor = iter.second;
94 auto size = inputTensor->size();
95 if (size <= 0) {
96 continue;
97 }
98 MNN::Tensor tempTensor(inputTensor, inputTensor->getDimensionType());
99 ::memset(tempTensor.host<void>(), 0, tempTensor.size());
100 inputTensor->copyFromHostTensor(&tempTensor);
101 }
102}
103static void compareForwadType(OUTPUTCONFIG outputNames, Interpreter* net, MNNForwardType expectType, MNNForwardType compareType, float tolerance,
104 const std::map<std::string, std::shared_ptr<Tensor>>& inputs, const std::string& stopOp, BackendConfig::PrecisionMode precision, int modeNum) {
105 auto inputNames = _getAllInputs(MNN::GetNet(net->getModelBuffer().first));

Callers 1

compareForwadTypeFunction · 0.85

Calls 3

getDimensionTypeMethod · 0.80
copyFromHostTensorMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected