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

Method run

test/op/ScaleTest.cpp:40–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38public:
39 virtual ~ScaleInt8Test() = default;
40 virtual bool run(int precision) {
41 auto input = _Input({1, 2, 2, 1}, NCHW);
42 input->writeScaleMap(0.0313725, 1.f);
43 // set input data
44 const float inpudata[] = {-1.0, -2.0, 3.0, 4.0};
45 auto inputPtr = input->writeMap<float>();
46 memcpy(inputPtr, inpudata, 4 * sizeof(float));
47 input = _Convert(input, NC4HW4);
48 auto output = _Scale(input, 2, {2.0, 1.0}, {3.0, 4.0});
49 output = _Convert(output, NCHW);
50 output->writeScaleMap(0.0628, 1.f);
51 const std::vector<float> expectedOutput = {1, -1, 7, 8};
52 auto gotOutput = output->readMap<float>();
53 if (!checkVector<float>(gotOutput, expectedOutput.data(), 4, 1e-1)) {
54 MNN_ERROR("ScaleTestInt8 test failed!\n");
55 return false;
56 }
57 return true;
58 }
59};
60
61MNNTestSuiteRegister(ScaleTest, "op/scale");

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