Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved #76 #78

Merged
merged 1 commit into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions openspeech/modules/conv2d_subsampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def __init__(
)

def forward(self, inputs: torch.Tensor, input_lengths: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]:
outputs, input_lengths = super().forward(inputs, input_lengths)
output_lengths = input_lengths >> 2
output_lengths -= 1
outputs, output_lengths = super().forward(inputs, input_lengths)

return outputs, output_lengths
16 changes: 16 additions & 0 deletions tests/test_acoustic_models/test_conv2d_subsampling.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import unittest
import logging

from openspeech.modules import Conv2dSubsampling
from openspeech.utils import DUMMY_INPUTS, DUMMY_INPUT_LENGTHS

logger = logging.getLogger(__name__)


class TestConformer(unittest.TestCase):
def test_conv2d_subsampling(self):
conv_subsample = Conv2dSubsampling(input_dim=80, in_channels=1, out_channels=512)

outputs, output_lengths = conv_subsample(DUMMY_INPUTS, DUMMY_INPUT_LENGTHS)
print(f"input lengths : {DUMMY_INPUT_LENGTHS}")
print(f"output lengths : {output_lengths}")