class_docstr: Forecaster base model for lstm, mtnet, seq2seq and tcn forecasters.
class_docstr_tok: ["Forecaster","base","model","for","lstm",",","mtnet",",","seq2seq","and","tcn","forecasters","."]
docstr: Predict using a trained forecaster with onnxruntime. The method can only be
  used when forecaster is a non-distributed version.
  
  Directly call this method without calling build_onnx is valid and Forecaster will
  automatically build an onnxruntime session with default settings.
  
  :param data: The data support following formats:
  
         | 1. a numpy ndarray x:
         | x's shape is (num_samples, lookback, feature_dim) where lookback and feature_dim
         | should be the same as past_seq_len and input_feature_num.
  
  :param batch_size: predict batch size. The value will not affect predict
         result but will affect resources cost(e.g. memory and time).
  :param dirname: The directory to save onnx model file. This value defaults
         to None for no saving file.
  
  :return: A numpy array with shape (num_samples, horizon, target_dim).
docstr_tok: ["Predict","using","a","trained","forecaster","with","onnxruntime",".","The","method","can","only","be","used","when","forecaster","is","a","non-distributed","version",".","Directly","call","this","method","without","calling","build_onnx","is","valid","and","Forecaster","will","automatically","build","an","onnxruntime","session","with","default","settings",".",":","param","data",":","The","data","support","following","formats",":","|","1.","a","numpy","ndarray","x",":","|","x","'s","shape","is","(","num_samples",",","lookback",",","feature_dim",")","where","lookback","and","feature_dim","|","should","be","the","same","as","past_seq_len","and","input_feature_num",".",":","param","batch_size",":","predict","batch","size",".","The","value","will","not","affect","predict","result","but","will","affect","resources","cost","(","e.g",".","memory","and","time",")",".",":","param","dirname",":","The","directory","to","save","onnx","model","file",".","This","value","defaults","to","None","for","no","saving","file",".",":","return",":","A","numpy","array","with","shape","(","num_samples",",","horizon",",","target_dim",")","."]
code: def predict_with_onnx(self, data, batch_size=32, dirname=None):
      """
      Predict using a trained forecaster with onnxruntime. The method can only be
      used when forecaster is a non-distributed version.
  
      Directly call this method without calling build_onnx is valid and Forecaster will
      automatically build an onnxruntime session with default settings.
  
      :param data: The data support following formats:
  
             | 1. a numpy ndarray x:
             | x's shape is (num_samples, lookback, feature_dim) where lookback and feature_dim
             | should be the same as past_seq_len and input_feature_num.
  
      :param batch_size: predict batch size. The value will not affect predict
             result but will affect resources cost(e.g. memory and time).
      :param dirname: The directory to save onnx model file. This value defaults
             to None for no saving file.
  
      :return: A numpy array with shape (num_samples, horizon, target_dim).
      """
      if self.distributed:
          raise NotImplementedError(
              "ONNX inference has not been supported for distributed\
                                         forecaster. You can call .to_local() to transform the\
                                         forecaster to a non-distributed version."
          )
      if not self.internal.model_built:
          raise RuntimeError(
              "You must call fit or restore first before calling predict!"
          )
      return self.internal.predict_with_onnx(
          data, batch_size=batch_size, dirname=dirname
      )
  
file_path: analytics-zoo/pyzoo/zoo/chronos/forecaster/base_forecaster.py
imports: from zoo.chronos.forecaster.abstract import Forecaster
  from zoo.orca.data.shard import SparkXShards
  from zoo.chronos.forecaster.utils import np_to_creator, set_pytorch_seed, check_data, xshard_to_np, np_to_xshard
  import numpy
  from zoo.orca.learn.pytorch.estimator import Estimator
  from zoo.orca.learn.metrics import MSE, MAE
label_desc: Use image node_id 4 for calling the BasePytorchForecaster obj's underlying member method code with example usage: obj.predict_with_onnx(data, batch_size, dirname) and returns: self