nn.Upsample to nn.functional.interpolate

I think a simple way to define a module to use the interpolate function. Then you can use it in your sequential container same as you are using nn.Upsample currently.
Something along these lines:

class Upsample(nn.Module):
    def __init__(self,  scale_factor):
        super(Upsample, self).__init__()
        self.scale_factor = scale_factor
    def forward(self, x):
        return F.interpolate(x, scale_factor=self.scale_factor)
3 Likes