(self, in_channels: int, out_channels: int, num_res_blocks: int, down: bool = False)
| 530 | """ |
| 531 | |
| 532 | def __init__(self, in_channels: int, out_channels: int, num_res_blocks: int, down: bool = False): |
| 533 | super().__init__() |
| 534 | mid_channels = out_channels // 4 |
| 535 | |
| 536 | self.downsample = None |
| 537 | if down: |
| 538 | self.downsample = nn.AvgPool2d(kernel_size=2, stride=2, ceil_mode=True) |
| 539 | |
| 540 | self.in_conv = nn.Conv2d(in_channels, mid_channels, kernel_size=1) |
| 541 | self.resnets = nn.Sequential(*[LightAdapterResnetBlock(mid_channels) for _ in range(num_res_blocks)]) |
| 542 | self.out_conv = nn.Conv2d(mid_channels, out_channels, kernel_size=1) |
| 543 | |
| 544 | def forward(self, x: torch.Tensor) -> torch.Tensor: |
| 545 | r""" |
nothing calls this directly
no test coverage detected