class_docstr: Encoder module of Spectrogram prediction network.
  
  This is a module of encoder of Spectrogram prediction network in Tacotron2,
  which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel
  Spectrogram Predictions`_. This is the encoder which converts either a sequence
  of characters or acoustic features into the sequence of hidden states.
  
  .. _`Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`:
     https://arxiv.org/abs/1712.05884
docstr: Inference.
  
  Args:
      x (Tensor): The sequeunce of character ids (T,)
              or acoustic feature (T, idim * encoder_reduction_factor).
  
  Returns:
      Tensor: The sequences of encoder states(T, eunits).
docstr_tok: ["Inference",".","Args",":","x","(","Tensor",")",":","The","sequeunce","of","character","ids","(","T",",",")","or","acoustic","feature","(","T",",","idim","*","encoder_reduction_factor",")",".","Returns",":","Tensor",":","The","sequences","of","encoder","states","(","T",",","eunits",")","."]
code: def inference(self, x):
      """Inference.
  
      Args:
          x (Tensor): The sequeunce of character ids (T,)
                  or acoustic feature (T, idim * encoder_reduction_factor).
  
      Returns:
          Tensor: The sequences of encoder states(T, eunits).
  
      """
      xs = x.unsqueeze(0)
      ilens = torch.tensor([x.size(0)])
  
      return self.forward(xs, ilens)[0][0]
  
imports: import torch
  from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
label_desc: Use image node_id 3 for calling the Encoder obj's underlying member method code with example usage: obj.inference(x) and returns: self