| nn_bn_normalize_conv | R Documentation |
Batch normalization pools its statistics per channel over the batch AND every
spatial position. ggml_mean() only reduces ne[0], so the input is
first rearranged to put all reduced axes into ne[0] and the channel into
ne[1]. Both layouts fold adjacent axes, which is a pure view; only the
one permute in the 4-D route costs a copy.
nn_bn_normalize_conv(ctx, input_tensor, layer, training, eps)
training |
Logical; use batch statistics (TRUE) or running estimates (FALSE). |
[C, L, N]channel is ne[0]. L and N are
adjacent, so reshape to [C, L*N] then transpose to
[L*N, C].
[W, H, C, N]channel is ne[2]. W and H
are adjacent (reshape to [W*H, C, N]), then permute
brings N beside W*H ([W*H, N, C]) so a second
reshape folds both into [W*H*N, C].
At inference time the stored running estimates are used instead, broadcast along the channel axis, so a prediction does not depend on batch composition.
A ggml_tensor with the same shape as input_tensor.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.