docstr: Inference function for WaveRNN.
  
  Based on the implementation from
  https://github.com/fatchord/WaveRNN/blob/master/models/fatchord_version.py.
  
  
  Currently only supports multinomial sampling.
  
  Args:
      specgram (Tensor): spectrogram of size (n_mels, n_time)
      mulaw (bool, optional): Whether to perform mulaw decoding (Default: ``True``).
      batched (bool, optional): Whether to perform batch prediction. Using batch prediction
          will significantly increase the inference speed (Default: ``True``).
      timesteps (int, optional): The time steps for each batch. Only used when `batched`
          is set to True (Default: ``100``).
      overlap (int, optional): The overlapping time steps between batches. Only used when
          `batched` is set to True (Default: ``5``).
  
  Returns:
      waveform (Tensor): Reconstructed waveform of size (1, n_time, ).
          1 represents single channel.
docstr_tok: ["Inference","function","for","WaveRNN",".","Based","on","the","implementation","from","https",":","\/\/github.com\/fatchord\/WaveRNN\/blob\/master\/models\/fatchord_version.py",".","Currently","only","supports","multinomial","sampling",".","Args",":","specgram","(","Tensor",")",":","spectrogram","of","size","(","n_mels",",","n_time",")","mulaw","(","bool",",","optional",")",":","Whether","to","perform","mulaw","decoding","(","Default",":","``","True","``",")",".","batched","(","bool",",","optional",")",":","Whether","to","perform","batch","prediction",".","Using","batch","prediction","will","significantly","increase","the","inference","speed","(","Default",":","``","True","``",")",".","timesteps","(","int",",","optional",")",":","The","time","steps","for","each","batch",".","Only","used","when","`","batched","`","is","set","to","True","(","Default",":","``","100","``",")",".","overlap","(","int",",","optional",")",":","The","overlapping","time","steps","between","batches",".","Only","used","when","`","batched","`","is","set","to","True","(","Default",":","``","5","``",")",".","Returns",":","waveform","(","Tensor",")",":","Reconstructed","waveform","of","size","(","1",",","n_time",",",")",".","1","represents","single","channel","."]
code: def forward(
      self,
      specgram: Tensor,
      mulaw: bool = True,
      batched: bool = True,
      timesteps: int = 100,
      overlap: int = 5,
  ) -> Tensor:
      r"""Inference function for WaveRNN.
  
      Based on the implementation from
      https://github.com/fatchord/WaveRNN/blob/master/models/fatchord_version.py.
  
  
      Currently only supports multinomial sampling.
  
      Args:
          specgram (Tensor): spectrogram of size (n_mels, n_time)
          mulaw (bool, optional): Whether to perform mulaw decoding (Default: ``True``).
          batched (bool, optional): Whether to perform batch prediction. Using batch prediction
              will significantly increase the inference speed (Default: ``True``).
          timesteps (int, optional): The time steps for each batch. Only used when `batched`
              is set to True (Default: ``100``).
          overlap (int, optional): The overlapping time steps between batches. Only used when
              `batched` is set to True (Default: ``5``).
  
      Returns:
          waveform (Tensor): Reconstructed waveform of size (1, n_time, ).
              1 represents single channel.
      """
      specgram = specgram.unsqueeze(0)
      if batched:
          specgram = _fold_with_overlap(specgram, timesteps, overlap)
  
      output = self.wavernn_model.infer(specgram).cpu()
  
      if mulaw:
          output = normalized_waveform_to_bits(
              output, self.wavernn_model.n_bits
          )
          output = torchaudio.functional.mu_law_decoding(
              output, self.wavernn_model.n_classes
          )
  
      if batched:
          output = _xfade_and_unfold(output, overlap)
      else:
          output = output[0]
  
      return output
  
file_path: audio/examples/pipeline_wavernn/wavernn_inference_wrapper.py
imports: import torch
  import torchaudio
  from processing import normalized_waveform_to_bits
  from torch import Tensor
  from torchaudio.models.wavernn import WaveRNN
label_desc: Use image node_id 2 for calling the WaveRNNInferenceWrapper obj's underlying member method code with example usage: obj.forward(specgram, mulaw, batched, timesteps, overlap) and returns: output