class_docstr: Duration predictor module.
  
  This is a module of duration predictor described
  in `FastSpeech: Fast, Robust and Controllable Text to Speech`_.
  The duration predictor predicts a duration of each frame in log domain
  from the hidden embeddings of encoder.
  
  .. _`FastSpeech: Fast, Robust and Controllable Text to Speech`:
      https://arxiv.org/pdf/1905.09263.pdf
  
  Note:
      The calculation domain of outputs is different
      between in `forward` and in `inference`. In `forward`,
      the outputs are calculated in log domain but in `inference`,
      those are calculated in linear domain.
docstr: Initilize duration predictor module.
  
  Args:
      idim (int): Input dimension.
      n_layers (int, optional): Number of convolutional layers.
      n_chans (int, optional): Number of channels of convolutional layers.
      kernel_size (int, optional): Kernel size of convolutional layers.
      dropout_rate (float, optional): Dropout rate.
      offset (float, optional): Offset value to avoid nan in log domain.
code: def __init__(
      self,
      idim,
      n_layers=2,
      n_chans=384,
      kernel_size=3,
      dropout_rate=0.1,
      offset=1.0,
  ):
      """Initilize duration predictor module.
  
      Args:
          idim (int): Input dimension.
          n_layers (int, optional): Number of convolutional layers.
          n_chans (int, optional): Number of channels of convolutional layers.
          kernel_size (int, optional): Kernel size of convolutional layers.
          dropout_rate (float, optional): Dropout rate.
          offset (float, optional): Offset value to avoid nan in log domain.
  
      """
      super(DurationPredictor, self).__init__()
      self.offset = offset
      self.conv = torch.nn.ModuleList()
      for idx in range(n_layers):
          in_chans = idim if idx == 0 else n_chans
          self.conv += [
              torch.nn.Sequential(
                  torch.nn.Conv1d(
                      in_chans,
                      n_chans,
                      kernel_size,
                      stride=1,
                      padding=(kernel_size - 1) // 2,
                  ),
                  torch.nn.ReLU(),
                  LayerNorm(n_chans, dim=1),
                  torch.nn.Dropout(dropout_rate),
              )
          ]
      self.linear = torch.nn.Linear(n_chans, 1)
  
file_path: espnet/espnet/nets/pytorch_backend/fastspeech/duration_predictor.py
imports: import torch
  from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm
label_desc: Use image node_id 1 to create a new DurationPredictor object from inherited base classes: torch.nn with example: obj = DurationPredictor(idim, n_layers, n_chans, kernel_size, dropout_rate, offset)