(self, x, output_size=None)
| 176 | self.conv = nn.ConvTranspose2d(channels, self.out_channels, 4, 2, 1) |
| 177 | |
| 178 | def forward(self, x, output_size=None): |
| 179 | assert x.shape[-1] == self.channels |
| 180 | |
| 181 | if self.use_conv_transpose: |
| 182 | return self.conv(x) |
| 183 | |
| 184 | if output_size is None: |
| 185 | x = F.interpolate( |
| 186 | x.permute(0,3,1,2).to(memory_format=torch.channels_last), |
| 187 | scale_factor=2.0, mode='nearest').permute(0,2,3,1).contiguous() |
| 188 | else: |
| 189 | x = F.interpolate( |
| 190 | x.permute(0,3,1,2).to(memory_format=torch.channels_last), |
| 191 | size=output_size, mode='nearest').permute(0,2,3,1).contiguous() |
| 192 | |
| 193 | # x = self.conv(x) |
| 194 | x = base_conv2d(x, self.conv, channel_last=True) |
| 195 | return x |
| 196 | |
| 197 | |
| 198 | class Downsample2D(nn.Module): |
nothing calls this directly
no test coverage detected