class_docstr: FastSpeech2 module.
  
  This is a module of FastSpeech2 described in `FastSpeech 2: Fast and
  High-Quality End-to-End Text to Speech`_. Instead of quantized pitch and
  energy, we use token-averaged value introduced in `FastPitch: Parallel
  Text-to-speech with Pitch Prediction`_.
  
  .. _`FastSpeech 2: Fast and High-Quality End-to-End Text to Speech`:
      https://arxiv.org/abs/2006.04558
  .. _`FastPitch: Parallel Text-to-speech with Pitch Prediction`:
      https://arxiv.org/abs/2006.06873
class_docstr_tok: ["FastSpeech2","module",".","This","is","a","module","of","FastSpeech2","described","in","`","FastSpeech","2",":","Fast","and","High-Quality","End-to-End","Text","to","Speech","`","_",".","Instead","of","quantized","pitch","and","energy",",","we","use","token-averaged","value","introduced","in","`","FastPitch",":","Parallel","Text-to-speech","with","Pitch","Prediction","`","_",".","..","_","`","FastSpeech","2",":","Fast","and","High-Quality","End-to-End","Text","to","Speech","`",":","https",":","\/\/arxiv.org\/abs\/2006.04558","..","_","`","FastPitch",":","Parallel","Text-to-speech","with","Pitch","Prediction","`",":","https",":","\/\/arxiv.org\/abs\/2006.06873"]
code: def _reset_parameters(
      self, init_type: str, init_enc_alpha: float, init_dec_alpha: float
  ):
      # initialize parameters
      if init_type != "pytorch":
          initialize(self, init_type)
  
      # initialize alpha in scaled positional encoding
      if self.encoder_type == "transformer" and self.use_scaled_pos_enc:
          self.encoder.embed[-1].alpha.data = torch.tensor(
              init_enc_alpha
          )
      if self.decoder_type == "transformer" and self.use_scaled_pos_enc:
          self.decoder.embed[-1].alpha.data = torch.tensor(
              init_dec_alpha
          )
  
imports: import logging
  from typing import Dict, Optional, Sequence, Tuple
  import torch
  import torch.nn.functional
  from typeguard import check_argument_types
  from espnet2.torch_utils.device_funcs import force_gatherable
  from espnet2.torch_utils.initialize import initialize
  from espnet2.tts.abs_tts import AbsTTS
  from espnet2.tts.fastspeech2.loss import FastSpeech2Loss
  from espnet2.tts.fastspeech2.variance_predictor import VariancePredictor
  from espnet2.tts.gst.style_encoder import StyleEncoder
  from espnet.nets.pytorch_backend.conformer.encoder import Encoder
  from espnet.nets.pytorch_backend.fastspeech.duration_predictor import DurationPredictor
  from espnet.nets.pytorch_backend.fastspeech.length_regulator import LengthRegulator
  from espnet.nets.pytorch_backend.nets_utils import make_non_pad_mask, make_pad_mask
  from espnet.nets.pytorch_backend.tacotron2.decoder import Postnet
  from espnet.nets.pytorch_backend.transformer.embedding import PositionalEncoding, ScaledPositionalEncoding
  from espnet.nets.pytorch_backend.transformer.encoder import Encoder
label_desc: Use image node_id 7 for calling the FastSpeech2 obj's underlying member method code with example usage: obj._reset_parameters(init_type, init_enc_alpha, init_dec_alpha) without return types