class_docstr: NaiveRNNDP-SVS module.
  
  This is an implementation of naive RNN with duration prediction
  for singing voice synthesis
  The features are processed directly over time-domain from music score and
  predict the singing voice features
class_docstr_tok: ["NaiveRNNDP-SVS","module",".","This","is","an","implementation","of","naive","RNN","with","duration","prediction","for","singing","voice","synthesis","The","features","are","processed","directly","over","time-domain","from","music","score","and","predict","the","singing","voice","features"]
docstr: Calculate forward propagation.
  
  Args:
      text (LongTensor): Batch of padded character ids (Tmax).
      feats (Tensor): Batch of padded target features (Lmax, odim).
      label (Optional[Dict]): key is "lab" or "score";
          value (LongTensor): Batch of padded label ids (Tmax).
      melody (Optional[Dict]): key is "lab" or "score";
          value (LongTensor): Batch of padded melody (Tmax).
      pitch (FloatTensor): Batch of padded f0 (Tmax).
      duration (Optional[Dict]): key is "lab", "score_phn" or "score_syb";
          value (LongTensor): Batch of padded duration (Tmax).
      slur (LongTensor): Batch of padded slur (B, Tmax).
      spembs (Optional[Tensor]): Batch of speaker embeddings (spk_embed_dim).
      sids (Optional[Tensor]): Batch of speaker IDs (1).
      lids (Optional[Tensor]): Batch of language IDs (1).
  
  Returns:
      Dict[str, Tensor]: Output dict including the following items:
          * feat_gen (Tensor): Output sequence of features (T_feats, odim).
