A:Pool层无paddging操作
1:stride=1,不会产生截断不整除问题,所以不用考虑向上或者向下取整问题
2:stride>1,可能或产生截断不整除问题
- 可以使用padding层,补全不能整除的部分
IActivationLayer* relu1 = basicConv2d(network, weightMap, *scale1->getOutput(0), 64, 7, 2, 3, "conv1.");
IPaddingLayer* pad1 = network->addPadding(*relu1->getOutput(0), DimsHW{ 0, 0 }, DimsHW{ 1, 1 });
assert(pad1);
IPoolingLayer* pool1 = network->addPooling(*pad1->getOutput(0), PoolingType::kMAX, DimsHW{ 3, 3 });
assert(pool1);
pool1->setStride(DimsHW{ 2, 2 });
- 可以设置paddingmode,来调整取整的方向问题
enum class PaddingMode : int
{
kEXPLICIT_ROUND_DOWN = 0, //!< Use explicit padding, rounding output size down.
kEXPLICIT_ROUND_UP = 1, //!< Use explicit padding, rounding output size up.
kSAME_UPPER = 2, //!< Use SAME padding with prePadding <= postPadding.
kSAME_LOWER = 3, /
来源:oschina
链接:https://my.oschina.net/u/4370809/blog/4529166