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

Function get_nchw44_pool_args

dnn/test/fallback/pooling.cpp:13–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11
12namespace {
13std::vector<std::pair<param::Pooling, TensorShapeArray>> get_nchw44_pool_args(
14 size_t filter, size_t stride) {
15 constexpr size_t ic_step = 4;
16 std::vector<std::pair<param::Pooling, TensorShapeArray>> args;
17
18 for (size_t n : {1, 2})
19 for (size_t c : {4, 8})
20 for (size_t ih : {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13})
21 for (size_t iw : {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13})
22 for (size_t ph : {0, 1, 2})
23 for (size_t pw : {0, 1, 2})
24 for (auto mode :
25 {param::Pooling::Mode::MAX,
26 param::Pooling::Mode::AVERAGE})
27 if (ih + 2 * ph >= filter && iw + 2 * pw >= filter &&
28 filter > ph && filter > pw) {
29 param::Pooling param;
30 param.mode = mode;
31 param.format = param::Pooling::Format::NCHW44;
32 param.pad_h = ph;
33 param.pad_w = pw;
34 param.stride_h = param.stride_w = stride;
35 param.window_h = param.window_w = filter;
36 args.emplace_back(std::make_pair(
37 param,
38 TensorShapeArray{
39 {n, c / ic_step, ih, iw, ic_step},
40 {}}));
41 }
42 return args;
43}
44
45void run_pooling_check(
46 Handle* handle, std::vector<std::pair<param::Pooling, TensorShapeArray>> args,

Callers 1

TEST_FFunction · 0.70

Calls 1

emplace_backMethod · 0.80

Tested by

no test coverage detected