docstr_tok: ["Calculate","forward","propagation",".","Args",":","text","(","LongTensor",")",":","Batch","of","padded","character","ids","(","Tmax",")",".","feats","(","Tensor",")",":","Batch","of","padded","target","features","(","Lmax",",","odim",")",".","label","(","Optional","[","Dict","]",")",":","key","is","``","lab","''","or","``","score","''",";","value","(","LongTensor",")",":","Batch","of","padded","label","ids","(","Tmax",")",".","melody","(","Optional","[","Dict","]",")",":","key","is","``","lab","''","or","``","score","''",";","value","(","LongTensor",")",":","Batch","of","padded","melody","(","Tmax",")",".","pitch","(","FloatTensor",")",":","Batch","of","padded","f0","(","Tmax",")",".","duration","(","Optional","[","Dict","]",")",":","key","is","``","lab","''",",","``","score_phn","''","or","``","score_syb","''",";","value","(","LongTensor",")",":","Batch","of","padded","duration","(","Tmax",")",".","slur","(","LongTensor",")",":","Batch","of","padded","slur","(","B",",","Tmax",")",".","spembs","(","Optional","[","Tensor","]",")",":","Batch","of","speaker","embeddings","(","spk_embed_dim",")",".","sids","(","Optional","[","Tensor","]",")",":","Batch","of","speaker","IDs","(","1",")",".","lids","(","Optional","[","Tensor","]",")",":","Batch","of","language","IDs","(","1",")",".","Returns",":","Dict","[","str",",","Tensor","]",":","Output","dict","including","the","following","items",":","*","feat_gen","(","Tensor",")",":","Output","sequence","of","features","(","T_feats",",","odim",")","."]
code: def inference(
      self,
      text: torch.Tensor,
      feats: Optional[torch.Tensor] = None,
      label: Optional[Dict[str, torch.Tensor]] = None,
      melody: Optional[Dict[str, torch.Tensor]] = None,
      pitch: Optional[torch.Tensor] = None,
      duration: Optional[Dict[str, torch.Tensor]] = None,
      slur: Optional[Dict[str, torch.Tensor]] = None,
      spembs: Optional[torch.Tensor] = None,
      sids: Optional[torch.Tensor] = None,
      lids: Optional[torch.Tensor] = None,
      joint_training: bool = False,
      use_teacher_forcing: torch.Tensor = False,
  ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]:
      """Calculate forward propagation.
  
      Args:
          text (LongTensor): Batch of padded character ids (Tmax).
          feats (Tensor): Batch of padded target features (Lmax, odim).
          label (Optional[Dict]): key is "lab" or "score";
              value (LongTensor): Batch of padded label ids (Tmax).
          melody (Optional[Dict]): key is "lab" or "score";
              value (LongTensor): Batch of padded melody (Tmax).
          pitch (FloatTensor): Batch of padded f0 (Tmax).
          duration (Optional[Dict]): key is "lab", "score_phn" or "score_syb";
              value (LongTensor): Batch of padded duration (Tmax).
          slur (LongTensor): Batch of padded slur (B, Tmax).
          spembs (Optional[Tensor]): Batch of speaker embeddings (spk_embed_dim).
          sids (Optional[Tensor]): Batch of speaker IDs (1).
          lids (Optional[Tensor]): Batch of language IDs (1).
  
      Returns:
          Dict[str, Tensor]: Output dict including the following items:
              * feat_gen (Tensor): Output sequence of features (T_feats, odim).
      """
      label = label["score"]
      midi = melody["score"]
      if joint_training:
          duration_ = duration["lab"]
      else:
          duration_ = duration["score_phn"]
  
      label_emb = self.encoder_input_layer(
          label
      )  # FIX ME: label Float to Int
      midi_emb = self.midi_encoder_input_layer(midi)
      duration_emb = self.duration_encoder_input_layer(duration_)
  
      hs_label, (_, _) = self.encoder(label_emb)
      hs_midi, (_, _) = self.midi_encoder(midi_emb)
      hs_duration, (_, _) = self.duration_encoder(duration_emb)
  
      if self.midi_embed_integration_type == "add":
          hs = hs_label + hs_midi + hs_duration
          hs = F.leaky_relu(self.midi_projection(hs))
      else:
          hs = torch.cat((hs_label, hs_midi, hs_duration), dim=-1)
          hs = F.leaky_relu(self.midi_projection(hs))
      # integrate spk & lang embeddings
      if self.spks is not None:
          sid_embs = self.sid_emb(sids.view(-1))
          hs = hs + sid_embs.unsqueeze(1)
      if self.langs is not None:
          lid_embs = self.lid_emb(lids.view(-1))
          hs = hs + lid_embs.unsqueeze(1)
      if spembs is not None:
          spembs = spembs.unsqueeze(0)
  
      # integrate speaker embedding
      if self.spk_embed_dim is not None:
          hs = self._integrate_with_spk_embed(hs, spembs)
  
      # forward duration predictor and length regulator
      d_masks = (
          None  # make_pad_mask(label_lengths).to(input_emb.device)
      )
      d_outs = self.duration_predictor.inference(
          hs, d_masks
      )  # (B, T_text)
      d_outs_int = torch.floor(d_outs + 0.5).to(
          dtype=torch.long
      )  # (B, T_text)
  
      hs = self.length_regulator(hs, d_outs_int)  # (B, T_feats, adim)
      zs, (_, _) = self.decoder(hs)
  
      # feat_out: (B, T_feats//r, dunits * dim_direction) -> (B, T_feats//r, odim * r)
      # view: (B, T_feats//r, odim * r) -> (B, T_feats//r * r, odim)
      before_outs = F.leaky_relu(
          self.feat_out(zs).view(zs.size(0), -1, self.odim)
      )
      # postnet -> (B, T_feats//r * r, odim)
      if self.postnet is None:
          after_outs = before_outs
      else:
          after_outs = before_outs + self.postnet(
              before_outs.transpose(1, 2)
          ).transpose(1, 2)
  
      return dict(feat_gen=after_outs[0], prob=None, att_w=None)
  
file_path: espnet/espnet2/svs/naive_rnn/naive_rnn_dp.py
imports: from typing import Dict, Optional, Tuple
  import torch
  import torch.nn.functional
  from typeguard import check_argument_types
  from espnet2.svs.abs_svs import AbsSVS
  from espnet2.torch_utils.device_funcs import force_gatherable
  from espnet2.torch_utils.initialize import initialize
  from espnet.nets.pytorch_backend.e2e_tts_fastspeech import FeedForwardTransformerLoss
  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_pad_mask
  from espnet.nets.pytorch_backend.tacotron2.decoder import Postnet
  from espnet.nets.pytorch_backend.tacotron2.encoder import Encoder
label_desc: Use image node_id 4 for calling the NaiveRNNDP obj's underlying member method code with example usage: obj.inference(text, feats, label, melody, pitch, duration, slur, spembs, sids, lids, joint_training, use_teacher_forcing) and returns: dict