def __init__(self, n_feat): super(Downsample, self).__init__() self.body = nn.Sequential( nn.Conv2d(n_feat, n_feat // 2, kernel_size=3, stride=1, padding=1, bias=False), nn.PixelUnshuffle(2))
def __init__(self): super(NNVisionModule, self).__init__() self.input = torch.randn(1, 4, 9, 9) self.vision_modules = nn.ModuleList([ nn.PixelShuffle(2), nn.PixelUnshuffle(3), nn.Upsample(scale_factor=2, mode="nearest"), nn.Upsample(scale_factor=2, mode="bilinear"), nn.Upsample(scale_factor=2, mode="bicubic"), nn.UpsamplingNearest2d(scale_factor=2), nn.UpsamplingBilinear2d(scale_factor=2), ]) self.linear_sample = nn.Upsample(scale_factor=2, mode="linear") self.trilinear_sample = nn.Upsample(scale_factor=2, mode="trilinear")
def __init__(self): super(Model, self).__init__() self.down_0 = nn.PixelUnshuffle(2) self.down_1 = nn.PixelUnshuffle(4)
def __init__(self, r): super(PixelShuffle2d, self).__init__() self.r = r self.shuffle = nn.PixelShuffle(r) self.unshuffle = nn.PixelUnshuffle(r)