fix variable names

pull/3002/head
TianYuan 3 years ago
parent 6541580cd8
commit aa6fb5d584

@ -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

@ -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

Loading…
Cancel
Save