When we use MNNConverter to convert other resnet model to MNN model, {Conv + BN + Relu} will be converted and optimized to {Conv}
| 17 | // When we use MNNConverter to convert other resnet model to MNN model, |
| 18 | // {Conv + BN + Relu} will be converted and optimized to {Conv} |
| 19 | static VARP residual(VARP x, INTS channels, int stride) { |
| 20 | int inputChannel = x->getInfo()->dim[1], outputChannel = channels[1]; |
| 21 | auto y = _Conv(0.0f, 0.0f, x, {inputChannel, outputChannel}, {3, 3}, SAME, {stride, stride}, {1, 1}, 1); |
| 22 | y = _Conv(0.0f, 0.0f, y, {outputChannel, outputChannel}, {3, 3}, SAME, {1, 1}, {1, 1}, 1); |
| 23 | if (inputChannel != outputChannel || stride != 1) { |
| 24 | x = _Conv(0.0f, 0.0f, x, {inputChannel, outputChannel}, {1, 1}, SAME, {stride, stride}, {1, 1}, 1); |
| 25 | } |
| 26 | y = _Add(x, y); |
| 27 | return y; |
| 28 | } |
| 29 | |
| 30 | static VARP residualBlock(VARP x, INTS channels, int stride, int number) { |
| 31 | x = residual(x, {channels[0], channels[1]}, stride); |
no test coverage detected