(self, x)
| 133 | self.normalized_shape = (normalized_shape, ) |
| 134 | |
| 135 | def forward(self, x): |
| 136 | if self.data_format == "channels_last": |
| 137 | return F.layer_norm(x, self.normalized_shape, self.weight, self.bias, self.eps) |
| 138 | elif self.data_format == "channels_first": |
| 139 | u = x.mean(1, keepdim=True) |
| 140 | s = (x - u).pow(2).mean(1, keepdim=True) |
| 141 | x = (x - u) / torch.sqrt(s + self.eps) |
| 142 | x = self.weight[:, None, None] * x + self.bias[:, None, None] |
| 143 | return x |
| 144 | |
| 145 | |
| 146 | model_urls = { |
nothing calls this directly
no outgoing calls
no test coverage detected