class_docstr: Neural HMM Encoder
  
  Same as Tacotron 2 encoder but increases the input length by states per phone
  
  Args:
      num_chars (int): Number of characters in the input.
      state_per_phone (int): Number of states per phone.
      in_out_channels (int): number of input and output channels.
      n_convolutions (int): number of convolutional layers.
class_docstr_tok: ["Neural","HMM","Encoder","Same","as","Tacotron","2","encoder","but","increases","the","input","length","by","states","per","phone","Args",":","num_chars","(","int",")",":","Number","of","characters","in","the","input",".","state_per_phone","(","int",")",":","Number","of","states","per","phone",".","in_out_channels","(","int",")",":","number","of","input","and","output","channels",".","n_convolutions","(","int",")",":","number","of","convolutional","layers","."]
docstr: Inference to the encoder.
  
  Args:
      x (torch.FloatTensor): input text indices.
          - shape: :math:`(b, T_{in})`
      x_len (torch.LongTensor): input text lengths.
          - shape: :math:`(b,)`
  
  Returns:
      Tuple[torch.FloatTensor, torch.LongTensor]: encoder outputs and output lengths.
          -shape: :math:`((b, T_{in} * states_per_phone, in_out_channels), (b,))`
docstr_tok: ["Inference","to","the","encoder",".","Args",":","x","(","torch.FloatTensor",")",":","input","text","indices",".","-","shape",":",":","math",":","`","(","b",",","T_","{","in","}",")","`","x_len","(","torch.LongTensor",")",":","input","text","lengths",".","-","shape",":",":","math",":","`","(","b",",",")","`","Returns",":","Tuple","[","torch.FloatTensor",",","torch.LongTensor","]",":","encoder","outputs","and","output","lengths",".","-shape",":",":","math",":","`","(","(","b",",","T_","{","in","}","*","states_per_phone",",","in_out_channels",")",",","(","b",",",")",")","`"]
code: def inference(self, x, x_len):
      """Inference to the encoder.
  
      Args:
          x (torch.FloatTensor): input text indices.
              - shape: :math:`(b, T_{in})`
          x_len (torch.LongTensor): input text lengths.
              - shape: :math:`(b,)`
  
      Returns:
          Tuple[torch.FloatTensor, torch.LongTensor]: encoder outputs and output lengths.
              -shape: :math:`((b, T_{in} * states_per_phone, in_out_channels), (b,))`
      """
      b, T = x.shape
      o = self.emb(x).transpose(1, 2)
      for layer in self.convolutions:
          o = layer(o)
      o = o.transpose(1, 2)
      # self.lstm.flatten_parameters()
      o, _ = self.lstm(o)
      o = o.reshape(b, T * self.state_per_phone, self.in_out_channels)
      x_len = x_len * self.state_per_phone
      return o, x_len
  
imports: from typing import List, Tuple
  import torch
  import torch.nn.functional
  from torch import nn
  from tqdm.auto import tqdm
  from TTS.tts.layers.tacotron.common_layers import Linear
  from TTS.tts.layers.tacotron.tacotron2 import ConvBNBlock
label_desc: Use image node_id 3 for calling the Encoder obj's underlying member method code with example usage: obj.inference(x, x_len) and returns: o,  x_len