class_docstr: Representation consisting of stacked multi-head self-attention
  and position-wise feed-forward layers. Unlike `Transformer`, we assume
  inputs are already embedded, thus this representation can be used as
  a drop-in replacement for other temporal representations over
  text inputs (e.g., `BiLSTM` and `DeepCNNDeepCNNRepresentation`).
docstr: Forward inputs through the transformer layers.
  
  Args:
      embedded_tokens (B x T x H): Tokens previously encoded with token,
      positional, and segment embeddings.
      padding_mask (B x T): Boolean mask specifying token positions that
      self-attention should not operate on.
  
  Returns:
      last_state (B x T x H): Final transformer layer state.
docstr_tok: ["Forward","inputs","through","the","transformer","layers",".","Args",":","embedded_tokens","(","B","x","T","x","H",")",":","Tokens","previously","encoded","with","token",",","positional",",","and","segment","embeddings",".","padding_mask","(","B","x","T",")",":","Boolean","mask","specifying","token","positions","that","self-attention","should","not","operate","on",".","Returns",":","last_state","(","B","x","T","x","H",")",":","Final","transformer","layer","state","."]
code: def forward(
      self, embedded_tokens: Tensor, padding_mask: Tensor
  ) -> Tensor:
      """
      Forward inputs through the transformer layers.
  
      Args:
          embedded_tokens (B x T x H): Tokens previously encoded with token,
          positional, and segment embeddings.
          padding_mask (B x T): Boolean mask specifying token positions that
          self-attention should not operate on.
  
      Returns:
          last_state (B x T x H): Final transformer layer state.
      """
  
      last_state = embedded_tokens.transpose(0, 1)
      for layer in self.layers:
          last_state = layer(last_state, padding_mask)
      return last_state.transpose(0, 1)
  
file_path: pytext/pytext/models/representations/transformer/representation.py
imports: from typing import Optional
  import torch.nn
  from pytext.config import ConfigBase
  from pytext.models.module import Module
  from pytext.utils.usage import log_class_usage
  from pytorch.text.fb.nn.modules.multihead_attention import MultiheadSelfAttention
  from pytorch.text.fb.nn.modules.residual_mlp import ResidualMLP
  from pytorch.text.fb.nn.modules.transformer import TransformerLayer
  from torch import Tensor
label_desc: Use image node_id 3 for calling the TransformerRepresentation obj's underlying member method code with example usage: obj.forward(embedded_tokens, padding_mask) and returns: last_state