From aa6fb5d584574ec20acd5c97f9d4fb22b4709563 Mon Sep 17 00:00:00 2001 From: TianYuan Date: Tue, 7 Mar 2023 12:34:43 +0000 Subject: [PATCH] fix variable names --- paddlespeech/t2s/models/vits/generator.py | 4 ++-- paddlespeech/t2s/models/vits/transform.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/paddlespeech/t2s/models/vits/generator.py b/paddlespeech/t2s/models/vits/generator.py index 559d4b3af..fbd2d6653 100644 --- a/paddlespeech/t2s/models/vits/generator.py +++ b/paddlespeech/t2s/models/vits/generator.py @@ -279,7 +279,7 @@ class VITSGenerator(nn.Layer): from paddlespeech.t2s.models.vits.monotonic_align import maximum_path self.maximum_path = maximum_path - self.my_pad = nn.Pad1D( + self.pad1d = nn.Pad1D( padding=[1, 0], mode='constant', data_format='NLC', ) @@ -689,6 +689,6 @@ class VITSGenerator(nn.Layer): ''' path = paddle.cast(path, dtype='float32') - pad_tmp = self.my_pad(path)[:, :-1] + pad_tmp = self.pad1d(path)[:, :-1] path = path - pad_tmp return path.unsqueeze(1).transpose([0, 1, 3, 2]) * mask diff --git a/paddlespeech/t2s/models/vits/transform.py b/paddlespeech/t2s/models/vits/transform.py index ff027a9cc..61bd5ee2b 100644 --- a/paddlespeech/t2s/models/vits/transform.py +++ b/paddlespeech/t2s/models/vits/transform.py @@ -89,8 +89,8 @@ def unconstrained_rational_quadratic_spline( logabsdet = paddle.zeros(inputs.shape) if tails == "linear": # 注意 padding 的参数顺序 - mypad_1 = nn.Pad2D(padding=[1, 1, 0, 0], mode='constant') - unnormalized_derivatives = mypad_1(unnormalized_derivatives) + pad2d = nn.Pad2D(padding=[1, 1, 0, 0], mode='constant') + unnormalized_derivatives = pad2d(unnormalized_derivatives) constant = np.log(np.exp(1 - min_derivative) - 1) unnormalized_derivatives[..., 0] = constant unnormalized_derivatives[..., -1] = constant @@ -143,7 +143,7 @@ def rational_quadratic_spline( # for dygraph to static # if paddle.min(inputs) < left or paddle.max(inputs) > right: # raise ValueError("Input to a transform is not within its domain") - mypad_2 = nn.Pad1D( + pad1d = nn.Pad1D( padding=[1, 0], mode='constant', data_format='NCL', ) @@ -159,7 +159,7 @@ def rational_quadratic_spline( widths = min_bin_width + (1 - min_bin_width * num_bins) * widths cumwidths = paddle.cumsum(widths, axis=-1) - cumwidths = mypad_2(cumwidths.unsqueeze(0)).squeeze() + cumwidths = pad1d(cumwidths.unsqueeze(0)).squeeze() cumwidths = (right - left) * cumwidths + left cumwidths[..., 0] = left cumwidths[..., -1] = right @@ -170,7 +170,7 @@ def rational_quadratic_spline( heights = F.softmax(unnormalized_heights, axis=-1) heights = min_bin_height + (1 - min_bin_height * num_bins) * heights cumheights = paddle.cumsum(heights, axis=-1) - cumheights = mypad_2(cumheights.unsqueeze(0)).squeeze() + cumheights = pad1d(cumheights.unsqueeze(0)).squeeze() cumheights = (top - bottom) * cumheights + bottom cumheights[..., 0] = bottom cumheights[..., -1] = top