docstr: Predict input data.
  
  :param data: data to be predicted. It can be an XShards or a Spark Dataframe.
         If it is an XShards, each partition can be a Pandas DataFrame or a dictionary of
         {'x': feature}, where feature is a numpy array or a list of numpy arrays.
  :param batch_size: batch size used for inference.
  :param feature_cols: Feature column name(s) of data. Only used when data
         is a Spark DataFrame or an XShards of Pandas DataFrame. Default: None.
  :return: predicted result. The predict result is a XShards, each partition of the XShards
           is a dictionary of {'prediction': result}, where result is a numpy array or a list
           of numpy arrays.
docstr_tok: ["Predict","input","data",".",":","param","data",":","data","to","be","predicted",".","It","can","be","an","XShards","or","a","Spark","Dataframe",".","If","it","is","an","XShards",",","each","partition","can","be","a","Pandas","DataFrame","or","a","dictionary","of","{","'","x","'",":","feature","}",",","where","feature","is","a","numpy","array","or","a","list","of","numpy","arrays",".",":","param","batch_size",":","batch","size","used","for","inference",".",":","param","feature_cols",":","Feature","column","name","(","s",")","of","data",".","Only","used","when","data","is","a","Spark","DataFrame","or","an","XShards","of","Pandas","DataFrame",".","Default",":","None",".",":","return",":","predicted","result",".","The","predict","result","is","a","XShards",",","each","partition","of","the","XShards","is","a","dictionary","of","{","'prediction","'",":","result","}",",","where","result","is","a","numpy","array","or","a","list","of","numpy","arrays","."]
code: def predict(self, data, batch_size=4, feature_cols=None):
      """
      Predict input data.
  
      :param data: data to be predicted. It can be an XShards or a Spark Dataframe.
             If it is an XShards, each partition can be a Pandas DataFrame or a dictionary of
             {'x': feature}, where feature is a numpy array or a list of numpy arrays.
      :param batch_size: batch size used for inference.
      :param feature_cols: Feature column name(s) of data. Only used when data
             is a Spark DataFrame or an XShards of Pandas DataFrame. Default: None.
      :return: predicted result. The predict result is a XShards, each partition of the XShards
               is a dictionary of {'prediction': result}, where result is a numpy array or a list
               of numpy arrays.
      """
      from zoo.orca.learn.utils import convert_predict_rdd_to_xshard
  
      if isinstance(data, SparkXShards):
          if data._get_class_name() == "pandas.core.frame.DataFrame":
              data = process_xshards_of_pandas_dataframe(
                  data, feature_cols
              )
          from zoo.orca.data.utils import xshard_to_sample
  
          data_rdd = data.rdd.flatMap(xshard_to_sample)
  
      elif isinstance(data, DataFrame):
          schema = data.schema
          data_rdd = data.rdd.map(
              lambda row: row_to_sample(row, schema, feature_cols, None)
          )
      else:
          raise ValueError(
              "Data should be XShards, each element needs to be {'x': a feature "
              "numpy array}."
          )
      predicted_rdd = self.model.predict(
          data_rdd, batch_size=batch_size
      )
  
      if isinstance(data, SparkXShards):
          result = convert_predict_rdd_to_xshard(data, predicted_rdd)
      else:
          result = convert_predict_rdd_to_dataframe(data, predicted_rdd)
      return result
  
imports: from zoo.common.utils import enable_multi_fs_load, enable_multi_fs_save
  from zoo.orca.data.utils import row_to_sample, xshard_to_sample
  from zoo.orca.learn.utils import convert_predict_rdd_to_dataframe, bigdl_metric_results_to_dict, process_xshards_of_pandas_dataframe
  from zoo.pipeline.estimator.estimator import Estimator
  from zoo.orca.learn.ray_estimator import Estimator
  from zoo.orca.learn.pytorch.training_operator import TrainingOperator
  from zoo.orca.learn.spark_estimator import Estimator
  from zoo.orca.learn.optimizers import Optimizer, SGD
  from zoo.orca.learn.metrics import Accuracy
  from zoo.orca.data import SparkXShards
  from bigdl.optim.optimizer import MaxEpoch, OptimMethod
  from zoo.feature.common import FeatureSet
  from torch.optim.optimizer import Optimizer
  from torch.utils.data import DataLoader
  from pyspark.sql import DataFrame
  import warnings
  import torch
  import types
label_desc: Use image node_id 6 for calling the PyTorchSparkEstimator obj's underlying member method code with example usage: obj.predict(data, batch_size, feature_cols) and returns: result