
Layer normalization (Geron Ch 15, morie.fn grln)
Source:R/geron_train_native.R
morie_geron_layer_normalization.RdPer-row (x - mu)/sqrt(var + eps) with the POPULATION variance, then gamma / beta. No batch axis, unlike batch norm.
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_geron_layer_normalization(V)
#> $output
#> [1] -1.5275238 -1.0910884 -0.6546530 -0.2182177 0.2182177 0.6546530 1.0910884
#> [8] 1.5275238
#>
#> $normalized
#> [1] -1.5275238 -1.0910884 -0.6546530 -0.2182177 0.2182177 0.6546530 1.0910884
#> [8] 1.5275238
#>
#> $mean
#> [1] 4.5
#>
#> $variance
#> [1] 5.25
#>
#> $eps
#> [1] 1e-05
#>
#> $estimate
#> [1] -1.5275238 -1.0910884 -0.6546530 -0.2182177 0.2182177 0.6546530 1.0910884
#> [8] 1.5275238
#>
#> $n
#> [1] 1
#>