code: def get_chunk(source, source_lengths, start, step):
      """Source is 3D tensor, shaped (batch_size, timesteps, n_dimensions), assuming static sequence length"""
      # Compute the lengths of the sequences (-1 due to the last element being used as target but not as data!
      trunc_seq_len = int(source_lengths[0].item() - 1)
      lengths = (
          torch.zeros(source.shape[0])
          .fill_(trunc_seq_len)
          .to(source.device)
      )
  
      # This is necessary for MultiHeadedAttention to work
      end = min(start + step, trunc_seq_len)
      data = source[:, start:end, :]
      target = source[:, start + 1 : end + 1, :]
  
      return data, target, lengths
  
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 2 for calling a global function with example usage: get_chunk(source, source_lengths, start, step) and returns: data,  target,  lengths