MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / TEST_F

Function TEST_F

dnn/test/arm_common/reduce.cpp:11–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 11

set_dtypeMethod · 0.80
runFunction · 0.50
push_backMethod · 0.45
execsMethod · 0.45
clearMethod · 0.45
getMethod · 0.45
paramMethod · 0.45
deduce_layoutMethod · 0.45
total_nr_elemsMethod · 0.45
to_stringMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected