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

Function bottleNeck

benchmark/exprModels/MobileNetExpr.cpp:84–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84static VARP bottleNeck(VARP x, INTS channels, int stride, int expansionRatio) {
85 int inputChannel = channels[0], outputChannel = channels[1];
86 int expansionChannel = inputChannel * expansionRatio, group = expansionChannel;
87 auto y = _Conv(0.0f, 0.0f, x, {inputChannel, expansionChannel}, {1, 1}, VALID, {1, 1}, {1, 1}, 1);
88 y = _Conv(0.0f, 0.0f, y, {expansionChannel, expansionChannel}, {3, 3}, SAME, {stride, stride}, {1, 1}, group);
89 y = _Conv(0.0f, 0.0f, y, {expansionChannel, outputChannel}, {1, 1}, VALID, {1, 1}, {1, 1}, 1);
90 if (inputChannel != outputChannel || stride != 1) {
91 x = _Conv(0.0f, 0.0f, x, {inputChannel, outputChannel}, {1, 1}, SAME, {stride, stride}, {1, 1}, 1);
92 }
93 y = _Add(x, y);
94 return y;
95}
96
97static VARP bottleNeckBlock(VARP x, INTS channels, int stride, int expansionRatio, int number) {
98 x = bottleNeck(x, {channels[0], channels[1]}, stride, expansionRatio);

Callers 1

bottleNeckBlockFunction · 0.70

Calls 2

_AddFunction · 0.85
_ConvFunction · 0.50

Tested by

no test coverage detected