X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=pytorch.git;a=blobdiff_plain;f=ae_size.py;h=71839378d3001d1c5b5eae1601d64b3509712995;hp=7bef9f507f8eb6ff15bbd81b40e0ad4ee2e2d927;hb=0a30c677bfb0aac1f9eebc9646728519ca72bf5b;hpb=2db4624955ad2a1c29f7632f30ac217c045638cf diff --git a/ae_size.py b/ae_size.py index 7bef9f5..7183937 100755 --- a/ae_size.py +++ b/ae_size.py @@ -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()) + +######################################################################