(self, in_channels: int, out_channels: int, num_res_blocks: int, down: bool = False)
| 405 | """ |
| 406 | |
| 407 | def __init__(self, in_channels: int, out_channels: int, num_res_blocks: int, down: bool = False): |
| 408 | super().__init__() |
| 409 | |
| 410 | self.downsample = None |
| 411 | if down: |
| 412 | self.downsample = nn.AvgPool2d(kernel_size=2, stride=2, ceil_mode=True) |
| 413 | |
| 414 | self.in_conv = None |
| 415 | if in_channels != out_channels: |
| 416 | self.in_conv = nn.Conv2d(in_channels, out_channels, kernel_size=1) |
| 417 | |
| 418 | self.resnets = nn.Sequential( |
| 419 | *[AdapterResnetBlock(out_channels) for _ in range(num_res_blocks)], |
| 420 | ) |
| 421 | |
| 422 | def forward(self, x: torch.Tensor) -> torch.Tensor: |
| 423 | r""" |
nothing calls this directly
no test coverage detected