mirror of
https://github.com/wassname/TTS.git
synced 2026-09-12 12:11:47 +08:00
Attention convolution padding correction for TF "SAME"
This commit is contained in:
+1
-1
@@ -42,7 +42,7 @@ class LocationSensitiveAttention(nn.Module):
|
|||||||
super(LocationSensitiveAttention, self).__init__()
|
super(LocationSensitiveAttention, self).__init__()
|
||||||
self.kernel_size = kernel_size
|
self.kernel_size = kernel_size
|
||||||
self.filters = filters
|
self.filters = filters
|
||||||
padding = int((kernel_size - 1) / 2)
|
padding = [(kernel_size - 1) // 2, (kernel_size - 1) // 2]
|
||||||
self.loc_conv = nn.Conv1d(
|
self.loc_conv = nn.Conv1d(
|
||||||
2,
|
2,
|
||||||
filters,
|
filters,
|
||||||
|
|||||||
+1
-1
@@ -136,7 +136,7 @@ class CBHG(nn.Module):
|
|||||||
padding=[(k - 1) // 2, k // 2],
|
padding=[(k - 1) // 2, k // 2],
|
||||||
activation=self.relu) for k in range(1, K + 1)
|
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
|
# TODO: try average pooling OR larger kernel size
|
||||||
self.max_pool1d = nn.Sequential(
|
self.max_pool1d = nn.Sequential(
|
||||||
nn.ConstantPad1d([0, 1], value=0),
|
nn.ConstantPad1d([0, 1], value=0),
|
||||||
|
|||||||
Reference in New Issue
Block a user