class_docstr: ESPnet model for GAN-based text-to-speech task.
class_docstr_tok: ["ESPnet","model","for","GAN-based","text-to-speech","task","."]
docstr: Initialize ESPnetGANTTSModel module.
docstr_tok: ["Initialize","ESPnetGANTTSModel","module","."]
code: def __init__(
      self,
      feats_extract: Optional[AbsFeatsExtract],
      normalize: Optional[AbsNormalize and InversibleInterface],
      pitch_extract: Optional[AbsFeatsExtract],
      pitch_normalize: Optional[AbsNormalize and InversibleInterface],
      energy_extract: Optional[AbsFeatsExtract],
      energy_normalize: Optional[AbsNormalize and InversibleInterface],
      tts: AbsGANTTS,
  ):
      """Initialize ESPnetGANTTSModel module."""
      assert check_argument_types()
      super().__init__()
      self.feats_extract = feats_extract
      self.normalize = normalize
      self.pitch_extract = pitch_extract
      self.pitch_normalize = pitch_normalize
      self.energy_extract = energy_extract
      self.energy_normalize = energy_normalize
      self.tts = tts
      assert hasattr(
          tts, "generator"
      ), "generator module must be registered as tts.generator"
      assert hasattr(
          tts, "discriminator"
      ), "discriminator module must be registered as tts.discriminator"
  
      if feats_extract is not None:
          if hasattr(tts.generator, "vocoder"):
              upsample_factor = tts.generator["vocoder"].upsample_factor
          else:
              upsample_factor = tts.generator.upsample_factor
          assert (
              feats_extract.get_parameters()["n_shift"]
              == upsample_factor
          ), "n_shift must be equal to upsample_factor"
  
file_path: espnet/espnet2/gan_tts/espnet_model.py
imports: from contextlib import contextmanager
  from typing import Any, Dict, Optional
  import torch
  from packaging.version import parse
  from typeguard import check_argument_types
  from espnet2.gan_tts.abs_gan_tts import AbsGANTTS
  from espnet2.layers.abs_normalize import AbsNormalize
  from espnet2.layers.inversible_interface import InversibleInterface
  from espnet2.train.abs_gan_espnet_model import AbsGANESPnetModel
  from espnet2.tts.feats_extract.abs_feats_extract import AbsFeatsExtract
label_desc: Use image node_id 1 to create a new ESPnetGANTTSModel object from inherited base classes: AbsGANESPnetModel with example: obj = ESPnetGANTTSModel(feats_extract, normalize, pitch_extract, pitch_normalize, energy_extract, energy_normalize, tts)