I’m playing around with various upsampling techniques and tried using bicubic
but am getting the following error:
NotImplementedError: Input Error: Only 3D, 4D and 5D input Tensors supported (got 4D) for the modes: nearest | linear | bilinear | trilinear (got bicubic)
When can/should bicubic
be used?
And on a slightly unrelated note: is there a best practice for using bias on the upsampling convolution? I’ve seen a lot of models that don’t use bias but I’m not entirely sure why…
Thank you!
Code below:
def upconv(ni, nf, stride = 1):
return nn.Conv2d(ni, nf, kernel_size = 3, stride = stride,
padding = 1, bias = True)
def upblock(ni, nf, mode, scale_factor = 2):
return nn.Sequential(
nn.Upsample(scale_factor = scale_factor, mode = mode),
upconv(ni, nf),
nn.BatchNorm2d(nf),
nn.ReLU(inplace = True)
)
self.decoder = nn.Sequential(
upblock(1024, NDF * 8, mode = self.uptype),
upblock(NDF * 8, NDF * 4, mode = self.uptype),
upblock(NDF * 4, NDF * 2, mode = self.uptype),
nn.Upsample(scale_factor = 2, mode = self.uptype),
upconv(NDF * 2, NC),
nn.Sigmoid()
)