Hi,
I encountered a problem when I changed nn.Upsample
to nn.functional.interpolate
.
I want to put nn.functional.interpolate
into nn.Sequential by building Interpolate
class, but an error occurred.How can I modify the code?
class Interpolate(nn.Module):
def init(self, scale_factor, mode):
super(Interpolate, self).init()
self.interpolate = nn.functional.interpolate
self.scale_factor = scale_factor
self.mode = mode
def forward(self, x):
x = self.interpolate(x, scale_factor=self.scale_factor, mode=self.mode)
return x
self.decoder_s = nn.Sequential(
Interpolate(scale_factor=7, mode='bilinear'),
TypeError: __init__() got an unexpected keyword argument 'scale_factor'
[Finished in 2.9s with exit code 1]