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

Function TEST_CASE

tests/validation/NEON/ReduceMean.cpp:82–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80TEST_SUITE(ReduceMean)
81
82TEST_CASE(ProperRoundingPolicyXReduction, framework::DatasetMode::ALL)
83{
84 // We do not need to stress vector and leftover loops diffrently
85 // because the rounding is done scalarly at the end. Accumulation
86 // is done over integer types.
87 constexpr int x_len = 2;
88
89 const auto input_shape = TensorShape(x_len);
90 const auto output_shape = TensorShape(1);
91 const bool keep_dims = true;
92 const auto axis = Coordinates(0);
93 const auto input_qinfo = QuantizationInfo(2 / 255.f, 0);
94 const auto output_qinfo = QuantizationInfo(6 / 255.f, -1);
95 const auto dtype = DataType::QASYMM8_SIGNED;
96
97 Tensor input = create_tensor<Tensor>(input_shape, dtype, 1, input_qinfo);
98 Tensor output = create_tensor<Tensor>(output_shape, dtype, 1, output_qinfo);
99
100 NEReduceMean reduce_mean;
101 reduce_mean.configure(&input, axis, keep_dims, &output);
102
103 input.allocator()->allocate();
104 output.allocator()->allocate();
105
106 std::vector<int8_t> values{50, 26};
107 library->fill_static_values(Accessor(input), values);
108
109 std::vector<int8_t> expected{12};
110 SimpleTensor<int8_t> ref{output_shape, dtype, 1, input_qinfo};
111 library->fill_static_values(ref, expected);
112
113 reduce_mean.run();
114
115 // The tolerance should be 0 because this test stresses the rounding behavior of the operator
116 validate(Accessor(output), ref, zero_tolerance_s8);
117}
118
119#ifdef __aarch64__
120// Due to the lack of instructions in a32, the rounding operation is less

Callers

nothing calls this directly

Calls 10

AccessorClass · 0.85
fill_static_valuesMethod · 0.80
TensorShapeClass · 0.50
CoordinatesClass · 0.50
QuantizationInfoClass · 0.50
validateFunction · 0.50
configureMethod · 0.45
allocateMethod · 0.45
allocatorMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected