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

Method run

test/op/ChannelShuffleTest.cpp:18–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16public:
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};
35MNNTestSuiteRegister(ChannelShuffleTest, "op/channel_shuffle");

Callers

nothing calls this directly

Calls 4

_InputFunction · 0.85
_ChannelShuffleFunction · 0.85
_ConvertFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected