Skip to content

Commit 88ae437

Browse files
committed
kernel size is not limited to odd number
fix tests
1 parent 881ee25 commit 88ae437

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

deepvoice3_pytorch/conv.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
class Conv1d(nn.Conv1d):
99
"""Extended nn.Conv1d for incremental dilated convolutions
10-
11-
currently limited for odd number kernel sizes
1210
"""
1311

1412
def __init__(self, *args, **kwargs):
@@ -33,7 +31,6 @@ def incremental_forward(self, input):
3331

3432
bsz = input.size(0) # input: bsz x len x dim
3533
if kw > 1:
36-
assert kw % 2 == 1
3734
input = input.data
3835
if self.input_buffer is None:
3936
self.input_buffer = input.new(bsz, kw + (kw - 1) * (dilation - 1), input.size(2))

tests/test_conv.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
def test_conv1d_incremental():
1212
def __test(kernel_size, dilation, T, B, C, causual=True):
13-
kernel_size = 3
1413
dilation = (dilation,)
1514

1615
# dilation = (4,)
@@ -60,6 +59,6 @@ def __test(kernel_size, dilation, T, B, C, causual=True):
6059
for B in [1, 16]:
6160
for T in [10, 20, 30]:
6261
for C in [1, 2, 4]:
63-
for kernel_size in [3, 5, 9]:
62+
for kernel_size in [2, 3, 4, 5, 6, 7, 8, 9]:
6463
for dilation in [1, 2, 3, 4, 5, 6, 7, 8, 9, 27]:
65-
__test, kernel_size, dilation, T, B, C
64+
yield __test, kernel_size, dilation, T, B, C

0 commit comments

Comments
 (0)