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

Function _createModel

test/expr/RasterOutputTest.cpp:18–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16using namespace MNN;
17
18static std::shared_ptr<Module> _createModel() {
19 auto x = _Input({1, 3, 224, 224}, NCHW, halide_type_of<int>());
20 x->setName("Input");
21 auto y = _Transpose(x, {0, 1, 3, 2});
22 auto z = _Add(y, _Scalar<int>(1));
23 z->setName("Add");
24 auto q = _Negative(y);
25 auto p = _Transpose(q, {0, 3, 1, 2});
26 p->setName("Transpose");
27 std::unique_ptr<NetT> net(new NetT);
28 Variable::save({z, p}, net.get());
29 flatbuffers::FlatBufferBuilder builder;
30 auto len = MNN::Net::Pack(builder, net.get());
31 builder.Finish(len);
32 return std::shared_ptr<Module>(Module::load({"Input"}, {"Add", "Transpose"}, builder.GetBufferPointer(), builder.GetSize()));
33}
34
35class RasterOutputTest : public MNNTestCase {
36public:

Callers 1

runMethod · 0.70

Calls 10

_InputFunction · 0.85
_TransposeFunction · 0.85
_AddFunction · 0.85
_NegativeFunction · 0.85
saveFunction · 0.50
loadFunction · 0.50
setNameMethod · 0.45
getMethod · 0.45
FinishMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected