std1.0.0-beta-7 SafeC docs

std :: ml::convnet

Macro RESIZE_NEAREST

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

#define RESIZE_NEAREST 0

To any outH x outW (up or down), as PyTorch's interpolate(size=...):

RESIZE_NEAREST   source floor(o * in / out) ('nearest'; alignCorners ignored)
RESIZE_BILINEAR  the four nearest pixels
RESIZE_BICUBIC   the sixteen nearest, cubic convolution with a = -0.75

alignCorners maps the corner pixels' centres onto each other (source o * (in - 1) / (out - 1)); otherwise pixel areas line up (source (o + 0.5) * in / out - 0.5, clamped at 0 for bilinear). Edges are clamped. Gradients scatter back with the same weights.