std1.0.0-beta-7 SafeC docs

std :: ml::convnet

Function std::tensor_batch_norm

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

&FloatTensor tensor_batch_norm(
    const &FloatTensor x,
    const &FloatTensor gamma,
    const &FloatTensor beta,
    &FloatTensor runMean,
    &FloatTensor runVar,
    unsigned long channels,
    unsigned long plane,
    int training,
    float momentum,
    float eps,
)

Batch normalization (Ioffe & Szegedy 2015) over x [batch, channelsplane]: each channel is normalized over the batch and its plane (plane = HW for feature maps, 1 for [batch, features] rows), then scaled by gamma and shifted by beta ([channels] each, trained). When 'training', the batch's statistics are used and runMean / runVar ([channels], no gradient) move toward them by 'momentum' (PyTorch: 0.1, with the unbiased variance); otherwise the running statistics are used. eps is added to the variance.