| 42 | |
| 43 | |
| 44 | class Upsample(nn.Module): |
| 45 | def __init__(self, in_channels, with_conv): |
| 46 | super().__init__() |
| 47 | self.with_conv = with_conv |
| 48 | if self.with_conv: |
| 49 | self.conv = torch.nn.Conv2d( |
| 50 | in_channels, in_channels, kernel_size=3, stride=1, padding=1 |
| 51 | ) |
| 52 | |
| 53 | def forward(self, x): |
| 54 | x = torch.nn.functional.interpolate(x, scale_factor=2.0, mode="nearest") |
| 55 | if self.with_conv: |
| 56 | x = self.conv(x) |
| 57 | return x |
| 58 | |
| 59 | |
| 60 | class UpsampleTimeStride4(nn.Module): |