Skip to content
Open
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
6 changes: 3 additions & 3 deletions neural_sp/models/seq2seq/encoders/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def __init__(self, in_channel, out_channel,
kernel_size=kernel_size,
stride=stride,
padding=1)
self._odim = update_lens_1d(torch.IntTensor([in_channel]), self.conv1)[0].item()
self._odim = out_channel
self.batch_norm1 = nn.BatchNorm1d(out_channel) if batch_norm else lambda x: x
self.layer_norm1 = nn.LayerNorm(out_channel,
eps=layer_norm_eps) if layer_norm else lambda x: x
Expand All @@ -229,7 +229,7 @@ def __init__(self, in_channel, out_channel,
kernel_size=kernel_size,
stride=stride,
padding=1)
self._odim = update_lens_1d(torch.IntTensor([self._odim]), self.conv2)[0].item()
self._odim = out_channel
self.batch_norm2 = nn.BatchNorm1d(out_channel) if batch_norm else lambda x: x
self.layer_norm2 = nn.LayerNorm(out_channel,
eps=layer_norm_eps) if layer_norm else lambda x: x
Expand All @@ -242,7 +242,7 @@ def __init__(self, in_channel, out_channel,
padding=0,
ceil_mode=True)
# NOTE: If ceil_mode is False, remove last feature when the dimension of features are odd.
self._odim = update_lens_1d(torch.IntTensor([self._odim]), self.pool)[0].item()
self._odim = self._odim
if self._odim % 2 != 0:
self._odim = (self._odim // 2) * 2
# TODO(hirofumi0810): more efficient way?
Expand Down