class_docstr: Time series encoder. This module can learn features for any `order_by` temporal column, both with and without accompanying target data.
  
  The backbone of this encoder is either a recurrent neural network or a transformer; both structured in an encoder-decoder fashion.
class_docstr_tok: ["Time","series","encoder",".","This","module","can","learn","features","for","any","`","order_by","`","temporal","column",",","both","with","and","without","accompanying","target","data",".","The","backbone","of","this","encoder","is","either","a","recurrent","neural","network","or","a","transformer",";","both","structured","in","an","encoder-decoder","fashion","."]
docstr: Convert to array and determine max length
docstr_tok: ["Convert","to","array","and","determine","max","length"]
code: def _prepare_raw_data(self, data):
      """Convert to array and determine max length"""
      out_data = []
      for e in data:
          if not isinstance(e, torch.Tensor):
              e = np.array(e, dtype=float)
              e[np.isnan(e)] = 0.0
              t = torch.tensor(e, dtype=torch.float)
          else:
              t = e.float()
          t[torch.isnan(t)] = 0.0
          out_data.append(t)
      lengths = torch.tensor([len(e) for e in data], dtype=torch.float)
      return out_data, lengths
  
imports: import time
  from math import gcd
  from typing import List
  from copy import deepcopy
  import numpy
  import pandas
  import torch
  import torch.nn
  from torch import optim
  from type_infer.dtype import dtype
  from lightwood.helpers.log import log
  from lightwood.encoder.base import BaseEncoder
  from lightwood.helpers.device import get_device_from_name
  from lightwood.helpers.torch import LightwoodAutocast
  from lightwood.encoder.datetime import DatetimeNormalizerEncoder
  from lightwood.encoder.time_series.helpers.rnn_helpers import EncoderRNNNumerical, DecoderRNNNumerical
  from lightwood.encoder.helpers import MinMaxNormalizer, CatNormalizer
  from lightwood.encoder.time_series.helpers.transformer_helpers import TransformerEncoder, get_chunk, len_to_mask
label_desc: Use image node_id 4 for calling the TimeSeriesEncoder obj's underlying member method code with example usage: obj._prepare_raw_data(data) and returns: out_data,  lengths