From fd830c6416631099a5bd3f4bc5dd7c4d888b4c46 Mon Sep 17 00:00:00 2001 From: Eren Date: Wed, 19 Sep 2018 14:16:21 +0200 Subject: [PATCH] Attention convolution padding correction for TF "SAME" --- layers/attention.py | 2 +- layers/tacotron.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/layers/attention.py b/layers/attention.py index f8fecb83..082b7127 100644 --- a/layers/attention.py +++ b/layers/attention.py @@ -42,7 +42,7 @@ class LocationSensitiveAttention(nn.Module): super(LocationSensitiveAttention, self).__init__() self.kernel_size = kernel_size self.filters = filters - padding = int((kernel_size - 1) / 2) + padding = [(kernel_size - 1) // 2, (kernel_size - 1) // 2] self.loc_conv = nn.Conv1d( 2, filters, diff --git a/layers/tacotron.py b/layers/tacotron.py index 195df4fa..6ab06d7f 100644 --- a/layers/tacotron.py +++ b/layers/tacotron.py @@ -136,7 +136,7 @@ class CBHG(nn.Module): padding=[(k - 1) // 2, k // 2], activation=self.relu) for k in range(1, K + 1) ]) - # max pooling of conv bank, padding with nn.functional + # max pooling of conv bank, with padding # TODO: try average pooling OR larger kernel size self.max_pool1d = nn.Sequential( nn.ConstantPad1d([0, 1], value=0),