Skip to content

Commit

Permalink
Merge pull request #78 from openspeech-team/ha
Browse files Browse the repository at this point in the history
Resolved #76
  • Loading branch information
sooftware authored Aug 24, 2021
2 parents a77aa3e + 2e037fe commit 2976bad
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
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}")

0 comments on commit 2976bad

Please sign in to comment.