MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / _layer_norm

Function _layer_norm

python/oneflow/test/modules/test_layer_norm.py:26–45  ·  view source on GitHub ↗
(x, normalized_shape, weight=None, bias=None, eps=1e-6)

Source from the content-addressed store, hash-verified

24
25
26def _layer_norm(x, normalized_shape, weight=None, bias=None, eps=1e-6):
27 begin_norm_axis = len(x.shape) - len(normalized_shape)
28 begin_params_axis = len(x.shape) - len(normalized_shape)
29
30 if weight is not None and bias is not None:
31 return flow._C.layer_norm_affine(
32 x,
33 weight,
34 bias,
35 begin_norm_axis=begin_norm_axis,
36 begin_params_axis=begin_params_axis,
37 epsilon=eps,
38 )
39 else:
40 return flow._C.layer_norm(
41 x,
42 begin_norm_axis=begin_norm_axis,
43 begin_params_axis=begin_params_axis,
44 epsilon=eps,
45 )
46
47
48def _test_layer_norm(

Callers 1

_test_layer_normFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected