(
self,
shape: Union[int, Tuple[int, ...], torch.Size],
eps: float = 1e-5,
bias: bool = True,
dtype=None,
)
| 263 | eps: float |
| 264 | |
| 265 | def __init__( |
| 266 | self, |
| 267 | shape: Union[int, Tuple[int, ...], torch.Size], |
| 268 | eps: float = 1e-5, |
| 269 | bias: bool = True, |
| 270 | dtype=None, |
| 271 | ): |
| 272 | super().__init__() |
| 273 | |
| 274 | self.eps = eps |
| 275 | if isinstance(shape, numbers.Integral): |
| 276 | self.normalized_shape = (shape,) |
| 277 | else: |
| 278 | self.normalized_shape = tuple(shape) |
| 279 | |
| 280 | self.weight = nn.Parameter(torch.empty(shape)) |
| 281 | self.bias = nn.Parameter(torch.empty(shape)) if bias else None |
| 282 | |
| 283 | self.reset_parameters() |
| 284 | |
| 285 | def reset_parameters(self): |
| 286 | torch.nn.init.ones_(self.weight) |
nothing calls this directly
no test coverage detected