adityachaubey commited on
Commit
fee5b68
·
1 Parent(s): 1c37637

Add downsample and upsample classes for improved model architecture

Browse files
Files changed (1) hide show
  1. model.py +14 -0
model.py CHANGED
@@ -64,3 +64,17 @@ class resblock(torch.nn.Module):
64
  h = self.silu(h)
65
  return h + self.residual_conv(x)
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  h = self.silu(h)
65
  return h + self.residual_conv(x)
66
 
67
+ #Downsmaple and upsmaple
68
+ class down_sample(torch.nn.Module):
69
+ def __init__(self, channels):
70
+ super().__ini__()
71
+ self.conv = nn.Conv2d(channels, channels, 4, stride=2, padding=1)
72
+ def forward(self, x):
73
+ return self.conv(x)
74
+
75
+ class up_sample(torch.nn.Module):
76
+ def __init__(self, channels):
77
+ super().__init__()
78
+ self.conv = nn.ConvTranspose2d(channels, channels, 4, stride=2, padding=1)
79
+ def forward(self, x):
80
+ return self.conv(x)