#!/usr/bin/env python
+# Any copyright is dedicated to the Public Domain.
+# https://creativecommons.org/publicdomain/zero/1.0/
+
+# Written by Francois Fleuret <francois@fleuret.org>
+
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:
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 = []