projects
/
pytorch.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dcb8e93
)
Update.
author
Francois Fleuret
<francois@fleuret.org>
Tue, 7 Dec 2021 07:19:35 +0000
(08:19 +0100)
committer
Francois Fleuret
<francois@fleuret.org>
Tue, 7 Dec 2021 07:19:35 +0000
(08:19 +0100)
conv_chain.py
patch
|
blob
|
history
diff --git
a/conv_chain.py
b/conv_chain.py
index
d10798f
..
3077874
100755
(executable)
--- a/
conv_chain.py
+++ b/
conv_chain.py
@@
-7,8
+7,8
@@
######################################################################
######################################################################
-def conv_chain(input_size, output_size, depth, cond):
- if depth == 0:
+def conv_chain(input_size, output_size,
remain_
depth, cond):
+ if
remain_
depth == 0:
if input_size == output_size:
return [ [ ] ]
else:
if input_size == output_size:
return [ [ ] ]
else:
@@
-17,10
+17,10
@@
def conv_chain(input_size, output_size, depth, cond):
r = [ ]
for kernel_size in range(1, input_size + 1):
for stride in range(1, input_size):
r = [ ]
for kernel_size in range(1, input_size + 1):
for stride in range(1, input_size):
- if cond(depth, kernel_size, stride):
+ if cond(
remain_
depth, kernel_size, stride):
n = (input_size - kernel_size) // stride + 1
if n >= output_size and (n - 1) * stride + kernel_size == input_size:
n = (input_size - kernel_size) // stride + 1
if n >= output_size and (n - 1) * stride + kernel_size == input_size:
- q = conv_chain(n, output_size, depth - 1, cond)
+ q = conv_chain(n, output_size,
remain_
depth - 1, cond)
r += [ [ (kernel_size, stride) ] + u for u in q ]
return r
r += [ [ (kernel_size, stride) ] + u for u in q ]
return r
@@
-35,7
+35,7
@@
if __name__ == "__main__":
c = conv_chain(
input_size = 64, output_size = 8,
c = conv_chain(
input_size = 64, output_size = 8,
- depth = 5,
+
remain_
depth = 5,
# We want kernels smaller than 4, strides smaller than the
# kernels, and strides of 1 except in the two last layers
cond = lambda d, k, s: k <= 4 and s <= k and (s == 1 or d <= 2)
# We want kernels smaller than 4, strides smaller than the
# kernels, and strides of 1 except in the two last layers
cond = lambda d, k, s: k <= 4 and s <= k and (s == 1 or d <= 2)