| 16 | public: |
| 17 | virtual ~ChannelShuffleTest() = default; |
| 18 | virtual bool run(int precision) { |
| 19 | auto input = _Input({1, 1, 2, 4}, NHWC); |
| 20 | // set input data |
| 21 | const float inpudata[] = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0}; |
| 22 | auto inputPtr = input->writeMap<float>(); |
| 23 | memcpy(inputPtr, inpudata, 8 * sizeof(float)); |
| 24 | auto output = _ChannelShuffle(input, 2); |
| 25 | output = _Convert(output, NHWC); |
| 26 | const std::vector<float> expectedOutput = {0.0, 2.0, 1.0, 3.0, 4.0, 6.0, 5.0, 7.0}; |
| 27 | auto gotOutput = output->readMap<float>(); |
| 28 | if (!checkVector<float>(gotOutput, expectedOutput.data(), 8, 1e-5)) { |
| 29 | MNN_ERROR("ChannelShuffleTest test failed!\n"); |
| 30 | return false; |
| 31 | } |
| 32 | return true; |
| 33 | } |
| 34 | }; |
| 35 | MNNTestSuiteRegister(ChannelShuffleTest, "op/channel_shuffle"); |
nothing calls this directly
no test coverage detected