| 10 | using namespace test; |
| 11 | |
| 12 | TEST_F(FALLBACK, REDUCE_FULL) { |
| 13 | using Param = Reduce::Param; |
| 14 | using Mode = Param::Mode; |
| 15 | Checker<Reduce> checker(handle()); |
| 16 | UniformIntRNG rng{INT8_MIN >> 1, INT8_MAX >> 1}; |
| 17 | checker.set_rng(0, &rng); |
| 18 | struct Config { |
| 19 | Param param; |
| 20 | DType dtype; |
| 21 | TensorShape shape; |
| 22 | Config(Param param, DType dtype, TensorShape shape) |
| 23 | : param(param), dtype(dtype), shape(shape) {} |
| 24 | }; |
| 25 | std::vector<Config> configs; |
| 26 | for (auto mode : {Mode::MEAN, Mode::MAX, Mode::MIN}) |
| 27 | for (auto dtype : std::vector<DType>{ |
| 28 | dtype::Float32(), dtype::Float16(), dtype::QuantizedS8(1.3f), |
| 29 | dtype::Quantized8Asymm(1.3f, static_cast<uint8_t>(3))}) |
| 30 | for (int32_t axis : {0, 1, 2}) { |
| 31 | for (size_t A : {1, 3, 5, 20}) { |
| 32 | for (size_t B : {4, 6, 9, 16, 33, 45}) { |
| 33 | for (size_t C : {2, 3, 4, 6, 9, 16, 33, 45}) { |
| 34 | TensorShape shape{A, B, C}; |
| 35 | Param param(mode, axis); |
| 36 | Config config(param, dtype, shape); |
| 37 | configs.push_back(config); |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 | for (auto&& config : configs) { |
| 43 | auto&& dtype = config.dtype; |
| 44 | auto&& param = config.param; |
| 45 | auto&& shape = config.shape; |
| 46 | |
| 47 | checker.set_dtype(0, dtype).set_param(param).execs({shape, {}}); |
| 48 | } |
| 49 | configs.clear(); |
| 50 | for (auto mode : {Mode::SUM, Mode::PRODUCT, Mode::SUM_SQR}) |
| 51 | for (auto dtype : std::vector<DType>{dtype::Float32(), dtype::Float16()}) |
| 52 | for (int32_t axis : {0, 1, 2}) { |
| 53 | for (size_t A : {1, 3, 5, 20}) { |
| 54 | for (size_t B : {4, 6, 9, 16, 33, 45}) { |
| 55 | for (size_t C : {2, 3, 4, 6, 9, 16, 33, 45}) { |
| 56 | TensorShape shape{A, B, C}; |
| 57 | Param param(mode, axis); |
| 58 | Config config(param, dtype, shape); |
| 59 | configs.push_back(config); |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | UniformFloatRNG rng_float(-2, 2); |
| 66 | checker.set_rng(0, &rng_float); |
| 67 | checker.set_epsilon(1e-1); |
| 68 | for (auto&& config : configs) { |
| 69 | auto&& dtype = config.dtype; |
nothing calls this directly
no test coverage detected