(self, in_channels, with_conv)
| 34 | |
| 35 | class Downsample(nn.Module): |
| 36 | def __init__(self, in_channels, with_conv): |
| 37 | super().__init__() |
| 38 | self.with_conv = with_conv |
| 39 | if self.with_conv: |
| 40 | # no asymmetric padding in torch conv, must do it ourselves |
| 41 | self.conv = torch.nn.Conv2d( |
| 42 | in_channels, in_channels, kernel_size=3, stride=2, padding=0 |
| 43 | ) |
| 44 | |
| 45 | def forward(self, x): |
| 46 | if self.with_conv: |