MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / layer_norm

Function layer_norm

imperative/python/megengine/xla/rules/normalize.py:172–177  ·  view source on GitHub ↗
(x, w, b, affine, normalized_dim, eps)

Source from the content-addressed store, hash-verified

170
171
172def layer_norm(x, w, b, affine, normalized_dim, eps):
173 reduce_axes = list(range(x.ndim - normalized_dim, x.ndim))
174 y, x_mean, rstd = _normalize(x, reduce_axes, eps)
175 if affine:
176 y = y * w + b
177 return y, x_mean, rstd
178
179
180def layer_norm_grad(dy, x, w, x_mean, rstd, affine):

Callers 1

layer_norm_lowerFunction · 0.70

Calls 2

listFunction · 0.85
_normalizeFunction · 0.85

Tested by

no test coverage detected