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

Function get_bundle

dnn/src/arm_common/pooling/algo.cpp:18–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16namespace arm_common {
17
18WorkspaceBundle get_bundle(const PoolingImpl::PoolingKernSizeParam& param) {
19 megdnn_assert(
20 (param.src_type.category() == DTypeCategory::FLOAT ||
21 param.src_type.enumv() == DTypeEnum::QuantizedS8 ||
22 param.src_type.enumv() == DTypeEnum::Quantized8Asymm ||
23 param.src_type == dtype::Int8{}) &&
24 param.format == param::Pooling::Format::NCHW &&
25 (param.mode == param::Pooling::Mode::MAX ||
26 (param.mode == param::Pooling::Mode::AVERAGE && param.filter[0] == 3)) &&
27 param.filter[0] == param.filter[1] &&
28 (param.filter[0] == 3 || param.filter[1] == 5) && param.stride[0] == 2 &&
29 param.stride[1] == 2 && param.isz[0] >= 2 && param.isz[1] >= 2);
30 //! max pooling nxn stride 2
31 auto IW = param.isz[1];
32 auto OW = param.osz[1];
33
34 // In order to process odd size filter,
35 // Firstly, Store a row of the input separately by odd and even numbers
36 // Then process them, get a row of the outputs
37 // We need to store n rows of results
38 SmallVector<size_t> needed_mem;
39 for (size_t i = 0; i < param.filter[0]; ++i)
40 needed_mem.push_back(OW * param.src_type.size());
41 needed_mem.push_back((IW + 1) / 2 * param.src_type.size());
42 needed_mem.push_back((IW + 1) / 2 * param.src_type.size());
43 WorkspaceBundle ws(nullptr, needed_mem, 16);
44 return ws;
45}
46
47WorkspaceBundle get_bundle_nchw44(const PoolingImpl::PoolingKernSizeParam& param) {
48 megdnn_assert(

Callers 15

algo.cppFile · 0.70
DISPATCH_FUNCFunction · 0.70
execMethod · 0.70
get_workspaceMethod · 0.50
kimplMethod · 0.50
get_workspaceMethod · 0.50
kimplMethod · 0.50
get_workspaceMethod · 0.50
kimplMethod · 0.50
get_workspaceMethod · 0.50
kimplMethod · 0.50

Calls 4

categoryMethod · 0.80
enumvMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected