From 2421a936ed271a514b09387d7bd595d59dc62532 Mon Sep 17 00:00:00 2001 From: chenfeiyu Date: Mon, 21 Dec 2020 17:41:18 +0800 Subject: [PATCH] fix positional encoding naming conflict --- parakeet/models/transformer_tts.py | 4 ++-- parakeet/modules/positional_encoding.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/parakeet/models/transformer_tts.py b/parakeet/models/transformer_tts.py index c7f0ccd..05ce008 100644 --- a/parakeet/models/transformer_tts.py +++ b/parakeet/models/transformer_tts.py @@ -391,7 +391,7 @@ class TransformerTTS(nn.Layer): padding_idx=frontend.vocab.padding_index, weight_attr=I.Uniform(-0.05, 0.05)) # position encoding matrix may be extended later - self.encoder_pe = pe.positional_encoding(0, 1000, d_encoder) + self.encoder_pe = pe.sinusoid_positional_encoding(0, 1000, d_encoder) self.encoder_pe_scalar = self.create_parameter( [1], attr=I.Constant(1.)) self.encoder = TransformerEncoder(d_encoder, n_heads, d_ffn, @@ -399,7 +399,7 @@ class TransformerTTS(nn.Layer): # decoder self.decoder_prenet = MLPPreNet(d_mel, d_prenet, d_decoder, dropout) - self.decoder_pe = pe.positional_encoding(0, 1000, d_decoder) + self.decoder_pe = pe.sinusoid_positional_encoding(0, 1000, d_decoder) self.decoder_pe_scalar = self.create_parameter( [1], attr=I.Constant(1.)) self.decoder = TransformerDecoder( diff --git a/parakeet/modules/positional_encoding.py b/parakeet/modules/positional_encoding.py index 07a86c9..cec168c 100644 --- a/parakeet/modules/positional_encoding.py +++ b/parakeet/modules/positional_encoding.py @@ -17,10 +17,10 @@ import numpy as np import paddle from paddle.nn import functional as F -__all__ = ["positional_encoding"] +__all__ = ["sinusoid_positional_encoding"] -def positional_encoding(start_index, length, size, dtype=None): +def sinusoid_positional_encoding(start_index, length, size, dtype=None): r"""Generate standard positional encoding matrix. .. math::