| 123 | with shape (batch_size, channels, height, width). |
| 124 | """ |
| 125 | def __init__(self, normalized_shape, eps=1e-6, data_format="channels_last"): |
| 126 | super().__init__() |
| 127 | self.weight = nn.Parameter(torch.ones(normalized_shape)) |
| 128 | self.bias = nn.Parameter(torch.zeros(normalized_shape)) |
| 129 | self.eps = eps |
| 130 | self.data_format = data_format |
| 131 | if self.data_format not in ["channels_last", "channels_first"]: |
| 132 | raise NotImplementedError |
| 133 | self.normalized_shape = (normalized_shape, ) |
| 134 | |
| 135 | def forward(self, x): |
| 136 | if self.data_format == "channels_last": |