code: def __init__(self, ninp, nhead, nhid, nlayers, dropout=0.2):
      super(TransformerEncoder, self).__init__()
      self.src_mask = None
      self.src_linear = nn.Linear(ninp, nhid)
      self.pos_encoder = PositionalEncoding(nhid, dropout)
      encoder_layers = nn.TransformerEncoderLayer(
          d_model=nhid,
          nhead=nhead,
          dim_feedforward=nhid,
          dropout=dropout,
      )
      self.transformer_encoder = nn.TransformerEncoder(
          encoder_layers, nlayers
      )
      self.src_decoder = nn.Linear(nhid, ninp)
      self.init_weights()
  
file_path: lightwood/lightwood/encoder/time_series/helpers/transformer_helpers.py
imports: import math
  import torch
  import torch.nn
  from lightwood.helpers.torch import LightwoodAutocast
label_desc: Use image node_id 1 to create a new TransformerEncoder object from inherited base classes: nn with example: obj = TransformerEncoder(ninp, nhead, nhid, nlayers, dropout)