docstr: Shapes:
      - x: :math:`[B, T]`
      - x_length: :math:`[B]`
docstr_tok: ["Shapes",":","-","x",":",":","math",":","`","[","B",",","T","]","`","-","x_length",":",":","math",":","`","[","B","]","`"]
code: def forward(self, x, x_lengths, lang_emb=None):
      """
      Shapes:
          - x: :math:`[B, T]`
          - x_length: :math:`[B]`
      """
      assert x.shape[0] == x_lengths.shape[0]
      x = self.emb(x) * math.sqrt(self.hidden_channels)  # [b, t, h]
  
      # concat the lang emb in embedding chars
      if lang_emb is not None:
          x = torch.cat(
              (
                  x,
                  lang_emb.transpose(2, 1).expand(
                      x.size(0), x.size(1), -1
                  ),
              ),
              dim=-1,
          )
  
      x = torch.transpose(x, 1, -1)  # [b, h, t]
      x_mask = torch.unsqueeze(
          sequence_mask(x_lengths, x.size(2)), 1
      ).to(
          x.dtype
      )  # [b, 1, t]
  
      x = self.encoder(x * x_mask, x_mask)
      stats = self.proj(x) * x_mask
  
      m, logs = torch.split(stats, self.out_channels, dim=1)
      return x, m, logs, x_mask
  
imports: import math
  import torch
  from torch import nn
  from TTS.tts.layers.glow_tts.glow import WN
  from TTS.tts.layers.glow_tts.transformer import RelativePositionTransformer
  from TTS.tts.utils.helpers import sequence_mask
label_desc: Use image node_id 2 for calling the TextEncoder obj's underlying member method code with example usage: obj.forward(x, x_lengths, lang_emb) and returns: x,  m,  logs,  x_mask