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

Method run

test/op/ScaleTest.cpp:18–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16public:
17 virtual ~ScaleTest() = default;
18 virtual bool run(int precision) {
19 auto input = _Input({1, 2, 2, 1}, NCHW);
20 // set input data
21 const float inpudata[] = {-1.0, -2.0, 3.0, 4.0};
22 auto inputPtr = input->writeMap<float>();
23 memcpy(inputPtr, inpudata, 4 * sizeof(float));
24 input = _Convert(input, NC4HW4);
25 auto output = _Scale(input, 2, {2.0, 1.0}, {3.0, 4.0});
26 output = _Convert(output, NCHW);
27 const std::vector<float> expectedOutput = {1, -1, 7, 8};
28 auto gotOutput = output->readMap<float>();
29 if (!checkVector<float>(gotOutput, expectedOutput.data(), 4, 1e-5)) {
30 MNN_ERROR("ScaleTest test failed!\n");
31 return false;
32 }
33 return true;
34 }
35};
36
37class ScaleInt8Test : public MNNTestCase {

Callers

nothing calls this directly

Calls 4

_InputFunction · 0.85
_ConvertFunction · 0.85
_ScaleFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected