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

Function _mobileNetV1Expr

test/expr/ModuleTest.cpp:41–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39 return x;
40}
41static VARP _mobileNetV1Expr(VARP x = nullptr, bool softmax = true) {
42 int inputSize = 224, poolSize; // MobileNet_224, MobileNet_192, MobileNet_160, MobileNet_128
43 {
44 inputSize = 224;
45 poolSize = inputSize / 32;
46 }
47
48 int channels[6]; // MobileNet_100, MobileNet_075, MobileNet_050, MobileNet_025
49 { channels[0] = 32; }
50
51 for (int i = 1; i < 6; ++i) {
52 channels[i] = channels[0] * (1 << i);
53 }
54 if (nullptr == x) {
55 x = _Input({1, 3, inputSize, inputSize}, NC4HW4);
56 x->setName("Input");
57 }
58 x = _Conv(0.01f, 0.0f, x, {3, channels[0]}, {3, 3}, SAME, {2, 2}, {1, 1}, 1);
59 x = convBlock(x, {channels[0], channels[1]}, 1);
60 x = convBlock(x, {channels[1], channels[2]}, 2);
61 x = convBlock(x, {channels[2], channels[2]}, 1);
62 x = convBlock(x, {channels[2], channels[3]}, 2);
63 x = convBlock(x, {channels[3], channels[3]}, 1);
64 x = convBlock(x, {channels[3], channels[4]}, 2);
65 x = convBlock(x, {channels[4], channels[4]}, 1);
66 x = convBlocTemp(x, {channels[4], channels[4]}, 1);
67 x = convBlock(x, {channels[4], channels[4]}, 1);
68 x = convBlock(x, {channels[4], channels[4]}, 1);
69 x = convBlock(x, {channels[4], channels[4]}, 1);
70 x = convBlock(x, {channels[4], channels[5]}, 2);
71 x = convBlock(x, {channels[5], channels[5]}, 1);
72 x = _AvePool(x, {poolSize, poolSize}, {1, 1}, VALID);
73 x = _Conv(0.01f, 0.0f, x, {channels[5], 1001}, {1, 1}, VALID, {1, 1}, {1, 1}, 1); // reshape FC with Conv1x1
74 x = _Convert(x, NCHW);
75 if (softmax) {
76 x = _Reshape(x, {-1, 1001});
77 x = _Softmax(x, -1);
78 }
79 x->setName("Prob");
80 return x;
81}
82class ModuleTest : public MNNTestCase {
83public:
84 virtual bool run(int precision) {

Callers 11

runMethod · 0.70
runMethod · 0.70
runMethod · 0.70
runMethod · 0.70
_runMethod · 0.70
_runMethod · 0.70
_runMethod · 0.70
runMethod · 0.70
_runMethod · 0.70
runMethod · 0.70
_runmbv1Method · 0.70

Calls 9

_InputFunction · 0.85
convBlocTempFunction · 0.85
_AvePoolFunction · 0.85
_ConvertFunction · 0.85
_ReshapeFunction · 0.85
_SoftmaxFunction · 0.85
convBlockFunction · 0.70
_ConvFunction · 0.50
setNameMethod · 0.45

Tested by

no test coverage detected