(
self,
in_channels: int = 3,
channels: List[int] = [320, 640, 1280],
num_res_blocks: int = 4,
downscale_factor: int = 8,
)
| 472 | """ |
| 473 | |
| 474 | def __init__( |
| 475 | self, |
| 476 | in_channels: int = 3, |
| 477 | channels: List[int] = [320, 640, 1280], |
| 478 | num_res_blocks: int = 4, |
| 479 | downscale_factor: int = 8, |
| 480 | ): |
| 481 | super().__init__() |
| 482 | |
| 483 | in_channels = in_channels * downscale_factor**2 |
| 484 | |
| 485 | self.unshuffle = nn.PixelUnshuffle(downscale_factor) |
| 486 | |
| 487 | self.body = nn.ModuleList( |
| 488 | [ |
| 489 | LightAdapterBlock(in_channels, channels[0], num_res_blocks), |
| 490 | *[ |
| 491 | LightAdapterBlock(channels[i], channels[i + 1], num_res_blocks, down=True) |
| 492 | for i in range(len(channels) - 1) |
| 493 | ], |
| 494 | LightAdapterBlock(channels[-1], channels[-1], num_res_blocks, down=True), |
| 495 | ] |
| 496 | ) |
| 497 | |
| 498 | self.total_downscale_factor = downscale_factor * (2 ** len(channels)) |
| 499 | |
| 500 | def forward(self, x: torch.Tensor) -> List[torch.Tensor]: |
| 501 | r""" |
nothing calls this directly
no test coverage detected