MCPcopy Create free account
hub / github.com/alibaba/MNN / _Pool

Function _Pool

express/NeuralNetWorkOp.cpp:348–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346}
347
348static VARP _Pool(VARP x, INTS kernel, INTS stride, PoolType type, PaddingMode pad, INTS pads) {
349 std::unique_ptr<OpT> pool(new OpT);
350 pool->type = OpType_Pooling;
351 pool->main.type = OpParameter_Pool;
352 pool->main.value = new PoolT;
353 if (kernel[0] == -1 && kernel[1] == -1) {
354 pool->main.AsPool()->isGlobal = true;
355 }
356 pool->main.AsPool()->padX = 0;
357 pool->main.AsPool()->padY = 0;
358 if (pads.size() >= 2) {
359 pool->main.AsPool()->padX = pads[0];
360 pool->main.AsPool()->padY = pads[1];
361 }
362 pool->main.AsPool()->padType = _convertPoollingPadMode(pad);
363 pool->main.AsPool()->kernelX = kernel[0];
364 pool->main.AsPool()->kernelY = kernel[1];
365 pool->main.AsPool()->strideX = stride[0];
366 pool->main.AsPool()->strideY = stride[1];
367 pool->main.AsPool()->type = type;
368 return (Variable::create(Expr::create(pool.get(), {x})));
369}
370
371VARP _AvePool(VARP x, INTS kernel, INTS stride, PaddingMode pad, INTS pads) {
372 return _Pool(x, kernel, stride, PoolType_AVEPOOL, pad, pads);

Callers 2

_AvePoolFunction · 0.85
_MaxPoolFunction · 0.85

Calls 5

AsPoolMethod · 0.80
_convertPoollingPadModeFunction · 0.70
createFunction · 0.50
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected