INNER CODE UNIT · Python
x
Mukosame/Anime2Sketch · model.py:120
x = x.view(-1, 1, h, w)
x = self.pad(x)
x = F.conv2d(x, self.kernel)
return x.view(b, c, h, w)
class Upsample(nn.Module):
def __init__(self, inc, outc, scale_factor=2):
super().__init__()
self.scale_factor = scale_factor
self.up = nn.Upsample(scale_factor=scale_factor, mode='bilinear')
self.smooth = Smooth()
self.conv = nn.Conv2d(inc, outc, kernel_size=3, stride=1, padding=1)
self.mlp = nn.Sequential(
nn.Conv2d(outc, 4 * outc, kernel_size=1, stride=1, padding=0),
nn.GELU(),
nn.Conv2d(4 * outc, outc, kernel_size=1, stride=1, padding=0),
)