| 42 | class RRDBNet(torch.nn.Module): |
| 43 | |
| 44 | def __init__(self, num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32, **kwargs): |
| 45 | super(RRDBNet, self).__init__() |
| 46 | self.conv_first = torch.nn.Conv2d(num_in_ch, num_feat, 3, 1, 1) |
| 47 | self.body = torch.torch.nn.Sequential(*[RRDB(num_feat=num_feat, num_grow_ch=num_grow_ch) for _ in range(num_block)]) |
| 48 | self.conv_body = torch.nn.Conv2d(num_feat, num_feat, 3, 1, 1) |
| 49 | # upsample |
| 50 | self.conv_up1 = torch.nn.Conv2d(num_feat, num_feat, 3, 1, 1) |
| 51 | self.conv_up2 = torch.nn.Conv2d(num_feat, num_feat, 3, 1, 1) |
| 52 | self.conv_hr = torch.nn.Conv2d(num_feat, num_feat, 3, 1, 1) |
| 53 | self.conv_last = torch.nn.Conv2d(num_feat, num_out_ch, 3, 1, 1) |
| 54 | self.lrelu = torch.nn.LeakyReLU(negative_slope=0.2, inplace=True) |
| 55 | |
| 56 | def forward(self, x): |
| 57 | feat = x |