(self, x: torch.Tensor)
| 135 | return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps) |
| 136 | |
| 137 | def forward(self, x: torch.Tensor): |
| 138 | output = self._norm(x.float()).type_as(x) |
| 139 | return output * self.weight |
| 140 | |
| 141 | def reset_parameters(self): |
| 142 | torch.nn.init.ones_(self.weight) # type: ignore |