DriftTexture · function

layerNorm

Each row normalised to zero mean and unit variance, then scaled by gamma and shifted by beta.

Explained in DriftTexture.

function layerNorm(x: Float32Array, rows: number, cols: number, gamma: Float32Array, beta: Float32Array, epsilon: number, out: Float32Array): void
import { layerNorm } from '@driftengine/texture';

Parameters

ParameterTypeDescription
xFloat32Array
rowsnumber
colsnumber
gammaFloat32Array
betaFloat32Array
epsilonnumber
outFloat32Array

In depth

The population variance, divided by the row's length and not one less, which is what the upstream frameworks compute and therefore what their trained weights expect.