关于pytorch中torch.nn.MaxPool2d 、torch.nn.AvgPool2d等函数参数记录说明

在使用pytorch计算最大池化和均值池化时,需要注意函数参数中ceil_mode默认为false,也就是说计算特征图输出大小时默认向下取整的,这与caffe等框架是不一样的,因此需要根据需求设置ceil_mode的值。

在pytorch 1.0.0版本中,池化操作计算输出特征图大小默认是向下取整的,与我们平常理解向上取整不一样,如果稍有不注意会使得池化过程中出现边缘信息丢失的情况,因此使用时需要注意ceil_mode参数设置。

torch.nn.MaxPool2d(kernel_size, stride=None, padding=0, dilation=1, return_indices=False, ceil_mode=False)

参数说明如下:

Parameters:
  • kernel_size – the size of the window to take a max over
  • stride – the stride of the window. Default value is kernel_size
  • padding – implicit zero padding to be added on both sides
  • dilation – a parameter that controls the stride of elements in the window
  • return_indices – if True, will return the max indices along with the outputs. Useful for torch.nn.MaxUnpool2d later
  • ceil_mode – when True, will use ceil instead of floor to compute the output shape

给TA买糖
共{{data.count}}人
人已赞赏
文章目标检测

安装SSD-Pytorch时报错gcc: error: pycocotools/_mask.c: No such file or directory

2019-1-22 13:42:43

文章

Detectron 框架安装与使用要点(上)

2019-2-20 20:45:53

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
搜索