class_docstr: Non-Attentive Tacotron (NAT) Duration Predictor module.
class_docstr_tok: ["Non-Attentive","Tacotron","(","NAT",")","Duration","Predictor","module","."]
docstr: :param encoder_outputs: [batch_size, hidden_length, encoder_lstm_dim]
  :param input_lengths: [batch_size, hidden_length]
  :return: [batch_size, hidden_length]
docstr_tok: [":","param","encoder_outputs",":","[","batch_size",",","hidden_length",",","encoder_lstm_dim","]",":","param","input_lengths",":","[","batch_size",",","hidden_length","]",":","return",":","[","batch_size",",","hidden_length","]"]
code: def forward(self, encoder_outputs, input_lengths=None):
      """
      :param encoder_outputs: [batch_size, hidden_length, encoder_lstm_dim]
      :param input_lengths: [batch_size, hidden_length]
      :return: [batch_size, hidden_length]
      """
  
      batch_size = encoder_outputs.size(0)
      hidden_length = encoder_outputs.size(1)
  
      # remove pad activations
      if input_lengths is not None:
          encoder_outputs = pack_padded_sequence(
              encoder_outputs,
              input_lengths,
              batch_first=True,
              enforce_sorted=False,
          )
  
      self.lstm.flatten_parameters()
      outputs, _ = self.lstm(encoder_outputs)
  
      if input_lengths is not None:
          outputs, _ = pad_packed_sequence(outputs, batch_first=True)
  
      outputs = self.relu(self.proj(outputs))
  
      return outputs.view(batch_size, hidden_length)
  
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 2 for calling the DurationPredictor obj's underlying member method code with example usage: obj.forward(encoder_outputs, input_lengths) and returns: outputs