docstr: Predict using a trained forecaster.
  
  :param data: The data support following formats:
  
         | 1. numpy ndarrays: generate from `TSDataset.roll`,
              be sure to set label_len > 0 and time_enc = True
         | 2. pytorch dataloader: generate from `TSDataset.to_torch_data_loader`,
              be sure to set label_len > 0, time_enc = True and is_predict = True
         | 3. A bigdl.chronos.data.tsdataset.TSDataset instance
  
  :param batch_size: predict batch size. The value will not affect predict
         result but will affect resources cost(e.g. memory and time).
  
  :return: A list of numpy ndarray
docstr_tok: ["Predict","using","a","trained","forecaster",".",":","param","data",":","The","data","support","following","formats",":","|","1.","numpy","ndarrays",":","generate","from","`","TSDataset.roll","`",",","be","sure","to","set","label_len",">","0","and","time_enc","=","True","|","2.","pytorch","dataloader",":","generate","from","`","TSDataset.to_torch_data_loader","`",",","be","sure","to","set","label_len",">","0",",","time_enc","=","True","and","is_predict","=","True","|","3",".","A","bigdl.chronos.data.tsdataset.TSDataset","instance",":","param","batch_size",":","predict","batch","size",".","The","value","will","not","affect","predict","result","but","will","affect","resources","cost","(","e.g",".","memory","and","time",")",".",":","return",":","A","list","of","numpy","ndarray"]
code: def predict(self, data, batch_size=32):
      """
      Predict using a trained forecaster.
  
      :param data: The data support following formats:
  
             | 1. numpy ndarrays: generate from `TSDataset.roll`,
                  be sure to set label_len > 0 and time_enc = True
             | 2. pytorch dataloader: generate from `TSDataset.to_torch_data_loader`,
                  be sure to set label_len > 0, time_enc = True and is_predict = True
             | 3. A bigdl.chronos.data.tsdataset.TSDataset instance
  
      :param batch_size: predict batch size. The value will not affect predict
             result but will affect resources cost(e.g. memory and time).
  
      :return: A list of numpy ndarray
      """
      if self.distributed:
          invalidInputError(
              False, "distributed is not support in Autoformer"
          )
      # transform a TSDataset instance to dataloader
      if isinstance(data, TSDataset):
          _rolled = data.numpy_x is None
          data = data.to_torch_data_loader(
              batch_size=batch_size,
              roll=_rolled,
              lookback=self.data_config["past_seq_len"],
              horizon=self.data_config["future_seq_len"],
              label_len=self.data_config["label_len"],
              time_enc=True,
              feature_col=data.roll_feature,
              target_col=data.roll_target,
              shuffle=False,
          )
      invalidInputError(
          isinstance(data, tuple) or isinstance(data, DataLoader),
          "The input data to predict() support formats: numpy ndarray tuple"
          f" and pytorch dataloader, but found {type(data)}.",
      )
      if isinstance(data, tuple):
          data = DataLoader(
              TensorDataset(
                  torch.from_numpy(data[0]),
                  torch.from_numpy(data[1]),
                  torch.from_numpy(data[2]),
                  torch.from_numpy(data[3]),
              ),
              batch_size=batch_size,
              shuffle=False,
          )
      if not self.context_enabled:
          self.cxt_manager = ForecasterContextManager(
              self, self.thread_num, optimize=False
          )
      with self.cxt_manager:
          return self.trainer.predict(self.internal, data)
  
imports: import torch
  import numpy
  from pandas import Timedelta
  from bigdl.chronos.forecaster.abstract import Forecaster
  from bigdl.chronos.forecaster.utils import read_csv, delete_folder
  from bigdl.chronos.metric.forecast_metrics import Evaluator
  from bigdl.chronos.model.autoformer import model_creator, loss_creator
  from torch.utils.data import TensorDataset, DataLoader
  from bigdl.chronos.model.autoformer.Autoformer import AutoFormer, _transform_config_to_namedtuple
  from bigdl.nano.utils.common import invalidInputError, invalidOperationError
  from bigdl.chronos.forecaster.utils import check_transformer_data
  from bigdl.chronos.pytorch import TSTrainer
  from bigdl.chronos.data import TSDataset
  from bigdl.nano.automl.hpo.space import Space
  from bigdl.chronos.forecaster.utils_hpo import GenericTSTransformerLightningModule, _config_has_search_space
  from bigdl.chronos.pytorch.context_manager import DummyForecasterContextManager, ForecasterContextManager
  from .utils_hpo import _format_metric_str
  import warnings
  from tempfile import TemporaryDirectory
  import os
label_desc: Use image node_id 7 for calling the AutoformerForecaster obj's underlying member method code with example usage: obj.predict(data, batch_size) and returns: self