code: def forward(self, src, lengths, device):
      with LightwoodAutocast():
          if self.src_mask is None or self.src_mask.size(0) != src.size(
              0
          ):
              # Attention mask to avoid attending to upcoming parts of the sequence
              self.src_mask = self._generate_square_subsequent_mask(
                  src.size(0)
              ).to(device)
          src = self.src_linear(src)
          # src = self.pos_encoder(src) # not sure if this is helpful in time series
          # The lengths_mask has to be of size [batch, lengths]
          lengths_mask = len_to_mask(lengths, zeros=True).to(device)
          hidden = self.transformer_encoder(
              src, mask=self.src_mask, src_key_padding_mask=lengths_mask
          )
          output = self.src_decoder(hidden)
          return output, hidden
  
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 4 for calling the TransformerEncoder obj's underlying member method code with example usage: obj.forward(src, lengths, device) and returns: output,  hidden