code: def __init__(
      self,
      input_size: int,
      max_sequence_length: int,
      hidden_size: int = 256,
      num_heads: int = 8,
      output_size: int = 256,
      num_layers: int = 1,
      dropout: float = 0.1,
      **kwargs,
  ):
      super().__init__()
      self.supports_masking = True
      self.max_sequence_length = max_sequence_length
      self.input_size = input_size
      self.hidden_size = hidden_size
  
      self.layers = nn.ModuleList()
  
      prior_input_size = input_size
      for i in range(num_layers):
          layer = TransformerBlock(
              input_size=prior_input_size,
              max_sequence_length=max_sequence_length,
              hidden_size=hidden_size,
              num_heads=num_heads,
              output_size=output_size,
              dropout=dropout,
          )
          self.layers.append(layer)
          prior_input_size = self.layers[i].output_shape[-1]
  
      for layer in self.layers:
          logger.debug(f"   {layer._get_name()}")
  
imports: import logging
  import torch
  from torch import nn
  from torch.nn import functional
  from ludwig.utils.torch_utils import get_activation, LudwigModule
label_desc: Use image node_id 1 to create a new TransformerStack object from inherited base classes: LudwigModule with example: obj = TransformerStack(input_size, max_sequence_length, hidden_size, num_heads, output_size, num_layers, dropout)