| 16 | namespace arm_common { |
| 17 | |
| 18 | WorkspaceBundle 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 | |
| 47 | WorkspaceBundle get_bundle_nchw44(const PoolingImpl::PoolingKernSizeParam& param) { |
| 48 | megdnn_assert( |
no test coverage detected