class_docstr: Non-Attentive Tacotron (NAT) Prenet.
class_docstr_tok: ["Non-Attentive","Tacotron","(","NAT",")","Prenet","."]
code: def __init__(self, idim, units=128, num_layers=2, dropout=0.5):
      super(Prenet, self).__init__()
      sizes = [units] * num_layers
      in_sizes = [idim] + sizes[:-1]
      self.layers = nn.ModuleList(
          [
              nn.Linear(in_size, out_size, bias=False)
              for (in_size, out_size) in zip(in_sizes, sizes)
          ]
      )
  
      self.dropout = nn.Dropout(p=dropout_p)
      self.activation = nn.ReLU()
  
imports: import logging
  from typing import Dict, Optional, Sequence, Tuple
  import torch
  import torch.nn.functional
  from typeguard import check_argument_types
  from espnet2.s2st.synthesizer.abs_synthesizer import AbsSynthesizer
  from espnet2.torch_utils.device_funcs import force_gatherable
  from espnet2.torch_utils.initialize import initialize
  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 1 to create a new Prenet object from inherited base classes: nn with example: obj = Prenet(idim, units, num_layers, dropout)