MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / TEST_CASE

Function TEST_CASE

tests/validation/NEON/QuantizationLayer.cpp:67–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65TEST_SUITE(QuantizationLayer)
66
67TEST_CASE(ProperlyRoundedRequantization, framework::DatasetMode::ALL)
68{
69 // The test case here covers both Int8 and UInt8 because the underlying kernel is the same
70 const auto shape = TensorShape(18U); // > 16 for channel dim. to stress vector and leftover loops
71 const auto dtype = DataType::QASYMM8_SIGNED;
72 const auto in_qinfo = QuantizationInfo(0.5f, -1);
73 const auto out_qinfo = QuantizationInfo(1.f, -1);
74
75 Tensor input = create_tensor<Tensor>(shape, dtype, 1, in_qinfo);
76 Tensor output = create_tensor<Tensor>(shape, dtype, 1, out_qinfo);
77
78 NEQuantizationLayer quant_layer;
79 quant_layer.configure(&input, &output);
80
81 input.allocator()->allocate();
82 output.allocator()->allocate();
83
84 std::vector<int8_t> values = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35};
85 std::vector<int8_t> expected = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}; // (x + 1)/2 - 1
86
87 SimpleTensor<int8_t> ref{shape, dtype, 1, out_qinfo};
88
89 ARM_COMPUTE_EXPECT(values.size() == shape.x(), framework::LogLevel::ERRORS);
90
91 library->fill_static_values(Accessor(input), values);
92 library->fill_static_values(ref, expected);
93
94 quant_layer.run();
95
96 validate(Accessor(output), ref, zero_tolerance_s8);
97}
98
99TEST_CASE(QSymm8_per_channel_validate_scales, framework::DatasetMode::ALL)
100{

Callers

nothing calls this directly

Calls 14

AccessorClass · 0.85
fill_static_valuesMethod · 0.80
TensorShapeClass · 0.50
QuantizationInfoClass · 0.50
validateFunction · 0.50
TensorInfoClass · 0.50
configureMethod · 0.45
allocateMethod · 0.45
allocatorMethod · 0.45
sizeMethod · 0.45
xMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected