code: def encode(self, column_data):
      if not self.is_prepared:
          raise Exception(
              'You need to call "prepare" before calling "encode" or "decode".'
          )
  
      no_null_sentences = [
          x if x is not None else "" for x in column_data
      ]
      ret = []
      with torch.no_grad():
          for row in no_null_sentences:
              encoder_hidden = self._encoder.initHidden()
              input_tensor = tensorFromSentence(
                  self._input_lang, row, device=self.device
              )
              input_length = input_tensor.size(0)
  
              # encoder_outputs = torch.zeros(max_length, encoder.hidden_size, device=self.device)
  
              loss = 0
  
              for ei in range(input_length):
                  encoder_output, encoder_hidden = self._encoder(
                      input_tensor[ei], encoder_hidden
                  )
                  # encoder_outputs[ei] = encoder_output[0, 0]
  
              # use the last hidden state as the encoded vector
              ret.append(encoder_hidden.tolist()[0][0])
  
      return torch.Tensor(ret)
  
file_path: lightwood/lightwood/encoder/text/rnn.py
imports: from lightwood.encoder.text.helpers.rnn_helpers import *
  from lightwood.encoder.base import BaseEncoder
  from lightwood.helpers.log import log
  import math
label_desc: Use image node_id 3 for calling the RnnEncoder obj's underlying member method code with example usage: obj.encode(column_data) and returns: torch