From: Francois Fleuret <francois@fleuret.org>
Date: Sun, 6 Jun 2021 13:55:07 +0000 (+0200)
Subject: Update.
X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=2d95f238bbaa0e585b50846d39c98df4aae2b7f9;p=pytorch.git

Update.
---

diff --git a/conv_chain.py b/conv_chain.py
index 184e06b..2d5af8e 100755
--- a/conv_chain.py
+++ b/conv_chain.py
@@ -14,10 +14,10 @@ def conv_chain(input_size, output_size, depth, cond):
     else:
         r = [ ]
         for kernel_size in range(1, input_size + 1):
-            for stride in range(1, input_size + 1):
+            for stride in range(1, input_size):
                 if cond(depth, kernel_size, stride):
                     n = (input_size - kernel_size) // stride + 1
-                    if (n - 1) * stride + kernel_size == input_size:
+                    if n >= output_size and (n - 1) * stride + kernel_size == input_size:
                         q = conv_chain(n, output_size, depth - 1, cond)
                         r += [ [ (kernel_size, stride) ] + u for u in q ]
         return r