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

Method __init__

imperative/python/megengine/module/normalization.py:176–190  ·  view source on GitHub ↗
(self, normalized_shape, eps=1e-05, affine=True, **kwargs)

Source from the content-addressed store, hash-verified

174 """
175
176 def __init__(self, normalized_shape, eps=1e-05, affine=True, **kwargs):
177 super().__init__(**kwargs)
178 if isinstance(normalized_shape, int):
179 normalized_shape = (normalized_shape,)
180 self.normalized_shape = tuple(normalized_shape)
181 self.eps = eps
182 self.affine = affine
183 if self.affine:
184 self.weight = Parameter(np.ones(self.normalized_shape, dtype="float32"))
185 self.bias = Parameter(np.zeros(self.normalized_shape, dtype="float32"))
186 else:
187 self.weight = None
188 self.bias = None
189
190 self.reset_parameters()
191
192 def reset_parameters(self):
193 if self.affine:

Callers

nothing calls this directly

Calls 5

reset_parametersMethod · 0.95
ParameterClass · 0.90
onesMethod · 0.80
__init__Method · 0.45
zerosMethod · 0.45

Tested by

no test coverage detected