X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=pytorch.git;a=blobdiff_plain;f=ae_size.py;h=067a7fa7bc1d44f4330e7f37fe1e511d3fd92045;hp=8afb101100b87429351aa4dc157f59973ec398c1;hb=HEAD;hpb=e111e52ea09f03fc309052b00a452ced52668f70 diff --git a/ae_size.py b/ae_size.py index 8afb101..49f4a20 100755 --- a/ae_size.py +++ b/ae_size.py @@ -1,13 +1,19 @@ #!/usr/bin/env python +# Any copyright is dedicated to the Public Domain. +# https://creativecommons.org/publicdomain/zero/1.0/ + +# Written by Francois Fleuret + import math from torch import nn from torch import Tensor ###################################################################### + def minimal_input_size(w, layer_specs): - assert w > 0, 'The input is too small' + assert w > 0, "The input is too small" if layer_specs == []: return w else: @@ -16,13 +22,13 @@ def minimal_input_size(w, layer_specs): v = minimal_input_size(v, layer_specs[1:]) return (v - 1) * stride + kernel_size + ###################################################################### # Dummy test if __name__ == "__main__": - - layer_specs = [ (17, 5), (5, 4), (3, 2), (3, 2) ] + layer_specs = [(17, 5), (5, 4), (3, 2), (3, 2)] layers = []