r""" Args: x: :math:`(*, C_{in})`, input tensor. Returns: :math:`(*, C_{out})`, output tensor.
(self, x: torch.Tensor)
| 275 | self.addons.append(nn.Sequential(*additional_layers)) |
| 276 | |
| 277 | def forward(self, x: torch.Tensor) -> torch.Tensor: |
| 278 | r""" |
| 279 | Args: |
| 280 | x: |
| 281 | :math:`(*, C_{in})`, input tensor. |
| 282 | |
| 283 | Returns: |
| 284 | :math:`(*, C_{out})`, output tensor. |
| 285 | """ |
| 286 | for i in range(len(self.main) - 1): |
| 287 | x = self.main[i](x) |
| 288 | if self.permute_for_norm and len(x.shape) == 3: |
| 289 | x = x.permute(0, 2, 1) |
| 290 | x = self.addons[i](x) |
| 291 | if self.permute_for_norm and len(x.shape) == 3: |
| 292 | x = x.permute(0, 2, 1) |
| 293 | x = self.main[-1](x) |
| 294 | if self.output_add_nonlinearity: |
| 295 | if self.permute_for_norm and len(x.shape) == 3: |
| 296 | x = x.permute(0, 2, 1) |
| 297 | x = self.addons[-1](x) |
| 298 | if self.permute_for_norm and len(x.shape) == 3: |
| 299 | x = x.permute(0, 2, 1) |
| 300 | return x |
| 301 | |
| 302 | |
| 303 | class ShiftedLinearLayer(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected