layer_specs = [ (11, 5), (5, 2), (3, 2), (3, 2) ]
layers = []
- for l in layer_specs:
- layers.append(nn.Conv2d(1, 1, l[0], l[1]))
+ for kernel_size, stride in layer_specs:
+ layers.append(nn.Conv2d(1, 1, kernel_size, stride))
- for l in reversed(layer_specs):
- layers.append(nn.ConvTranspose2d(1, 1, l[0], l[1]))
+ for kernel_size, stride in reversed(layer_specs):
+ layers.append(nn.ConvTranspose2d(1, 1, kernel_size, stride))
m = nn.Sequential(*layers)