std1.0.0-beta-7 SafeC docs

std :: ml::convnet

Struct std::Pool2dSpec

#include <std/ml/convnet.h> source

struct Pool2dSpec {
    unsigned long kH;
    unsigned long kW;
    unsigned long strideH;
    unsigned long strideW;
    unsigned long padH;
    unsigned long padW;
    int ceilMode;
    int countIncludePad;
}

Windows are clipped to the plane: max pooling ignores the padding (as PyTorch's MaxPool2d does) and sends each window's gradient to its (first) largest input. Avg pooling with countIncludePad divides by the window's extent inside the padded plane (PyTorch's AvgPool2d default), else by the positions inside the plane. padH / padW at most half the window. ceilMode rounds the output side up, as PyTorch's ceil_mode (a last window must still start inside the input or its left padding).

Fields

§unsigned long kHsource
§unsigned long kWsource
§unsigned long strideHsource
§unsigned long strideWsource
§unsigned long padHsource
§unsigned long padWsource
§int ceilModesource
§int countIncludePadsource

avg pooling only

Methods

§static struct Pool2dSpec new( unsigned long kernel, unsigned long stride, unsigned long padding, )source · definition

Square window; floor mode, padding counted.