std :: ml::convnet
Struct std::Pool2dSpec
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
avg pooling only
Methods
§
static struct Pool2dSpec new(
unsigned long kernel,
unsigned long stride,
unsigned long padding,
)source · definitionSquare window; floor mode, padding counted.