Skip to content

Commit 2d27904

Browse files
Erman OkmanErman Okman
Erman Okman
authored and
Erman Okman
committed
fixes pooling when the operator is None, the input is 1d
1 parent 0f3dd3a commit 2d27904

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

izer/izer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,8 @@ def main():
502502
f'{pixelcount}) does not match the '
503503
f'sum of all pixels ({pixels}) in the layer\'s `in_sequences`.')
504504
input_dim[ll] = conf_input_dim[ll]
505-
if operator[ll] != op.CONV1D:
505+
506+
if not (operator[ll] == op.CONV1D or (operator[ll] == op.NONE and input_dim[ll][1] == 1)):
506507
if pool_stride[ll][0] != pool_stride[ll][1]:
507508
eprint(f'{layer_pfx(ll)}{op.string(operator[ll])} does not support '
508509
f'non-square pooling stride (currently set to '
@@ -512,6 +513,7 @@ def main():
512513
(input_dim[ll][1] + pool_stride[ll][1] - pool[ll][1]
513514
- pool_dilation[ll][1] + 1) // pool_stride[ll][1]]
514515
else:
516+
pool[ll][1] = 1
515517
pooled_size = [(input_dim[ll][0] + pool_stride[ll][0] - pool[ll][0]
516518
- pool_dilation[ll][0] + 1) // pool_stride[ll][0],
517519
1]
@@ -521,7 +523,7 @@ def main():
521523
eprint(f'{layer_pfx(ll)}Pooling or zero-padding results in a zero data '
522524
f'dimension (input {input_dim[ll]}, result {pooled_dim[ll]}).')
523525

524-
if operator[ll] != op.CONV1D:
526+
if not (operator[ll] == op.CONV1D or (operator[ll] == op.NONE and input_dim[ll][1] == 1)):
525527
if stride[ll][0] != stride[ll][1]:
526528
eprint(f'{layer_pfx(ll)}{op.string(operator[ll])} does not support '
527529
f'non-square stride (currently set to {stride[ll][0]}x{stride[ll][1]}).')

0 commit comments

Comments
 (0)