docstr: Use a model to do prediction.
  
  :param x: Input data. It could be:
      - a TFDataset object
      - A Numpy array (or array-like), or a list of arrays
         (in case the model has multiple inputs).
      - A dict mapping input names to the corresponding array/tensors,
      if the model has named inputs.
  :param batch_per_thread:
    The default value is 1.
    When distributed is True,the total batch size is batch_per_thread * rdd.getNumPartitions.
    When distributed is False the total batch size is batch_per_thread * numOfCores.
  :param distributed: Boolean. Whether to do prediction in distributed mode or local mode.
               Default is True. In local mode, x must be a Numpy array.
docstr_tok: ["Use","a","model","to","do","prediction",".",":","param","x",":","Input","data",".","It","could","be",":","-","a","TFDataset","object","-","A","Numpy","array","(","or","array-like",")",",","or","a","list","of","arrays","(","in","case","the","model","has","multiple","inputs",")",".","-","A","dict","mapping","input","names","to","the","corresponding","array\/tensors",",","if","the","model","has","named","inputs",".",":","param","batch_per_thread",":","The","default","value","is","1",".","When","distributed","is","True",",","the","total","batch","size","is","batch_per_thread","*","rdd.getNumPartitions",".","When","distributed","is","False","the","total","batch","size","is","batch_per_thread","*","numOfCores",".",":","param","distributed",":","Boolean",".","Whether","to","do","prediction","in","distributed","mode","or","local","mode",".","Default","is","True",".","In","local","mode",",","x","must","be","a","Numpy","array","."]
code: def predict(self, x, batch_per_thread=None, distributed=False):
      """
      Use a model to do prediction.
  
      :param x: Input data. It could be:
          - a TFDataset object
          - A Numpy array (or array-like), or a list of arrays
             (in case the model has multiple inputs).
          - A dict mapping input names to the corresponding array/tensors,
          if the model has named inputs.
      :param batch_per_thread:
        The default value is 1.
        When distributed is True,the total batch size is batch_per_thread * rdd.getNumPartitions.
        When distributed is False the total batch size is batch_per_thread * numOfCores.
      :param distributed: Boolean. Whether to do prediction in distributed mode or local mode.
                   Default is True. In local mode, x must be a Numpy array.
      """
  
      if isinstance(x, TFDataset):
          # todo check arguments
          if not x.has_batch:
              invalidInputError(
                  False,
                  "The batch_per_thread of TFDataset"
                  + " must be specified when used in KerasModel predict.",
              )
          return self._predict_distributed(x)
      else:
          if distributed:
              sc = getOrCreateSparkContext()
              rdd, types, shapes = _create_rdd_x(
                  x, self.model._feed_input_names, sc
              )
  
              dataset = TFDataset.from_rdd(
                  rdd,
                  names=self.model._feed_input_names,
                  types=types,
                  shapes=shapes,
                  batch_per_thread=-1
                  if batch_per_thread is None
                  else batch_per_thread,
              )
              results = self._predict_distributed(dataset).collect()
              output_num = len(self.model.outputs)
              if output_num == 1:
                  return np.stack(results)
              else:
                  predictions = []
                  for i in range(0, output_num):
                      predictions.append(
                          np.stack([res[i] for res in results])
                      )
                  return predictions
          else:
              return self.model.predict(
                  x=x, batch_size=batch_per_thread
              )
  
imports: import numpy
  from bigdl.dllib.optim.optimizer import MaxEpoch
  from bigdl.orca.tfpark.utils import evaluate_string_metrics
  from bigdl.dllib.utils.file_utils import enable_multi_fs_save, enable_multi_fs_load
  from bigdl.dllib.nncontext import getOrCreateSparkContext
  from bigdl.orca.tfpark.tf_dataset import TFNdarrayDataset, TFDataset, _standarize_feature_label_dataset, check_data_compatible
  from bigdl.orca.tfpark.tf_optimizer import TFOptimizer
  from bigdl.orca.tfpark.tf_predictor import TFPredictor
  from bigdl.dllib.utils.log4Error import *
label_desc: Use image node_id 14 for calling the KerasModel obj's underlying member method code with example usage: obj.predict(x, batch_per_thread, distributed) and returns: self, self, np, predictions