author Francois Fleuret Sat, 9 Jun 2018 12:11:24 +0000 (14:11 +0200) committer Francois Fleuret Sat, 9 Jun 2018 12:11:24 +0000 (14:11 +0200)
 ae_size.py patch | blob | history

index 7bef9f5..7183937 100755 (executable)
@@ -18,20 +18,26 @@ def minimal_input_size(w, layer_specs):

######################################################################

-layer_specs = [ (11, 5), (5, 2), (3, 2), (3, 2) ]
+# Dummy test

-layers = []
-for l in layer_specs:
-    layers.append(nn.Conv2d(1, 1, l[0], l[1]))
+if __name__ == "__main__":

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

-m = nn.Sequential(*layers)
+    layers = []
+    for l in layer_specs:
+        layers.append(nn.Conv2d(1, 1, l[0], l[1]))

-h = minimal_input_size(240, layer_specs)
-w = minimal_input_size(320, layer_specs)
+    for l in reversed(layer_specs):
+        layers.append(nn.ConvTranspose2d(1, 1, l[0], l[1]))

-x = Tensor(1, 1, h, w).normal_()
+    m = nn.Sequential(*layers)

-print(x.size(), m(x).size())
+    h = minimal_input_size(240, layer_specs)
+    w = minimal_input_size(320, layer_specs)
+
+    x = Tensor(1, 1, h, w).normal_()
+
+    print(x.size(), m(x).size())
+
+######################################################################