Skip to content

Commit

Permalink
Update conv.py
Browse files Browse the repository at this point in the history
  • Loading branch information
zh794390558 committed Dec 9, 2020
1 parent 8e615dd commit 4e7655b
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 4e7655b

Please sign in to comment.