| 80 | TEST_SUITE(ReduceMean) |
| 81 | |
| 82 | TEST_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 |
nothing calls this directly
no test coverage detected